Prechádzať zdrojové kódy

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

duxin 2 rokov pred
rodič
commit
49fa2f101f

+ 13 - 10
.idea/workspace.xml

@@ -4,8 +4,9 @@
     <option name="autoReloadType" value="ALL" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="f5220264-ecf0-4305-ada3-6105184077a7" name="Changes" comment="提交">
+    <list default="true" id="f5220264-ecf0-4305-ada3-6105184077a7" name="Changes" comment="群聊过滤撤回得消息">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/service/message_mail_box.go" beforeDir="false" afterPath="$PROJECT_DIR$/service/message_mail_box.go" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
@@ -180,7 +181,7 @@
       <pattern value="^\QTest_Count\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_FindMessage" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$/rpc/messagecenter/test" />
       <root_directory value="$PROJECT_DIR$" />
@@ -189,19 +190,19 @@
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTest_test1\E$" />
+      <pattern value="^\QTest_FindMessage\E$" />
       <method v="2" />
     </configuration>
-    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
+    <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
       <module name="messageCenter" />
-      <working_directory value="$PROJECT_DIR$/service" />
+      <working_directory value="$PROJECT_DIR$/rpc/messagecenter/test" />
       <root_directory value="$PROJECT_DIR$" />
       <kind value="PACKAGE" />
-      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service" />
+      <package value="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test" />
       <directory value="$PROJECT_DIR$" />
       <filePath value="$PROJECT_DIR$" />
       <framework value="gotest" />
-      <pattern value="^\QTestChatGroupService_ChatGroupAdd\E$/^\Q群组新增\E$" />
+      <pattern value="^\QTest_test1\E$" />
       <method v="2" />
     </configuration>
     <configuration name="bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" type="GoTestRunConfiguration" factoryName="Go Test" temporary="true" nameIsGenerated="true">
@@ -224,16 +225,16 @@
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count (1)" />
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" />
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" />
-      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
       <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" />
+      <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_FindMessage" />
     </list>
     <recent_temporary>
       <list>
+        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_FindMessage" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count (1)" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_test1" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_Count" />
         <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestMessaggeService_Count/未读信息总数" />
-        <item itemvalue="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/service 中的 TestChatGroupService_ChatGroupAdd/群组新增" />
       </list>
     </recent_temporary>
   </component>
@@ -276,7 +277,9 @@
     <MESSAGE value="历史聊天记录查询" />
     <MESSAGE value="未读消息修改" />
     <MESSAGE value="提交" />
-    <option name="LAST_COMMIT_MESSAGE" value="提交" />
+    <MESSAGE value="群聊过滤撤回得消息" />
+    <MESSAGE value="1v1返回用户名字" />
+    <option name="LAST_COMMIT_MESSAGE" value="1v1返回用户名字" />
   </component>
   <component name="VgoProject">
     <integration-enabled>true</integration-enabled>

+ 4 - 4
rpc/messagecenter/test/message_test.go

@@ -58,12 +58,12 @@ func Test_FindMessage(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
 	TestSystem := messagecenter.NewMessageCenter(zrpc.MustNewClient(c.TestConf))
 	req := &messagecenter.MessageReq{
-		MsgType:     3,
+		MsgType:     2,
 		UserType:    2,
-		SendId:      68826,
-		PageSize:    2,
+		SendId:      1205051297,
+		PageSize:    20,
 		EntId:       15051,
-		LastId:      330239,
+		LastId:      0,
 		NewUserId:   1205051306,
 		EntUserId:   0,
 		Sort:        "DESC",

+ 10 - 8
service/message_mail_box.go

@@ -625,7 +625,8 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 	}
 	switch in.MsgType {
 	case 2: //点对点聊天
-		sqlStr = fmt.Sprintf("SELECT  a.messag_id as messageId,a.send_user_type,a.type AS itemType,b.* ,if(a.own_id = a.send_user_id,1,2) as fool  "+
+		sqlStr = fmt.Sprintf("SELECT  a.messag_id as messageId,a.send_user_type,a.type AS itemType,b.* ,if(a.own_id = a.send_user_id,1,2) as fool,  "+
+			"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id "+
 			"FROM  %s a  "+
 			"LEFT JOIN %s b on  a.messag_id=b.id "+
 			"LEFT  JOIN  %s c on  c.id=a.send_user_id "+
@@ -647,7 +648,7 @@ 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 = 2 AND a.own_id = %d "+
+			"WHERE a.own_type = 2  and a.iswithdraw = 0 AND a.own_id = %d "+
 			"AND a.chat_group_id = %d AND a.type IN ( 3, 6 )  %s "+
 			"ORDER BY a.create_time desc,a.id DESC "+
 			"LIMIT 0, %d",
@@ -709,9 +710,10 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 		_, _, positionData := EntPerson(in.EntId, true)
 		for _, v := range *data {
 			positionId := quitl.IntAll(v["send_position_id"])
+			log.Println("________", positionData[positionId])
 			if positionId != 0 {
 				v["userName"] = positionData[positionId]
-				//log.Println(v["userName"], positionData[positionId])
+				log.Println(v["userName"], positionData[positionId])
 			}
 		}
 
@@ -726,7 +728,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 
 				updateMap = map[string]interface{}{
 					"own_type":     2,
-					"own_id":       in.NewUserId,
+					"own_id":       in.PositionId,
 					"send_user_id": in.SendId,
 					"type":         2,
 					"isread":       0,
@@ -734,7 +736,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				IC.BaseMysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, map[string]interface{}{"isread": 1, "read_time": time.Now().Local().Format(util.Date_Full_Layout)})
 				//更新socialize_summary表未读消息数量
 				updateQuery := map[string]interface{}{
-					"my_position_id":   in.NewUserId,
+					"my_position_id":   in.PositionId,
 					"your_position_id": in.SendId,
 				}
 				IC.BaseMysql.Update(util.SOCIALIZE_SUMMARY, updateQuery, map[string]interface{}{"unread": 0})
@@ -749,7 +751,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
 				//更新socialize_summary表未读消息数量
 				updateQuery := map[string]interface{}{
-					"my_position_id": in.NewUserId,
+					"my_position_id": in.PositionId,
 					"chat_group_id":  in.ChatGroupId,
 				}
 				IC.BaseMysql.Update(util.SOCIALIZE_SUMMARY, updateQuery, map[string]interface{}{"unread": 0})
@@ -763,14 +765,14 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
 						"AND a.isread = 0    "+
 						"AND a.own_id IN (SELECT id FROM %s WHERE user_id = %d)",
 						util.SOCIALIZE_MESSAGE_MAILBOX, util.BASE_POSITION, in.NewUserId)
-					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d", util.Socialize_customer_service_user, in.NewUserId)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND customer_service_id = %d", util.Socialize_customer_service_user, in.NewUserId, in.EntUserId)
 				} else { //2用户
 					sqlStr = fmt.Sprintf("UPDATE %s a  SET a.isread = 1,    a.read_time = now( )  "+
 						"WHERE    a.own_type = 2 and a.iswithdraw = 0 "+
 						"AND a.type IN ( 4,5,6,7 )  "+
 						"AND a.isread = 0    "+
 						"AND a.own_id  in (%s) ", util.SOCIALIZE_MESSAGE_MAILBOX, positionStr)
-					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d", util.SOCIALIZE_SUMMARY, in.NewUserId)
+					unreadSql = fmt.Sprintf("UPDATE %s SET unread = 0 WHERE user_id = %d AND ent_id = %d", util.SOCIALIZE_SUMMARY, in.NewUserId, in.EntId)
 				}
 				IC.BaseMysql.UpdateOrDeleteBySql(sqlStr)
 				IC.BaseMysql.UpdateOrDeleteBySql(unreadSql)