|
@@ -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 {
|