sg recv opt

This commit is contained in:
wangchuxiao
2023-01-13 19:47:32 +08:00
parent 818ed107c6
commit 4bf73b0a47
3 changed files with 56 additions and 1 deletions
+20
View File
@@ -40,6 +40,9 @@ const (
sendMsgFailedFlag = "SEND_MSG_FAILED_FLAG:"
userBadgeUnreadCountSum = "USER_BADGE_UNREAD_COUNT_SUM:"
exTypeKeyLocker = "EX_LOCK:"
//temp
superGroupUserNotRecvOfflineMsgOptTemp = "SG_RECV_MSG_OPT_TEMP:"
)
func (d *DataBases) JudgeAccountEXISTS(account string) (bool, error) {
@@ -164,6 +167,23 @@ func (d *DataBases) GetSingleConversationRecvMsgOpt(userID, conversationID strin
result, err := d.RDB.HGet(context.Background(), key, conversationID).Result()
return utils.StringToInt(result), err
}
func (d *DataBases) SetSuperGroupUserNotRecvOfflineMsgOpt(groupID, userID string) error {
key := superGroupUserNotRecvOfflineMsgOptTemp + groupID
return d.RDB.SAdd(context.Background(), key, userID).Err()
}
func (d *DataBases) ReduceSuperGroupUserNotRecvOfflineMsgOpt(groupID, userID string) error {
key := superGroupUserNotRecvOfflineMsgOptTemp + groupID
return d.RDB.SRem(context.Background(), key, userID).Err()
}
func (d *DataBases) GetSuperGroupUserNotRecvOfflineMsgIDList(groupID string) ([]string, error) {
key := superGroupUserNotRecvOfflineMsgOptTemp + groupID
userIDs, _ := d.RDB.SMembers(context.Background(), key).Result()
return userIDs, nil
}
func (d *DataBases) SetUserGlobalMsgRecvOpt(userID string, opt int32) error {
key := conversationReceiveMessageOpt + userID
return d.RDB.HSet(context.Background(), key, GlobalMsgRecvOpt, opt).Err()