Browse Source

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

duxin 1 năm trước cách đây
mục cha
commit
786cbbeb74
1 tập tin đã thay đổi với 17 bổ sung10 xóa
  1. 17 10
      rpc/internal/common/sendMsg.go

+ 17 - 10
rpc/internal/common/sendMsg.go

@@ -265,16 +265,23 @@ func unreadMsg(this *message.UserMsgListReq) int64 {
 	if this.PositionId <= 0 {
 		return 0
 	}
-	querySql := fmt.Sprintf("SELECT  b.*,(SELECT SUM( a.unread) FROM  %s a "+
-		"LEFT JOIN %s b ON a.message_id = b.id  "+
-		"WHERE  a.unread > 0 "+
-		"AND ( a.my_position_id = %d OR a.user_id = %d )) AS unread "+
-		"FROM %s a  "+
-		"LEFT JOIN %s b ON a.message_id = b.id  "+
-		"WHERE a.unread > 0  "+
-		"AND ( a.my_position_id = %d OR a.user_id = %d ) "+
-		"ORDER BY a.TIMESTAMP DESC LIMIT 0,1", "socialize_summary", "socialize_message", this.PositionId, this.NewUserId,
-		"socialize_summary", "socialize_message", this.PositionId, this.NewUserId)
+	//querySql := fmt.Sprintf("SELECT  b.*,(SELECT SUM( a.unread) FROM  %s a "+
+	//	"LEFT JOIN %s b ON a.message_id = b.id  "+
+	//	"WHERE  a.unread > 0 "+
+	//	"AND ( a.my_position_id = %d OR a.user_id = %d )) AS unread "+
+	//	"FROM %s a  "+
+	//	"LEFT JOIN %s b ON a.message_id = b.id  "+
+	//	"WHERE a.unread > 0  "+
+	//	"AND ( a.my_position_id = %d OR a.user_id = %d ) "+
+	//	"ORDER BY a.TIMESTAMP DESC LIMIT 0,1", "socialize_summary", "socialize_message", this.PositionId, this.NewUserId,
+	//	"socialize_summary", "socialize_message", this.PositionId, this.NewUserId)
+	querySql := fmt.Sprintf(`SELECT
+		SUM( unread ) as unread
+	FROM
+		socialize_summary
+	WHERE
+		unread > 0 
+	AND ( my_position_id = %d OR user_id = %d )`, this.PositionId, this.NewUserId)
 	log.Println("查询sql", querySql)
 	msgUnread := entity.BaseMysql.SelectBySql(querySql)
 	if msgUnread != nil && len(*msgUnread) > 0 {