This commit is contained in:
wangchuxiao
2023-02-23 19:15:30 +08:00
parent 9c76722c90
commit f586ab1ac2
205 changed files with 1216 additions and 1377 deletions
+10 -10
View File
@@ -1,12 +1,12 @@
package task
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/tracelog"
"Open_IM/pkg/utils"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/common/db/controller"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"github.com/go-redis/redis/v8"
@@ -36,9 +36,9 @@ func (c *msgTool) ClearAll() {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
// working group msg clear
workingGroupIDList, err := c.groupInterface.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
superGroupIDList, err := c.groupInterface.GetGroupIDsByGroupType(ctx, constant.WorkingGroup)
if err == nil {
c.ClearSuperGroupMsg(ctx, workingGroupIDList)
c.ClearSuperGroupMsg(ctx, superGroupIDList)
} else {
log.NewError(operationID, utils.GetSelfFuncName(), err.Error())
}
@@ -60,8 +60,8 @@ func (c *msgTool) ClearUsersMsg(ctx context.Context, userIDList []string) {
}
}
func (c *msgTool) ClearSuperGroupMsg(ctx context.Context, workingGroupIDList []string) {
for _, groupID := range workingGroupIDList {
func (c *msgTool) ClearSuperGroupMsg(ctx context.Context, superGroupIDList []string) {
for _, groupID := range superGroupIDList {
userIDs, err := c.groupInterface.FindGroupMemberUserID(ctx, groupID)
if err != nil {
log.NewError(tracelog.GetOperationID(ctx), utils.GetSelfFuncName(), "FindGroupMemberUserID", err.Error(), groupID)
+2 -2
View File
@@ -1,8 +1,8 @@
package task
import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/proto/sdkws"
"OpenIM/pkg/common/constant"
"OpenIM/pkg/proto/sdkws"
"context"
"fmt"
"strconv"
+7 -7
View File
@@ -1,10 +1,10 @@
package task
import (
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/log"
"Open_IM/pkg/common/tracelog"
"Open_IM/pkg/utils"
"OpenIM/pkg/common/config"
"OpenIM/pkg/common/log"
"OpenIM/pkg/common/tracelog"
"OpenIM/pkg/utils"
"context"
"fmt"
"time"
@@ -36,7 +36,7 @@ func StartCronTask() error {
}
}
func FixSeq(userID, workingGroupID string, fixAllSeq bool) {
func FixSeq(userID, superGroupID string, fixAllSeq bool) {
log.NewPrivateLog(moduleName)
log.NewInfo(utils.OperationIDGenerator(), "start cron task", "cron config", config.Config.Mongo.ChatRecordsClearTime)
clearCronTask := msgTool{}
@@ -46,8 +46,8 @@ func FixSeq(userID, workingGroupID string, fixAllSeq bool) {
if userID != "" {
clearCronTask.ClearUsersMsg(ctx, []string{userID})
}
if workingGroupID != "" {
clearCronTask.ClearSuperGroupMsg(ctx, []string{workingGroupID})
if superGroupID != "" {
clearCronTask.ClearSuperGroupMsg(ctx, []string{superGroupID})
}
if fixAllSeq {
clearCronTask.FixAllSeq(ctx)