Authored by 陈峰

commit

@@ -11,7 +11,7 @@ const y100 = { @@ -11,7 +11,7 @@ const y100 = {
11 * @param next 11 * @param next
12 */ 12 */
13 async y100List(req, res, next) { 13 async y100List(req, res, next) {
14 - const {actId, pageNo = 1, pageSize = 10, tag = ''} = req.query; 14 + const {actId, pageNo = 1, pageSize = 10, tag = '', top = true} = req.query;
15 15
16 if (!actId) { 16 if (!actId) {
17 return res.json({ 17 return res.json({
@@ -25,7 +25,8 @@ const y100 = { @@ -25,7 +25,8 @@ const y100 = {
25 actId, 25 actId,
26 pageNo, 26 pageNo,
27 pageSize, 27 pageSize,
28 - tag 28 + tag,
  29 + top
29 }); 30 });
30 31
31 return res.json({ 32 return res.json({
@@ -16,7 +16,7 @@ class Y100Model extends global.yoho.BaseModel { @@ -16,7 +16,7 @@ class Y100Model extends global.yoho.BaseModel {
16 * 获取Y100列表 16 * 获取Y100列表
17 * @returns {*} 17 * @returns {*}
18 */ 18 */
19 - articleY100List({actId, pageNo, pageSize, tag}) { 19 + articleY100List({actId, pageNo, pageSize, tag, top}) {
20 const params = { 20 const params = {
21 actId, 21 actId,
22 start: (pageNo - 1) * pageSize, 22 start: (pageNo - 1) * pageSize,
@@ -36,13 +36,15 @@ class Y100Model extends global.yoho.BaseModel { @@ -36,13 +36,15 @@ class Y100Model extends global.yoho.BaseModel {
36 if (tag) { 36 if (tag) {
37 sql += ' and AAY.tag like :tag'; 37 sql += ' and AAY.tag like :tag';
38 params.tag = `%${tag}%`; 38 params.tag = `%${tag}%`;
39 - sql += ' ORDER BY AA.good_count DESC'; 39 +
  40 + }
  41 + if (top) {
  42 + sql += ' ORDER BY AAY.top DESC,AA.create_time DESC';
40 } else { 43 } else {
41 - sql += ' and AAY.top = 1'; 44 + sql += ' ORDER BY AA.good_count DESC';
42 } 45 }
43 sql += ' LIMIT :start, :page'; 46 sql += ' LIMIT :start, :page';
44 47
45 -  
46 return mysqlCli.query(sql, params); 48 return mysqlCli.query(sql, params);
47 } 49 }
48 50