list.js
1.38 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-02 15:17:03
*/
'use strict';
const headerModel = require('../../../doraemon/models/header');
const mRoot = '../models';
// list 页 model
const list = require(`${mRoot}/list`);
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({
saleType: 2,
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 = {};
headerModel.requestHeaderData().then(headerData => {
responseData = headerModel.setHeaderData(headerData.data, 'vip');
responseData.module = 'product';
responseData.page = 'sale';
// responseData.footerTop = true;
responseData.devEnv = true;
list.getSaleOthersData(params, channel).then((result) => {
responseData.saleList = result;
responseData.resultShow = JSON.stringify(result, null, 4);
res.render('sale/other', responseData);
});
}).catch(() => {
res.render('error', { devEnv: true, pageErr: true });
});
};