|
@@ -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 "+
|
|
@@ -114,14 +116,14 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
|
customerMessageId := util.Inhandle(data)
|
|
|
//用户的列表
|
|
|
sqlStr = fmt.Sprintf("SELECT "+
|
|
|
- "( CASE WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) WHEN b.nickname = '' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname END )"+
|
|
|
+ "( CASE WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) WHEN b.nickname = '' or b.nickname is null THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname END )"+
|
|
|
"AS name, b.id, e.title, b.headimg, e.type, e.link, e.content, 2 AS userType, a.create_time, a.type AS itemType, "+
|
|
|
"( SELECT count( h.id ) FROM %s h "+
|
|
|
"WHERE h.type = 2 "+
|
|
|
"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 "+
|
|
@@ -199,14 +202,15 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
|
customerMessageId := util.Inhandle(&d)
|
|
|
//客服的用户列表
|
|
|
sqlStr = fmt.Sprintf("SELECT "+
|
|
|
- "( CASE WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) WHEN b.nickname = '' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname END )"+
|
|
|
+ "( CASE WHEN SUBSTR( b.nickname, 1, 3 ) = 'JY_' THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) WHEN b.nickname = '' or b.nickname is null THEN CONCAT( SUBSTR( b.phone, 1, 3 ), '****', SUBSTR( b.phone, 8, 11 ) ) ELSE b.nickname END )"+
|
|
|
" AS name, b.id, e.title, b.headimg, e.type, e.link, e.content, a.create_time, "+
|
|
|
"( SELECT count( h.id ) FROM %s h "+
|
|
|
"LEFT JOIN %s i ON h.own_type = 1 AND h.own_id = i.id "+
|
|
|
"WHERE h.own_type = 1 "+
|
|
|
"AND i.ent_id=f.ent_id "+
|
|
|
"AND i.user_id=f.user_id "+
|
|
|
- "AND h.isread = 0 "+
|
|
|
+ "AND h.isread = 0 "+
|
|
|
+ "AND h.iswithdraw = 0 "+
|
|
|
"AND i.customer_service_id= %d) AS number "+
|
|
|
"FROM %s a "+
|
|
|
"LEFT JOIN %s b ON if (a.send_user_type=1 ,a.receive_user_id,a.send_user_id)=b.id "+
|