Forráskód Böngészése

fix:列表sql修改

duxin 2 éve
szülő
commit
9b8661460b
1 módosított fájl, 6 hozzáadás és 3 törlés
  1. 6 3
      service/message_mail_box.go

+ 6 - 3
service/message_mail_box.go

@@ -92,7 +92,8 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 	if in.UserType == 2 {
 		//用户最后一次信息查询
 		userSql := fmt.Sprintf("SELECT  MAX( c.id )   as messageId  FROM  socialize_message_mailbox c "+
-			"WHERE  c.own_id = %d   "+
+			"WHERE  c.own_id = %d  "+
+			"AND c.iswithdraw = 0  "+
 			"AND c.type = 2   "+
 			"AND c.own_type = 2 "+
 			"GROUP BY  (  CASE  WHEN c.send_user_id > c.receive_user_id "+
@@ -106,6 +107,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		customerSql := fmt.Sprintf("SELECT   MAX( c.id )   as messageId  FROM   %s c "+
 			"LEFT JOIN %s d ON  IF   ( c.send_user_type = 1, d.id = c.send_user_id, d.id = c.receive_user_id ) "+
 			"WHERE   c.own_id = %d  "+
+			"AND c.iswithdraw = 0 "+
 			"AND ( c.type = 4 OR c.type = 5  or c.type=6 or  c.type=7 ) "+
 			"AND c.own_type = 2 "+
 			"AND   d.user_id=c.own_id "+
@@ -121,7 +123,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 			"AND h.own_id = %d  "+
 			"AND h.own_type = 2  "+
 			"AND   h.send_user_id=b.id   "+
-			"AND h.isread = 0  ) AS number  FROM  %s a "+
+			"AND h.isread = 0 AND h.iswithdraw = 0  ) AS number  FROM  %s a "+
 			"LEFT JOIN  %s b ON  b.id = a.receive_user_id or  b.id = a.send_user_id  "+
 			"LEFT JOIN  %s e ON e.id = a.messag_id  "+
 			"WHERE a.id IN ( %s )  AND b.id != %d "+
@@ -177,7 +179,8 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		userSql := fmt.Sprintf("SELECT   MAX( c.id ) as messageId   FROM  %s c   "+
 			"LEFT JOIN %s d ON   c.own_type=1 AND  c.own_id=d.id   "+
 			"LEFT JOIN %s b ON if (c.send_user_type=1 ,c.receive_user_id,c.send_user_id)=b.id  "+
-			"WHERE   c.own_type = 1    "+
+			"WHERE   c.own_type = 1  "+
+			"AND c.iswithdraw = 0 "+
 			"AND (%s)   "+
 			"AND ( c.type = 4 OR c.type = 5 or  c.type=6 or  c.type=7 )   "+
 			"  %s %s %s "+