47 lines
785 B
Go
47 lines
785 B
Go
package cmd
|
|
|
|
import (
|
|
"ai-css/common"
|
|
"ai-css/library/logger"
|
|
"ai-css/models"
|
|
"ai-css/ws"
|
|
"errors"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "go-fly",
|
|
Short: "go-fly",
|
|
Long: `简洁快速的GO语言WEB在线客服 https://gofly.sopans.com`,
|
|
Args: args,
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
|
|
},
|
|
}
|
|
|
|
func args(cmd *cobra.Command, args []string) error {
|
|
if len(args) < 1 {
|
|
|
|
return errors.New("至少需要一个参数!")
|
|
}
|
|
return nil
|
|
}
|
|
func Execute() {
|
|
logger.InitDefault()
|
|
common.LoadConfig()
|
|
rootCmd.AddCommand(serverCmd)
|
|
rootCmd.AddCommand(installCmd)
|
|
rootCmd.AddCommand(stopCmd)
|
|
|
|
models.Connect()
|
|
ws.StartUpdateVisitorStatusCron()
|
|
|
|
if err := rootCmd.Execute(); err != nil {
|
|
fmt.Println(err)
|
|
os.Exit(1)
|
|
}
|
|
}
|