about.js
2.6 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
'use strict';
const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header');
const aboutModel = require('../models/about');
let responseData = {
module: 'about',
page: 'about'
};
/**
* 关于有货
*/
const yohobuy = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
headerModel.requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('yohobuy', responseData);
}).catch(next);
};
/**
* 新力传媒
*/
const newpower = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
headerModel.requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('newpower', responseData);
}).catch(next);
};
/**
* 联系我们
*/
const contact = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
headerModel.requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('contact', responseData);
}).catch(next);
};
/**
* 隐私条款
*/
const privacy = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
headerModel.requestHeaderData(channel).then(result => {
responseData.headerData = result.headerData;
res.render('privacy', responseData);
}).catch(next);
};
/**
* 友情链接
*/
const link = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
Promise.all([
headerModel.requestHeaderData(channel),
req.ctx(aboutModel).link(),
]).then(result => {
responseData.headerData = _.get(result, '[0].headerData');
res.render('link', Object.assign(_.get(result, '[1]', {}), responseData));
}).catch(next);
};
/**
* 品类大全
*/
const category = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
return Promise.all([
headerModel.requestHeaderData(channel, true),
req.ctx(aboutModel).getCategoryDataWithCache(channel)
]).then(result => {
res.render('category', Object.assign(result[1], responseData, result[0]));
}).catch(next);
};
/**
* 产品大全
*/
const chanpin = (req, res, next) => {
let channel = req.yoho.channel || 'boys';
return Promise.all([
headerModel.requestHeaderData(channel, true),
req.ctx(aboutModel).getChanpinData(channel)
]).then(result => {
res.render('chanpin', Object.assign(result[1], responseData, result[0]));
}).catch(next);
};
module.exports = {
yohobuy,
newpower,
contact,
privacy,
link,
category,
chanpin
};