detail.js
1.14 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
/**
*
* @author: Aiden Xu<aiden.xu@yoho.cn>
* @date: 2016/07/19
*/
'use strict';
// const _ = require('lodash');
// const helpers = global.yoho.helpers;
const api = global.yoho.API;
const _ = require('lodash');
/**
* 商品详情
*/
const component = {
index: (req, res) => {
const pid = req.params[0], goodsId = req.params[1];
res.render('detail', {
module: 'product',
page: 'detail',
pid: pid,
goodsId: goodsId
});
},
product: (req, res, next) => {
const pid = req.params[0];// , goodsId = req.params[1];
let params = {
productId: _.toString(pid),
method: 'h5.product.data'
};
api.get('', params).then(result => {
res.json(result);
}).catch(next);
},
intro: (req, res, next) => {
let params = {
method: 'h5.product.intro',
productskn: req.query.skn,
udid: 'f528764d624db129b32c21fbca0cb8d6'
};
api.get('', params).then(result => {
res.json(result);
}).catch(next);
}
};
module.exports = component;