Jelajahi Sumber

更新未读消息

renjiaojiao 2 tahun lalu
induk
melakukan
43c62a21fd
2 mengubah file dengan 8 tambahan dan 9 penghapusan
  1. 3 4
      .idea/workspace.xml
  2. 5 5
      service/message_mail_box.go

+ 3 - 4
.idea/workspace.xml

@@ -6,9 +6,7 @@
   <component name="ChangeListManager">
     <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/init/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/rpc/messagecenter/init/init.go" 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/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" />
@@ -89,7 +87,7 @@
       <recent name="D:\workspace\top_project\SocialPlatform\messageCenter\api" />
     </key>
   </component>
-  <component name="RunManager" selected="Go 测试.bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/test 中的 Test_FindMessage">
+  <component name="RunManager" selected="Go 构建.messageRpc">
     <configuration default="true" type="GoApplicationRunConfiguration" factoryName="Go Application">
       <module name="messageCenter" />
       <working_directory value="$PROJECT_DIR$" />
@@ -280,7 +278,8 @@
     <MESSAGE value="未读消息修改" />
     <MESSAGE value="提交" />
     <MESSAGE value="群聊过滤撤回得消息" />
-    <option name="LAST_COMMIT_MESSAGE" value="群聊过滤撤回得消息" />
+    <MESSAGE value="1v1返回用户名字" />
+    <option name="LAST_COMMIT_MESSAGE" value="1v1返回用户名字" />
   </component>
   <component name="VgoProject">
     <integration-enabled>true</integration-enabled>

+ 5 - 5
service/message_mail_box.go

@@ -728,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,
@@ -736,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})
@@ -751,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})
@@ -765,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)