|
@@ -102,15 +102,18 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
)
|
|
|
data := new(message.UserMsgList)
|
|
|
if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn { //消息未读数统计
|
|
|
- var isUnread int
|
|
|
+ var isUnread, isColumn int
|
|
|
for _, v := range entity.MessageColumn {
|
|
|
- key := fmt.Sprintf(MsgCountKey, this.UserId, util.IntAll(v["group_id"]))
|
|
|
- if exists, _ := redis.Exists(redisModule, key); exists {
|
|
|
- isUnread++
|
|
|
- unread += util.Int64All(redis.GetInt(redisModule, key))
|
|
|
+ if util.IntAll(v["group_id"]) > 0 && util.IntAll(v["group_id"]) < 999 {
|
|
|
+ isColumn++ //去除全部与私信
|
|
|
+ key := fmt.Sprintf(MsgCountKey, this.UserId, util.IntAll(v["group_id"]))
|
|
|
+ if exists, _ := redis.Exists(redisModule, key); exists {
|
|
|
+ isUnread++
|
|
|
+ unread += util.Int64All(redis.GetInt(redisModule, key))
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- if isUnread != len(entity.MessageColumn) {
|
|
|
+ if isUnread != isColumn {
|
|
|
m := &MessageService{}
|
|
|
unread = m.CountUnread(this.UserId)
|
|
|
}
|
|
@@ -181,7 +184,7 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
column.MsgType = common.Int64All(v["group_id"])
|
|
|
if column.Name == "私信" {
|
|
|
column.UnreadMessages = unreadMsg(this)
|
|
|
- } else {
|
|
|
+ } else if common.IntAll(v["group_id"]) > 0 {
|
|
|
//消息未读数
|
|
|
msgType := common.InterfaceToStr(v["group_id"])
|
|
|
column.UnreadMessages = util.Int64All(redis.GetInt(redisModule, fmt.Sprintf(MsgCountKey, this.UserId, util.IntAll(msgType))))
|