Browse Source

fix:私信未读消息统计修改

duxin 1 year ago
parent
commit
bfb78213a4
1 changed files with 13 additions and 2 deletions
  1. 13 2
      rpc/internal/common/sendMsg.go

+ 13 - 2
rpc/internal/common/sendMsg.go

@@ -277,11 +277,22 @@ func unreadMsg(this *message.UserMsgListReq) int64 {
 	//	"socialize_summary", "socialize_message", this.PositionId, this.NewUserId)
 	querySql := fmt.Sprintf(`SELECT
 		SUM( unread ) as unread
+	FROM (
+SELECT
+		SUM( unread ) as unread
+	FROM
+		socialize_summary
+	WHERE
+	my_position_id = %d  
+	AND unread > 0  
+	union 
+	SELECT
+		SUM( unread ) as unread
 	FROM
 		socialize_summary
 	WHERE
-		unread > 0 
-	AND ( my_position_id = %d OR user_id = %d )`, this.PositionId, this.NewUserId)
+	user_id = %d 
+	AND	unread > 0)`, this.PositionId, this.NewUserId)
 	log.Println("查询sql", querySql)
 	msgUnread := entity.BaseMysql.SelectBySql(querySql)
 	if msgUnread != nil && len(*msgUnread) > 0 {