list.js
1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* @Author: Targaryen
* @Date: 2016-05-21 10:59:20
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-08 13:37:17
*/
'use strict';
const mRoot = '../models';
// list 页 model
const list = require(`${mRoot}/list`);
const headerModel = require('../../../doraemon/models/header');
exports.getProductPic = (req, res) => {
res.jsonp();
};
/**
* 商品列表页
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res) => {
let params = Object.assign({
order: 's_t_asc,s_s_asc'
}, req.query);
let channel = req.query.channel || req.cookies._Channel || 'boys';
params.uid = req.user.uid || 0;
let responseData = {
module: 'product',
page: 'sale',
footerTop: true
};
let headerData = {};
headerModel.requestHeaderData(channel).then(result => {
headerData = result.headerData;
});
list.getSaleOthersData(params, channel).then((result) => {
responseData.saleList = result;
responseData.resultShow = JSON.stringify(result, null, 4);
responseData.headerData = headerData;
res.render('sale/other', responseData);
}).catch(() => {
responseData.pageErr = true;
res.render('error', responseData);
});
};