refactor: cmd update.

pull/2148/head
Gordon 1 year ago
parent 2ac3ff5801
commit 4c30f333f8

@ -14,44 +14,47 @@
package main
import (
"github.com/openimsdk/open-im-server/v3/pkg/common/cmd"
"github.com/openimsdk/tools/system/program"
)
func main() {
ch := make(chan int)
<-ch
//msgUtilsCmd := cmd.NewMsgUtilsCmd("openIMCmdUtils", "openIM cmd utils", nil)
//getCmd := cmd.NewGetCmd()
//fixCmd := cmd.NewFixCmd()
//clearCmd := cmd.NewClearCmd()
//seqCmd := cmd.NewSeqCmd()
//msgCmd := cmd.NewMsgCmd()
//getCmd.AddCommand(seqCmd.GetSeqCmd(), msgCmd.GetMsgCmd())
//getCmd.AddSuperGroupIDFlag()
//getCmd.AddUserIDFlag()
//getCmd.AddBeginSeqFlag()
//getCmd.AddLimitFlag()
//// openIM get seq --userID=xxx
//// openIM get seq --superGroupID=xxx
//// openIM get msg --userID=xxx --beginSeq=100 --limit=10
//// openIM get msg --superGroupID=xxx --beginSeq=100 --limit=10
//
//fixCmd.AddCommand(seqCmd.FixSeqCmd())
//fixCmd.AddSuperGroupIDFlag()
//fixCmd.AddUserIDFlag()
//fixCmd.AddFixAllFlag()
//// openIM fix seq --userID=xxx
//// openIM fix seq --superGroupID=xxx
//// openIM fix seq --fixAll
//
//clearCmd.AddCommand(msgCmd.ClearMsgCmd())
//clearCmd.AddSuperGroupIDFlag()
//clearCmd.AddUserIDFlag()
//clearCmd.AddClearAllFlag()
//clearCmd.AddBeginSeqFlag()
//clearCmd.AddLimitFlag()
//// openIM clear msg --userID=xxx --beginSeq=100 --limit=10
//// openIM clear msg --superGroupID=xxx --beginSeq=100 --limit=10
//// openIM clear msg --clearAll
//msgUtilsCmd.AddCommand(&getCmd.Command, &fixCmd.Command, &clearCmd.Command)
//if err := msgUtilsCmd.Execute(); err != nil {
// program.ExitWithError(err)
//}
msgUtilsCmd := cmd.NewMsgUtilsCmd("openIMCmdUtils", "openIM cmd utils", nil)
getCmd := cmd.NewGetCmd()
fixCmd := cmd.NewFixCmd()
clearCmd := cmd.NewClearCmd()
seqCmd := cmd.NewSeqCmd()
msgCmd := cmd.NewMsgCmd()
getCmd.AddCommand(seqCmd.GetSeqCmd(), msgCmd.GetMsgCmd())
getCmd.AddSuperGroupIDFlag()
getCmd.AddUserIDFlag()
getCmd.AddBeginSeqFlag()
getCmd.AddLimitFlag()
// openIM get seq --userID=xxx
// openIM get seq --superGroupID=xxx
// openIM get msg --userID=xxx --beginSeq=100 --limit=10
// openIM get msg --superGroupID=xxx --beginSeq=100 --limit=10
fixCmd.AddCommand(seqCmd.FixSeqCmd())
fixCmd.AddSuperGroupIDFlag()
fixCmd.AddUserIDFlag()
fixCmd.AddFixAllFlag()
// openIM fix seq --userID=xxx
// openIM fix seq --superGroupID=xxx
// openIM fix seq --fixAll
clearCmd.AddCommand(msgCmd.ClearMsgCmd())
clearCmd.AddSuperGroupIDFlag()
clearCmd.AddUserIDFlag()
clearCmd.AddClearAllFlag()
clearCmd.AddBeginSeqFlag()
clearCmd.AddLimitFlag()
// openIM clear msg --userID=xxx --beginSeq=100 --limit=10
// openIM clear msg --superGroupID=xxx --beginSeq=100 --limit=10
// openIM clear msg --clearAll
msgUtilsCmd.AddCommand(&getCmd.Command, &fixCmd.Command, &clearCmd.Command)
if err := msgUtilsCmd.Execute(); err != nil {
program.ExitWithError(err)
}
}

@ -39,8 +39,7 @@ type CronTaskConfig struct {
}
func Start(ctx context.Context, config *CronTaskConfig) error {
ch := make(chan int)
<-ch
log.CInfo(ctx, "CRON-TASK server is initializing", "chatRecordsClearTime",
config.CronTask.ChatRecordsClearTime, "msgDestructTime", config.CronTask.MsgDestructTime)

@ -55,6 +55,8 @@ func NewMsgTool(msgDatabase controller.CommonMsgDatabase, userDatabase controlle
}
func InitMsgTool(ctx context.Context, config *CronTaskConfig) (*MsgTool, error) {
ch := make(chan int)
<-ch
//mgocli, err := mongoutil.NewMongoDB(ctx, config.MongodbConfig.Build())
//if err != nil {
// return nil, err

Loading…
Cancel
Save