Quellcode durchsuchen

fix:用户群列表获取修改

duxin vor 2 Jahren
Ursprung
Commit
8e8bfdb14f
1 geänderte Dateien mit 11 neuen und 18 gelöschten Zeilen
  1. 11 18
      service/message_mail_box.go

+ 11 - 18
service/message_mail_box.go

@@ -139,7 +139,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							"" as groupMember
 						FROM
 							socialize_summary a
-							INNER JOIN base_position b ON ( a.my_position_id = %d %s  AND a.your_position_id = b.id )
+							INNER JOIN base_position b ON ( a.my_position_id = %d %s  AND a.your_position_id = b.id AND a.chat_group_id = 0 )
 							INNER JOIN base_user c ON ( b.user_id = c.id )
 							LEFT JOIN socialize_message d ON ( a.message_id = d.id )
 							ORDER BY a.timestamp DESC LIMIT 0,500
@@ -177,24 +177,23 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							d.type,
 							d.create_time,
 							a.unread as number,
-							c.timestamp,
+							a.timestamp,
 							"" as phone,
 							b.groupMember
 						FROM
-							socialize_chat_group_person a
-							INNER JOIN %s b ON ( a.position_id = %d AND a.chat_group_id = b.id)
-							INNER JOIN socialize_summary c ON ( b.id = c.chat_group_id )
-							LEFT JOIN socialize_message d ON ( c.message_id = d.id ) 
+							socialize_summary a
+							INNER JOIN %s b ON ( a.my_position_id = %d AND a.chat_group_id > 0 AND a.chat_group_id = b.id)
+							LEFT JOIN socialize_message d ON ( a.message_id = d.id ) 
 						ORDER BY c.timestamp DESC LIMIT 0,500
 						) `, GroupNameSql, in.PositionId)
+		if oneSql != "" {
+			sqlArr = append(sqlArr, oneSql)
+		}
+		if groupSql != "" {
+			sqlArr = append(sqlArr, groupSql)
+		}
 		switch in.QueryType {
 		case 1: //分享列表
-			if oneSql != "" {
-				sqlArr = append(sqlArr, oneSql)
-			}
-			if groupSql != "" {
-				sqlArr = append(sqlArr, groupSql)
-			}
 			if len(sqlArr) > 1 {
 				allSql = strings.Join(sqlArr, " UNION ALL ")
 			} else {
@@ -202,12 +201,6 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 			}
 		default:
 			//历史会话列表
-			if oneSql != "" {
-				sqlArr = append(sqlArr, oneSql)
-			}
-			if groupSql != "" {
-				sqlArr = append(sqlArr, groupSql)
-			}
 			if serviceSql != "" {
 				sqlArr = append(sqlArr, serviceSql)
 			}