|
@@ -133,12 +133,13 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
if this.IsColumnNewMsg && this.SortSize > 0 {
|
|
|
var sortData *[]map[string]interface{}
|
|
|
if this.IsClassSearch { // p436 增加
|
|
|
- sortData = entity.Mysql.SelectBySql(fmt.Sprintf(`SELECT title,createtime,msg_type as group_id ,id FROM (
|
|
|
+ sortDataQ := fmt.Sprintf(`SELECT title,createtime,msg_type as group_id ,id FROM (
|
|
|
SELECT title,createtime,msg_type,id, ROW_NUMBER() OVER (PARTITION BY msg_type, receive_userid ORDER BY createtime DESC) AS row_num
|
|
|
FROM message
|
|
|
- WHERE receive_userid = '%s' and isdel = 1 and appid = %s and nd group_id=%d
|
|
|
+ WHERE receive_userid = '%s' and isdel = 1 and appid = %s and group_id=%d
|
|
|
) AS message_ranked
|
|
|
- WHERE row_num <=%d;`, this.UserId, this.Appid, this.MsgType, this.SortSize))
|
|
|
+ WHERE row_num <=%d;`, this.UserId, this.Appid, this.MsgType, this.SortSize)
|
|
|
+ sortData = entity.Mysql.SelectBySql(sortDataQ)
|
|
|
} else {
|
|
|
sortData = entity.Mysql.SelectBySql(fmt.Sprintf(`SELECT title,createtime,group_id,id FROM (
|
|
|
SELECT title,createtime,group_id,id, ROW_NUMBER() OVER (PARTITION BY group_id, receive_userid ORDER BY createtime DESC) AS row_num
|
|
@@ -170,17 +171,17 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
|
var columnData []*message.AllSortData
|
|
|
if this.IsColumn && this.MsgType > 0 && this.IsClassSearch {
|
|
|
// p436 处理消息细分分类要返回的数据
|
|
|
- // 类别
|
|
|
- // todo 获取所有分类未读数 不初始化
|
|
|
- sortUnread, _ := m.CountUnread(this.UserId, false)
|
|
|
+ // 获取小分类下的未读数
|
|
|
+ sortUnread, _ := m.CountClassUnread(this.UserId, this.MsgType)
|
|
|
columnMap := entity.ClassSearchMap[this.MsgType]
|
|
|
- for k, v := range columnMap {
|
|
|
+ for i := 0; i < len(columnMap); i++ {
|
|
|
+ tmp := columnMap[i]
|
|
|
var column message.AllSortData
|
|
|
- column.Name = v.Name
|
|
|
- column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", v.Img)
|
|
|
- column.MsgType = k
|
|
|
- // todo 消息未读数
|
|
|
- msgType := common.InterfaceToStr(k)
|
|
|
+ column.Name = tmp.Name
|
|
|
+ column.Img = fmt.Sprintf("/common-module/msgCenter/%s.png", tmp.Img)
|
|
|
+ column.MsgType = tmp.MsgType
|
|
|
+ // 消息未读数
|
|
|
+ msgType := common.InterfaceToStr(tmp.MsgType)
|
|
|
column.UnreadMessages = sortUnread[msgType]
|
|
|
unread += sortUnread[msgType]
|
|
|
column.Data = sData[msgType]
|