|
@@ -126,8 +126,8 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
sData := make(map[string][]*message.Messages)
|
|
sData := make(map[string][]*message.Messages)
|
|
t := time.Now()
|
|
t := time.Now()
|
|
if this.IsColumnNewMsg && this.SortSize > 0 {
|
|
if this.IsColumnNewMsg && this.SortSize > 0 {
|
|
- sortData := entity.Mysql.SelectBySql(fmt.Sprintf(`SELECT * FROM (
|
|
|
|
- SELECT *, ROW_NUMBER() OVER (PARTITION BY group_id, receive_userid ORDER BY createtime DESC) AS row_num
|
|
|
|
|
|
+ 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
|
|
FROM message
|
|
FROM message
|
|
WHERE receive_userid = '%s' and isdel = 1 and appid = %s
|
|
WHERE receive_userid = '%s' and isdel = 1 and appid = %s
|
|
) AS message_ranked
|
|
) AS message_ranked
|
|
@@ -138,20 +138,10 @@ func UserMsgList(this *message.UserMsgListReq) *message.UserMsgList {
|
|
_id := util.Int64All(v["id"])
|
|
_id := util.Int64All(v["id"])
|
|
id := strconv.FormatInt(_id, 10)
|
|
id := strconv.FormatInt(_id, 10)
|
|
var msg = message.Messages{
|
|
var msg = message.Messages{
|
|
- Id: id,
|
|
|
|
- Appid: common.InterfaceToStr(v["appId"]),
|
|
|
|
- ReceiveUserId: common.InterfaceToStr(v["receive_userid"]),
|
|
|
|
- ReceiveName: common.InterfaceToStr(v["receive_name"]),
|
|
|
|
- SendUserId: common.InterfaceToStr(v["send_userid"]),
|
|
|
|
- SendName: common.InterfaceToStr(v["send_name"]),
|
|
|
|
- Createtime: common.InterfaceToStr(v["createtime"]),
|
|
|
|
- Title: common.InterfaceToStr(v["title"]),
|
|
|
|
- MsgType: int64(util.IntAll(v["group_id"])),
|
|
|
|
- Link: common.InterfaceToStr(v["link"]),
|
|
|
|
- CiteId: util.Int64All(v["cite_id"]),
|
|
|
|
- Content: common.InterfaceToStr(v["content"]),
|
|
|
|
- IsRead: util.Int64All(v["isRead"]),
|
|
|
|
- MsgLogId: util.Int64All(v["msg_log_id"]),
|
|
|
|
|
|
+ Id: id,
|
|
|
|
+ Createtime: common.InterfaceToStr(v["createtime"]),
|
|
|
|
+ Title: common.InterfaceToStr(v["title"]),
|
|
|
|
+ MsgType: int64(util.IntAll(v["group_id"])),
|
|
}
|
|
}
|
|
if sData[common.InterfaceToStr(v["group_id"])] == nil {
|
|
if sData[common.InterfaceToStr(v["group_id"])] == nil {
|
|
sData[common.InterfaceToStr(v["group_id"])] = []*message.Messages{&msg}
|
|
sData[common.InterfaceToStr(v["group_id"])] = []*message.Messages{&msg}
|