brand-list.js
2.01 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* blk品牌品类
* @author: xiaoru.zhang
* @date: 2017/02/07
*/
'use strict';
const mRoot = '../models';
const brandModel = require(`${mRoot}/brand-list`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
let channels = {
boys: 1,
girls: 2,
lifestyle: 4
};
const index = (req, res, next) => {
let categoryTab = req.query.tab || '';
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1;
let brandCode;
let isCate = categoryTab === 'category' ? true : false;
let appType = req.query.app_type || 1;
if (parseInt(gender, 10) === 1) {
brandCode = '7317a4701a1d3ddc8d93a5df77a63b75';
} else {
brandCode = '84313c4b293a1c0aea985aa16a42a6b5';
}
brandModel.indexData(gender, brandCode, req.yoho.channel, appType).then(result => {
res.render('brand/brand', {
module: 'guang',
page: 'brand-list',
width750: true,
pageHeader: headerModel.setNav({
navTitle: ''
}),
localCss: true,
categoryTab: isCate,
channel: result.channel ? result.channel : '',
brandList: result.brandList,
list: result.list ? result.list : '',
category: {
nav: result.categoryData.nav,
list: result.categoryData.list
}
});
}).catch(next);
};
const brandList = (req, res, next) => {
let code;
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1;
if (parseInt(gender, 10) === 1) {
code = '7317a4701a1d3ddc8d93a5df77a63b75';
} else {
code = '84313c4b293a1c0aea985aa16a42a6b5';
}
brandModel.brandListData(code, gender).then(result => {
res.render('brand/brand-list', {
layout: false,
localCss: true,
brandList: result.brandList
});
}).catch(next);
};
module.exports = {
index,
brandList
};