|
@@ -97,7 +97,7 @@ func FindUserMsg(this message.FindUserMsgReq, isClean bool) message.FindUserMsgR
|
|
return data
|
|
return data
|
|
}
|
|
}
|
|
|
|
|
|
-func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
|
|
|
+/*func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
var (
|
|
var (
|
|
unread, count int64
|
|
unread, count int64
|
|
)
|
|
)
|
|
@@ -262,7 +262,7 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
|
|
|
data.Unread = unread
|
|
data.Unread = unread
|
|
return data
|
|
return data
|
|
-}
|
|
|
|
|
|
+}*/
|
|
|
|
|
|
func unreadMsg(this *message.UserMsgListReq) int64 {
|
|
func unreadMsg(this *message.UserMsgListReq) int64 {
|
|
if this.PositionId <= 0 {
|
|
if this.PositionId <= 0 {
|
|
@@ -285,59 +285,6 @@ func unreadMsg(this *message.UserMsgListReq) int64 {
|
|
}
|
|
}
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
-func UserUnreadMsgList(this *message.UserUnreadMsgListReq) (int64, []*message.Messages) {
|
|
|
|
- count := 0
|
|
|
|
- data := []*message.Messages{}
|
|
|
|
- types := entity.Mysql.Find("message_group", map[string]interface{}{}, `"group_id"`, "", -1, -1)
|
|
|
|
- if types != nil && len(*types) > 0 {
|
|
|
|
- for _, v := range *types {
|
|
|
|
- key := fmt.Sprintf(MsgCountKey, this.UserId, util.IntAll(v["group_id"]))
|
|
|
|
- if exists, _ := redis.Exists(redisModule, key); exists {
|
|
|
|
- count += redis.GetInt(redisModule, key)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if this.IsNeedData == 1 && count > 0 {
|
|
|
|
- query := map[string]interface{}{
|
|
|
|
- "receive_userid": this.UserId,
|
|
|
|
- "isdel": 1,
|
|
|
|
- "appid": this.Appid,
|
|
|
|
- "isRead": 0,
|
|
|
|
- }
|
|
|
|
- res := entity.Mysql.Find("message", query, "", "createtime desc", (int(this.OffSet)-1)*int(this.PageSize), int(this.PageSize))
|
|
|
|
- if res != nil && len(*res) > 0 {
|
|
|
|
- for _, val := range *res {
|
|
|
|
- _id := util.Int64All(val["id"])
|
|
|
|
- id := strconv.FormatInt(_id, 10)
|
|
|
|
- links4 := common.InterfaceToStr(val["link"])
|
|
|
|
- link4, androidUrl4, iosUrl4, weChatUrl4 := util.LinkSplit(links4)
|
|
|
|
- url := map[string]string{
|
|
|
|
- "androidUrl": androidUrl4,
|
|
|
|
- "iosUrl": iosUrl4,
|
|
|
|
- "weChatUrl": weChatUrl4,
|
|
|
|
- }
|
|
|
|
- data = append(data, &message.Messages{
|
|
|
|
- Id: id,
|
|
|
|
- Appid: common.InterfaceToStr(val["appid"]),
|
|
|
|
- ReceiveUserId: common.InterfaceToStr(val["receive_userid"]),
|
|
|
|
- ReceiveName: common.InterfaceToStr(val["receive_name"]),
|
|
|
|
- SendUserId: common.InterfaceToStr(val["send_userid"]),
|
|
|
|
- SendName: common.InterfaceToStr(val["send_name"]),
|
|
|
|
- Createtime: common.InterfaceToStr(val["createtime"]),
|
|
|
|
- Title: common.InterfaceToStr(val["title"]),
|
|
|
|
- MsgType: common.Int64All(val["group_id"]),
|
|
|
|
- Link: link4,
|
|
|
|
- CiteId: common.Int64All(val["cite_id"]),
|
|
|
|
- Content: common.InterfaceToStr(val["content"]),
|
|
|
|
- IsRead: common.Int64All(val["isRead"]),
|
|
|
|
- MsgLogId: common.Int64All(val["msg_log_id"]),
|
|
|
|
- Url: url,
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return util.Int64All(count), data
|
|
|
|
-}
|
|
|
|
|
|
|
|
func MessageGetLast(this *message.UserMsgListReq) *message.Messages {
|
|
func MessageGetLast(this *message.UserMsgListReq) *message.Messages {
|
|
if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn {
|
|
if !this.IsMsgList && !this.IsColumnNewMsg && !this.IsColumn {
|