detail.js
1.82 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
/**
* 商品详情controller
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/5/6
*/
'use strict';
const mRoot = '../models';
const detail = require(`${mRoot}/detail`); // 商品详情 model
const intro = require(`${mRoot}/intro`); // 商品尺码信息 model
const preference = require(`${mRoot}/preference`); // 商品偏好 model
const _ = require('lodash');
/**
* 商品基本信息
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.index = (req, res) => {
var vipLevel = 0; // 用户等级 待处理
var uid = _.isEmpty(req.user.uid) ? null : req.user.uid;
detail({
id: req.params[0],
goodsId: req.params[1],
uid: uid,
vipLevel: vipLevel,
ua: req.get('user-agent') || ''
}).then((result) => {
res.render('detail/detail', {
result: result,
module: 'product',
page: 'detail',
title: result.goodsName
});
});
};
/**
* 商品尺码信息详情
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.intro = (req, res) => {
intro({
productskn: req.params.productskn
}).then((result) => {
res.render('detail/intro', {
result: result
});
});
};
/**
* 为你优选 待处理
* @param {[type]} req [description]
* @param {[type]} res [description]
* @return {[type]} [description]
*/
exports.preference = (req, res) => {
preference({
productskn: req.params.productskn,
yhchannel: req.params.yhchannel,
brandId: req.params.brandId
}).then((result) => {
res.send(result);
// res.render('preference', {
// result: result,
// devEnv: true
// });
});
};