Merge remote-tracking branch 'origin/v2.3.0release' into v2.3.0release

This commit is contained in:
skiffer-git
2022-08-10 13:29:34 +08:00
14 changed files with 238 additions and 136 deletions
+11 -10
View File
@@ -92,16 +92,17 @@ type config struct {
DBMaxLifeTime int `yaml:"dbMaxLifeTime"`
}
Mongo struct {
DBUri string `yaml:"dbUri"`
DBAddress string `yaml:"dbAddress"`
DBDirect bool `yaml:"dbDirect"`
DBTimeout int `yaml:"dbTimeout"`
DBDatabase string `yaml:"dbDatabase"`
DBSource string `yaml:"dbSource"`
DBUserName string `yaml:"dbUserName"`
DBPassword string `yaml:"dbPassword"`
DBMaxPoolSize int `yaml:"dbMaxPoolSize"`
DBRetainChatRecords int `yaml:"dbRetainChatRecords"`
DBUri string `yaml:"dbUri"`
DBAddress string `yaml:"dbAddress"`
DBDirect bool `yaml:"dbDirect"`
DBTimeout int `yaml:"dbTimeout"`
DBDatabase string `yaml:"dbDatabase"`
DBSource string `yaml:"dbSource"`
DBUserName string `yaml:"dbUserName"`
DBPassword string `yaml:"dbPassword"`
DBMaxPoolSize int `yaml:"dbMaxPoolSize"`
DBRetainChatRecords int `yaml:"dbRetainChatRecords"`
ChatRecordsClearTime string `yaml:"chatRecordsClearTime"`
}
Redis struct {
DBAddress []string `yaml:"dbAddress"`
-6
View File
@@ -227,12 +227,6 @@ const (
WorkMomentAtUserNotification = 2
)
const (
// diffusionType
WriteDiffusion = 0
ReadDiffusion = 1
)
const (
AtAllString = "AtAllTag"
AtNormal = 0
+10 -2
View File
@@ -360,10 +360,18 @@ func (d *DataBases) DelUserSignalList(userID string) error {
func (d *DataBases) DelMsgFromCache(uid string, seqList []uint32, operationID string) {
for _, seq := range seqList {
key := messageCache + uid + "_" + strconv.Itoa(int(seq))
result := d.RDB.Get(context.Background(), key).String()
result, err := d.RDB.Get(context.Background(), key).Result()
if err != nil {
if err == go_redis.Nil {
log2.NewDebug(operationID, utils.GetSelfFuncName(), err.Error(), "redis nil")
} else {
log2.NewError(operationID, utils.GetSelfFuncName(), err.Error(), key)
}
continue
}
var msg pbCommon.MsgData
if err := utils.String2Pb(result, &msg); err != nil {
log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, err.Error())
log2.Error(operationID, utils.GetSelfFuncName(), "String2Pb failed", msg, result, key, err.Error())
continue
}
msg.Status = constant.MsgDeleted
@@ -184,3 +184,11 @@ func GetAllGroupIDList() ([]string, error) {
err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Pluck("group_id", &groupIDList).Error
return groupIDList, err
}
func GetGroupIDListByGroupType(groupType int) ([]string, error) {
var groupIDList []string
if err := db.DB.MysqlDB.DefaultGormDB().Table("groups").Where("group_type = ? ", groupType).Pluck("group_id", &groupIDList).Error; err != nil {
return nil, err
}
return groupIDList, nil
}