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

This commit is contained in:
wenxu12345
2022-07-26 15:52:56 +08:00
11 changed files with 531 additions and 110 deletions
+24 -18
View File
@@ -28,24 +28,30 @@ const (
///ContentType
//UserRelated
Text = 101
Picture = 102
Voice = 103
Video = 104
File = 105
AtText = 106
Merger = 107
Card = 108
Location = 109
Custom = 110
Revoke = 111
HasReadReceipt = 112
Typing = 113
Quote = 114
GroupHasReadReceipt = 116
Common = 200
GroupMsg = 201
SignalMsg = 202
Text = 101
Picture = 102
Voice = 103
Video = 104
File = 105
AtText = 106
Merger = 107
Card = 108
Location = 109
Custom = 110
Revoke = 111
HasReadReceipt = 112
Typing = 113
Quote = 114
GroupHasReadReceipt = 116
AdvancedText = 117
AdvancedRevoke = 118 //影响前者消息
CustomMsgNotTriggerConversation = 119
CustomMsgOnlineOnly = 120
Common = 200
GroupMsg = 201
SignalMsg = 202
CustomNotification = 203
//SysRelated
NotificationBegin = 1000
+11 -1
View File
@@ -33,7 +33,8 @@ const (
GlobalMsgRecvOpt = "GLOBAL_MSG_RECV_OPT"
FcmToken = "FCM_TOKEN:"
groupUserMinSeq = "GROUP_USER_MIN_SEQ:"
groupMaxSeq = "GROUP_MAX_SEQ"
groupMaxSeq = "GROUP_MAX_SEQ:"
sendMsgFailedFlag = "SEND_MSG_FAILED_FLAG:"
)
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
@@ -365,6 +366,15 @@ func (d *DataBases) GetGetuiToken() (string, error) {
result := d.RDB.Get(context.Background(), getuiToken)
return result.String(), result.Err()
}
func (d *DataBases) SetSendMsgFailedFlag(operationID string) error {
return d.RDB.Set(context.Background(), sendMsgFailedFlag+operationID, 1, time.Hour*24).Err()
}
func (d *DataBases) GetSendMsgStatus(operationID string) error {
return d.RDB.Get(context.Background(), sendMsgFailedFlag+operationID).Err()
}
func (d *DataBases) SetFcmToken(account string, platformid int, fcmToken string, expireTime int64) (err error) {
key := FcmToken + account + ":" + strconv.Itoa(platformid)
return d.RDB.Set(context.Background(), key, fcmToken, time.Duration(expireTime)*time.Second).Err()
+15 -4
View File
@@ -3,6 +3,7 @@ package rocksCache
import (
"Open_IM/pkg/common/db"
imdb "Open_IM/pkg/common/db/mysql_model/im_mysql_model"
"Open_IM/pkg/common/log"
"Open_IM/pkg/utils"
"context"
"encoding/json"
@@ -29,6 +30,7 @@ func init() {
fmt.Println("init to del old keys")
for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache,
groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} {
fName := utils.GetSelfFuncName()
var cursor uint64
var n int
for {
@@ -40,10 +42,19 @@ func init() {
}
n += len(keys)
//fmt.Printf("\n %s key found %d keys: %v, current cursor %d\n", key, n, keys, cursor)
if len(keys) > 0 {
err = db.DB.RDB.Del(context.Background(), keys...).Err()
if err != nil {
panic(err.Error())
//if len(keys) > 0 {
// err = db.DB.RDB.Del(context.Background(), keys...).Err()
// if err != nil {
// panic(err.Error())
// }
//}
for _, key := range keys {
if err = db.DB.RDB.Del(context.Background(), key).Err(); err != nil {
log.NewError("", fName, key, err.Error())
err = db.DB.RDB.Del(context.Background(), key).Err()
if err != nil {
panic(err.Error())
}
}
}
if cursor == 0 {