duxin 2 лет назад
Родитель
Сommit
6f129bcdcf
1 измененных файлов с 5 добавлено и 6 удалено
  1. 5 6
      service/message_mail_box.go

+ 5 - 6
service/message_mail_box.go

@@ -135,7 +135,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							c.nickname AS name,
 							c.headimg,
 							d.content,
-							d.type 
+							d.type, 
 							d.create_time,
 							a.unread as number,
 						    a.timestamp,
@@ -146,7 +146,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							INNER JOIN base_position b ON ( a.my_position_id = %d %s  AND a.your_position_id = b.id )
 							INNER JOIN base_user c ON ( b.user_id = c.id )
 							LEFT JOIN socialize_message d ON ( a.message_id = d.id )
-							LIMIT 0,500
+							ORDER BY a.timestamp DESC LIMIT 0,500
 						)`, in.PositionId, oneNameSql)
 		}
 
@@ -168,7 +168,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							socialize_summary a
 							INNER JOIN socialize_tenant_robot b ON ( a.user_id = %d AND a.ent_id = b.ent_id %s )
 							LEFT JOIN socialize_message c ON ( a.message_id = c.id ) 
-						LIMIT 0,500
+						ORDER BY a.timestamp DESC LIMIT 0,500
 						) `, in.NewUserId, serviceNameSql)
 		//群列表
 		groupSql := fmt.Sprintf(` (
@@ -189,7 +189,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 							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 ) 
-						LIMIT 0,500
+						ORDER BY c.timestamp DESC LIMIT 0,500
 						) `, GroupNameSql, in.PositionId)
 		switch in.QueryType {
 		case 1: //分享列表
@@ -199,8 +199,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		}
 		sqlStr = fmt.Sprintf(`SELECT * FROM(
 						%s
-					) a LIMIT 0,500
-				a.ORDER BY a.timestamp DESC`, allSql)
+					) a ORDER BY a.timestamp DESC LIMIT 0,500`, allSql)
 	} else {
 		var timeSql, phoneSql, filtrationSql string
 		if in.StartTime != "" {