Authored by 陈峰

commit

... ... @@ -11,7 +11,7 @@ const y100 = {
* @param next
*/
async y100List(req, res, next) {
const {actId, pageNo = 1, pageSize = 10, tag = ''} = req.query;
const {actId, pageNo = 1, pageSize = 10, tag = '', top = true} = req.query;
if (!actId) {
return res.json({
... ... @@ -25,7 +25,8 @@ const y100 = {
actId,
pageNo,
pageSize,
tag
tag,
top
});
return res.json({
... ...
... ... @@ -16,7 +16,7 @@ class Y100Model extends global.yoho.BaseModel {
* 获取Y100列表
* @returns {*}
*/
articleY100List({actId, pageNo, pageSize, tag}) {
articleY100List({actId, pageNo, pageSize, tag, top}) {
const params = {
actId,
start: (pageNo - 1) * pageSize,
... ... @@ -36,13 +36,15 @@ class Y100Model extends global.yoho.BaseModel {
if (tag) {
sql += ' and AAY.tag like :tag';
params.tag = `%${tag}%`;
sql += ' ORDER BY AA.good_count DESC';
}
if (top) {
sql += ' ORDER BY AAY.top DESC,AA.create_time DESC';
} else {
sql += ' and AAY.top = 1';
sql += ' ORDER BY AA.good_count DESC';
}
sql += ' LIMIT :start, :page';
return mysqlCli.query(sql, params);
}
... ...