index.js
1.61 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
/**
* guang controller
* @author: lcy<chuanyang.liu@yoho.cn>
* @date: 2016/08/31
*/
'use strict';
// const _ = require('lodash');
const channelModel = require('../models/index');
// const HeaderModel = require('../../../doraemon/models/header');
exports.index = (req, res, next) => {
let channel = req.yoho.channel;
let page = req.query.page || 1;
let limit = req.query.limit || 20;
let type = req.query.type || 0;
let pathNav = channelModel.getIndexNav(channel);
Promise.all([
channelModel.getBanner(),
channelModel.getCategory(),
channelModel.getList(),
// page
channelModel.getHotTags(),
channelModel.getAds(),
channelModel.getExcellectRecos()
]).then(ret => {
res.render('index', {
guang: {
slider: ret[0],
msgTypes: ret[1],
msgs: ret[2],
hotTags: ret[6],
ads: ret[3],
exRecos: ret[5],
msgPager: null,
guangIndexPage: true,
limit: limit,
type: type,
pathNav: pathNav,
page: page
}
});
}).catch(next);
/* return res.render('index', {
pageName: 'guang-index',
world: {
aaa: 'AAA'
}
});*/
};
exports.detail = (req, res) => {
return res.render('detail', {
detailId: req.params.id
});
};
exports.tags = (req, res) => {
return res.render('index', {
});
};
exports.editor = (req, res) => {
return res.render('index', {
});
};