فهرست منبع

Merge branch 'dev/v1.2.6_rjj' of SocialPlatform/messageCenter into feature/v1.2.6

duxin 2 سال پیش
والد
کامیت
f1435fea6e

+ 1 - 1
.idea/workspace.xml

@@ -10,7 +10,6 @@
       <change beforePath="$PROJECT_DIR$/go.sum" beforeDir="false" afterPath="$PROJECT_DIR$/go.sum" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/access.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/access.log" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/rpc/messagecenter/logs/error.log" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/logs/error.log" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/rpc/messagecenter/test/message_test.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/test/message_test.go" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/service/message_mail_box.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/message_mail_box.go" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -275,6 +274,7 @@
     <MESSAGE value="查看消息修改未读消息数量" />
     <MESSAGE value="未读消息数量sql修改" />
     <MESSAGE value="未读sql修改" />
+    <MESSAGE value="历史聊天记录查询" />
     <MESSAGE value="提交" />
     <option name="LAST_COMMIT_MESSAGE" value="提交" />
   </component>

+ 1 - 1
api/messagecenter/internal/logic/findmessagelogic.go

@@ -37,7 +37,7 @@ func (l *FindMessageLogic) FindMessage(req *types.MessageReq) (*types.CommonRes,
 		EntUserId:   req.EntUserId,
 		NewUserId:   req.NewUserId,
 		Sort:        req.Sort,
-		ChatGroupId: req.ChatGroupId,
+		ChatGroupId: quitl.Int64All(encrypt.SE.Decode4Hex(req.ChatGroupId)),
 		PositionId:  req.PositionId,
 	})
 	if err != nil {

+ 1 - 1
api/messagecenter/internal/types/types.go

@@ -57,7 +57,7 @@ type MessageReq struct {
 	EntUserId   int64  `header:"entUserId,optional"`
 	EntId       int64  `header:"entId,optional"`
 	Sort        string `json:"sort,optional"`
-	ChatGroupId int64  `json:"chatGroupId,optional"`
+	ChatGroupId string `json:"chatGroupId,optional"`
 	PositionId  int64  `header:"positionId,optional"`
 }
 

+ 1 - 1
api/messagecenter/messagecenter.api

@@ -52,7 +52,7 @@ type MessageReq {
 	EntUserId   int64  `header:"entUserId,optional"`
 	EntId       int64  `header:"entId,optional"`
 	Sort        string `json:"sort,optional"`
-	ChatGroupId int64  `json:"chatGroupId,optional"`
+	ChatGroupId string `json:"chatGroupId,optional"`
 	PositionId  int64  `header:"positionId,optional"`
 }
 

+ 38 - 38
rpc/messagecenter/messagecenter.proto

@@ -22,18 +22,18 @@ message UserReq {
   int64     userType = 5;  //用户类型:2用户1客服
   int64     entUserId = 6;  //客服id
   int64     page = 7;  //页
-  int64     size =8; //数
-  int64     isArtificial =9; //是否人工介入 1:人工介入 2:非让人工介入
+  int64     size = 8; //数
+  int64     isArtificial = 9; //是否人工介入 1:人工介入 2:非让人工介入
   string    filtrationId = 10; //客服列表过滤会话中派对中用户
   int64  entId = 11;
   int64  queryType = 12;
-  string  nameSearch =13;
+  string  nameSearch = 13;
   int64     positionId = 14;  //用户职位id
 }
 message UserResp {
-   repeated UserEntity data=1;
-   int64 error_code = 2; //响应代码
-   string error_msg = 3; //响应消息
+  repeated UserEntity data = 1;
+  int64 error_code = 2; //响应代码
+  string error_msg = 3; //响应消息
   int64 count = 4; //响应代码
 }
 message UserEntity {
@@ -45,10 +45,10 @@ message UserEntity {
   string content = 6;
   int64 userType = 7;
 
-  int64 create_time= 8;
-  int64 number= 9;
-  string headimg=11;
-  bool isOnline=12;
+  int64 create_time = 8;
+  int64 number = 9;
+  string headimg = 11;
+  bool isOnline = 12;
   repeated string groupMember = 13;
 }
 message MessageReq {
@@ -84,22 +84,22 @@ message MessageEntity {
   string        link = 5;
   int64         create_time = 6;
 
-  string        appid=7;
-  int64         itemType=8;
-  int64         sendId=9;
-  int64         entUserId=10;
-  int64         newUserId=16;
-  int64         own_type =11;//拥有者类型;1:用户 2:会话
-  int64         fool=12;
-  string        robotName=13;
-  string        robotImg=14;
-  string        setName=15;
-  int64         receiveId=17;
-  string        ownImg=18;
-  string        messageId=19;
-  int64         appraise=20;
-  repeated int64        groupIds =21;//群聊id [群组id]
-  repeated int64        receiverIds =22;//群聊接收人id [接收人为职位id]
+  string        appid = 7;
+  int64         itemType = 8;
+  int64         sendId = 9;
+  int64         entUserId = 10;
+  int64         newUserId = 16;
+  int64         own_type = 11;//拥有者类型;1:用户 2:会话
+  int64         fool = 12;
+  string        robotName = 13;
+  string        robotImg = 14;
+  string        setName = 15;
+  int64         receiveId = 17;
+  string        ownImg = 18;
+  string        messageId = 19;
+  int64         appraise = 20;
+  repeated int64        groupIds = 21;//群聊id [群组id]
+  repeated int64        receiverIds = 22;//群聊接收人id [接收人为职位id]
 }
 
 message ChatSessionReq {
@@ -135,16 +135,16 @@ message ReadStateReq {
 message ReadWithdrawReq {
   string        messageId = 1; //消息id
   int64         senderId = 2;//发送人id
-  string        appid=3;
+  string        appid = 3;
   int64         recipientId = 4;//接收人id
-  int64         userType=5;      //用户与客服聊天 发送人类型区分 用户类型:2用户1客服
-  int64         conversationType =6;//会话类型 1:一对一用户聊天 2 用户与客服 3 一对群
-  int64         entId =7;
-  int64         chatGroupId =8;//群id
+  int64         userType = 5;      //用户与客服聊天 发送人类型区分 用户类型:2用户1客服
+  int64         conversationType = 6;//会话类型 1:一对一用户聊天 2 用户与客服 3 一对群
+  int64         entId = 7;
+  int64         chatGroupId = 8;//群id
 }
 
 message AppraiseReq {
-  string        appid=1;
+  string        appid = 1;
   string        messageId = 2;
   int64         newUserId = 3;
   int64         appraise = 4;
@@ -157,7 +157,7 @@ message CurrencyResp {
 message ConversationReq {
   int64     entId = 1;
   int64     newUserId = 2;  //用户标识
-  int64     userType=3;  //用户类型:2用户1客服
+  int64     userType = 3;  //用户类型:2用户1客服
   int64     entUserId = 4;  //企业标识
   string    filtrationId = 5; //客服列表过滤会话中派对中用户
 }
@@ -167,12 +167,12 @@ message MessageSaveReq {
   string        content = 2; //内容
   int64         type = 3; //类型; 1:聊天 2:系统消息
   string        appid = 4;
-  repeated int64        groupIds =5;//群聊id [群组id]
-  repeated int64        receiverIds =6;//群聊接收人id [接收人为职位id]
-  int64  sendId =7; //发送人[发送人职位id]
+  repeated int64        groupIds = 5;//群聊id [群组id]
+  repeated int64        receiverIds = 6;//群聊接收人id [接收人为职位id]
+  int64  sendId = 7; //发送人[发送人职位id]
   int64 item = 8; //1-活动优惠 2-服务通知 3-订阅消息 4-项目动态 5-企业动态 6-分析报告 7-系统通知 8-聊天消息
-  int64 messageType =9;//1:文本 2:链接 3:图片 4:附件
-  string link =10; //链接
+  int64 messageType = 9;//1:文本 2:链接 3:图片 4:附件
+  string link = 10; //链接
 }
 
 message CommonReq {

+ 7 - 7
service/message_mail_box.go

@@ -686,11 +686,11 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id,"+
 			"a.send_user_type,a.type AS itemType FROM %s a "+
 			"LEFT JOIN %s b ON a.messag_id = b.id "+
-			"WHERE a.own_type = 1 AND a.own_id = %d "+
-			"AND chat_group_id = %d AND a.type IN ( 3, 6 ) "+
+			"WHERE a.own_type = 2 AND a.own_id = %d "+
+			"AND a.chat_group_id = %d AND a.type IN ( 3, 6 ) "+
 			"ORDER BY a.create_time desc,a.id DESC "+
 			"LIMIT 0, %d",
-			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.SendId,
+			util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.PositionId,
 			in.ChatGroupId, in.PageSize)
 	case 4, 5, 6, 7: //客服聊天
 		//查询用户所有的职位id
@@ -714,18 +714,18 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 			sqlStr = fmt.Sprintf("SELECT a.messag_id as messageId,e.appraise as appraise, b.*,   IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool ,   a.send_user_type,   a.type as  itemType,   d.nickname as  robotName,   d.headimage as  robotImg,   c.customer_service_name as  setName   "+
 				"FROM   %s a   "+
 				"LEFT JOIN %s b ON a.messag_id = b.id   "+
-				"LEFT JOIN %s c ON   IF  ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = c.id AND  c.ent_id = %d AND c.user_id = %d "+
+				"LEFT JOIN %s c ON   IF  ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = c.id  AND c.user_id in (%s) "+
 				"LEFT JOIN  %s d on  c.ent_id=d.ent_id  "+
 				"LEFT JOIN  %s e on  b.id=e.messag_id  "+
 				"WHERE   a.own_type = 2    "+
 				"AND a.own_id in  (%s) "+
-				"AND  c.ent_id = %d "+
+				//"AND  c.ent_id = %d "+
 				"AND c.user_id in  (%s) "+
 				"AND ( a.type = 4 OR a.type = 5 or a.type=6 or  a.type=7)  %s "+
 				"ORDER BY a.create_time desc ,a.id   asc "+
 				"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, positionStr, in.SendId, positionStr, lastStr, in.PageSize)
+				util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.SOCIALIZE_CHAT_SESSION, positionStr, util.SOCIALIZE_TENANT_ROBOT,
+				util.SOCIALIZE_APPRAISE, positionStr, positionStr, lastStr, in.PageSize)
 		}
 		break
 	}