...
|
...
|
@@ -8,6 +8,7 @@ |
|
|
const mRoot = '../models';
|
|
|
const indexModel = require(`${mRoot}/index`);
|
|
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
|
|
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
|
|
|
const guangProcess = require(`${global.utils}/guang-process`);
|
|
|
const stringProcess = require(`${global.utils}/string-process`);
|
|
|
const Promise = require('bluebird');
|
...
|
...
|
@@ -76,7 +77,11 @@ const editor = (req, res, next) => { |
|
|
const pageData = (req, res, next) => {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!req.xhr) {
|
|
|
res.json({ code: 400, message: '非法请求', data: '' });
|
|
|
res.json({
|
|
|
code: 400,
|
|
|
message: '非法请求',
|
|
|
data: ''
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -94,11 +99,19 @@ const pageData = (req, res, next) => { |
|
|
udid = req.sessionID;
|
|
|
|
|
|
if (!stringProcess.isNumeric(sortId)) {
|
|
|
res.json({ code: 400, message: '参数错误', data: '' });
|
|
|
res.json({
|
|
|
code: 400,
|
|
|
message: '参数错误',
|
|
|
data: ''
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (!page && !isNaN(page)) {
|
|
|
res.json({ code: 400, message: '参数错误', data: '' });
|
|
|
res.json({
|
|
|
code: 400,
|
|
|
message: '参数错误',
|
|
|
data: ''
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (!authorId && isNaN(authorId)) {
|
...
|
...
|
@@ -106,9 +119,15 @@ const pageData = (req, res, next) => { |
|
|
}
|
|
|
return indexModel.getPageData(gender, sortId, uid, udid, page, tag, authorId, isApp, showAuthor, isTab).then(data => {
|
|
|
if (data) {
|
|
|
res.render('index/page', Object.assign(data, { layout: false }));
|
|
|
res.render('index/page', Object.assign(data, {
|
|
|
layout: false
|
|
|
}));
|
|
|
} else {
|
|
|
res.json({ code: 400, message: '', data: '' });
|
|
|
res.json({
|
|
|
code: 400,
|
|
|
message: '',
|
|
|
data: ''
|
|
|
});
|
|
|
}
|
|
|
}).catch(next);
|
|
|
|
...
|
...
|
@@ -121,25 +140,17 @@ const pageData = (req, res, next) => { |
|
|
* @param next
|
|
|
*/
|
|
|
const index = (req, res, next) => {
|
|
|
let headerData = headerModel.setNav({
|
|
|
navTitle: '逛'
|
|
|
});
|
|
|
|
|
|
let responseData = {
|
|
|
pageHeader: headerData,
|
|
|
module: 'guang',
|
|
|
page: 'index',
|
|
|
title: '逛 | Yoho!Buy有货 | 潮流购物逛不停',
|
|
|
pageFooter: true
|
|
|
title: req.yoho.isWechat ? '逛' : '逛 | Yoho!Buy有货 | 潮流购物逛不停',
|
|
|
showFooterTab: footerModel.getUrlData('guang')
|
|
|
};
|
|
|
|
|
|
let param = {
|
|
|
uid: req.user.uid,
|
|
|
|
|
|
udid: req.user.udid,
|
|
|
|
|
|
type: req.query.type || '0',
|
|
|
|
|
|
gender: req.query.gender || '1,3'
|
|
|
};
|
|
|
|
...
|
...
|
@@ -165,7 +176,7 @@ const tag = (req, res, next) => { |
|
|
pageHeader: headerData,
|
|
|
module: 'guang',
|
|
|
page: 'index-editor',
|
|
|
title: tagTitle + ' | Yoho!Buy有货 | 潮流购物逛不停'
|
|
|
title: req.yoho.isWechat ? tagTitle : tagTitle + ' | Yoho!Buy有货 | 潮流购物逛不停'
|
|
|
};
|
|
|
|
|
|
let param = {
|
...
|
...
|
|