|
@@ -3,7 +3,6 @@ package service
|
|
|
import (
|
|
|
quitl "app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- "app.yhyue.com/moapp/jybase/redis"
|
|
|
util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
|
|
|
"bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
"database/sql"
|
|
@@ -563,21 +562,8 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
|
|
|
func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string]interface{} {
|
|
|
sqlStr := ""
|
|
|
lastStr := ""
|
|
|
- lastRedisKey := fmt.Sprintf("lastRedisKey_%d_%d_%d_%d", in.UserType, in.LastId, in.SendId, in.NewUserId)
|
|
|
if in.LastId > 0 {
|
|
|
if in.Sort == "asc" {
|
|
|
- //判断缓存是否有数据或 已有查询
|
|
|
- if ok, _ := redis.Exists("msgCount", lastRedisKey); ok {
|
|
|
- data := redis.Get("msgCount", lastRedisKey)
|
|
|
- if data != nil {
|
|
|
- vle, _ := data.([]interface{})
|
|
|
- log.Println("存在存储消息 直接返回", len(vle))
|
|
|
- d := quitl.ObjArrToMapArr(vle)
|
|
|
- return &d
|
|
|
- }
|
|
|
- return nil
|
|
|
- }
|
|
|
- redis.Put("msgCount", lastRedisKey, nil, 10)
|
|
|
lastStr = fmt.Sprintf("AND a.messag_id > %d ", in.LastId)
|
|
|
} else {
|
|
|
lastStr = fmt.Sprintf("AND a.messag_id < %d ", in.LastId)
|
|
@@ -593,7 +579,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
"where a.own_id= %d and a.iswithdraw = 0"+
|
|
|
"AND ((a.send_user_id= %d AND a.receive_user_id= %d) or (a.send_user_id= %d AND a.receive_user_id= %d)) "+
|
|
|
"AND a.type=2 %s "+
|
|
|
- "ORDER BY a.create_time desc ,a.id asc "+
|
|
|
+ "ORDER BY a.create_time ,a.id desc "+
|
|
|
"limit 0 , %d ",
|
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
|
|
|
in.NewUserId, in.NewUserId, in.SendId, in.SendId, in.NewUserId, lastStr, in.PageSize)
|
|
@@ -609,7 +595,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
"AND (a.type = 5 or a.type=4 or a.type=6 or a.type=7 or a.type=8 ) "+
|
|
|
"AND c.ent_id = %d "+
|
|
|
"AND c.user_id = %d %s "+
|
|
|
- "ORDER BY a.create_time desc ,a.id asc "+
|
|
|
+ "ORDER BY a.create_time ,a.id desc "+
|
|
|
"limit 0 , %d ",
|
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION,
|
|
|
in.EntId, in.SendId, lastStr, in.PageSize)
|
|
@@ -626,7 +612,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
"AND c.ent_id = %d "+
|
|
|
"AND c.user_id = %d "+
|
|
|
"AND ( a.type = 4 OR a.type = 5 or a.type=6 or a.type=7 or a.type=8) %s "+
|
|
|
- "ORDER BY a.create_time desc ,a.id asc "+
|
|
|
+ "ORDER BY a.create_time ,a.id desc "+
|
|
|
"limit 0 , %d ",
|
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, in.SendId, in.NewUserId, util.SOCIALIZE_TENANT_ROBOT, util.SOCIALIZE_APPRAISE,
|
|
|
in.NewUserId, in.SendId, in.NewUserId, lastStr, in.PageSize)
|
|
@@ -683,11 +669,6 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
b.Count(in.NewUserId, in.UserType, in.EntUserId, true)
|
|
|
}
|
|
|
}()
|
|
|
- if in.LastId > 0 && in.Sort == "asc" {
|
|
|
- if data != nil && len(*data) > 0 {
|
|
|
- redis.Put("msgCount", lastRedisKey, *data, 10)
|
|
|
- }
|
|
|
- }
|
|
|
return data
|
|
|
}
|
|
|
|