Authored by 陈峰

逛作者页面soridid参数增加默认值

@@ -9,6 +9,7 @@ const mRoot = '../models'; @@ -9,6 +9,7 @@ const mRoot = '../models';
9 const indexModel = require(`${mRoot}/index`); 9 const indexModel = require(`${mRoot}/index`);
10 const headerModel = require('../../../doraemon/models/header'); // 头部model 10 const headerModel = require('../../../doraemon/models/header'); // 头部model
11 const guangProcess = require(`${global.utils}/guang-process`); 11 const guangProcess = require(`${global.utils}/guang-process`);
  12 +const stringProcess = require(`${global.utils}/string-process`);
12 const Promise = require('bluebird'); 13 const Promise = require('bluebird');
13 const channels = { 14 const channels = {
14 boys: 1, 15 boys: 1,
@@ -78,7 +79,7 @@ const _page = (req, res, next) => { @@ -78,7 +79,7 @@ const _page = (req, res, next) => {
78 79
79 /* 判断参数是否有效 */ 80 /* 判断参数是否有效 */
80 let tag = req.query.tag, 81 let tag = req.query.tag,
81 - sortId = req.query.type, 82 + sortId = req.query.type || 0,
82 page = req.query.page, 83 page = req.query.page,
83 gender = req.query.gender, 84 gender = req.query.gender,
84 authorId = req.query.authorId, 85 authorId = req.query.authorId,
@@ -89,7 +90,7 @@ const _page = (req, res, next) => { @@ -89,7 +90,7 @@ const _page = (req, res, next) => {
89 let uid = req.user.uid, 90 let uid = req.user.uid,
90 udid = req.sessionID; 91 udid = req.sessionID;
91 92
92 - if (sortId && !isNaN(sortId)) { 93 + if (!stringProcess.isNumeric(sortId)) {
93 res.json({ code: 400, message: '参数错误', data: '' }); 94 res.json({ code: 400, message: '参数错误', data: '' });
94 return; 95 return;
95 } 96 }