Explorar el Código

我的足迹排序

xingzai hace 2 años
padre
commit
80398d31e5
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      models/user.go

+ 2 - 2
models/user.go

@@ -194,9 +194,9 @@ func GetArticleUserBrowseHistoryCount(userId int, endDate string) (count int, er
 }
 
 func GetArticleUserBrowseHistoryList(startSize, pageSize, userId int, endDate string) (items []*ArticleReportBillboardResp, err error) {
-	sql := `SELECT a.* FROM cygx_article_history_record AS a
+	sql := `SELECT a.* ,	MAX( a.id ) AS mid   FROM cygx_article_history_record AS a
 			WHERE a.user_id=? AND a.create_time>=?  GROUP BY a.article_id
-           ORDER BY a.id DESC LIMIT ?,? `
+           ORDER BY mid  DESC LIMIT ?,? `
 	_, err = orm.NewOrm().Raw(sql, userId, endDate, startSize, pageSize).QueryRows(&items)
 	return
 }