recommend-for-you.js
1.44 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
'use strict';
const mRoot = '../models';
const recommendForYouModel = require(`${mRoot}/recommend-for-you`); // 领取优惠券 model
const _ = require('lodash');
exports.userCenter = (req, res, next) => {
var udid = 'wap',
uid = _.isEmpty(req.user.uid) ? null : req.user.uid,
yhChannel = req.query.yh_channel || '1',
limit = 30;
recommendForYouModel.getPreference({
yh_channel: yhChannel,
udid: udid,
limit: limit,
rec_pos: '100004',
uid: uid
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
}
res.render('recommend-for-you/index', {
result: preferenceData,
module: 'product',
page: 'recommend'
});
}).catch(next);
};
exports.cart = (req, res, next) => {
var udid = 'wap',
uid = _.isEmpty(req.user.uid) ? null : req.user.uid,
yhChannel = req.query.yh_channel || '1',
limit = 30;
recommendForYouModel.getPreference({
yh_channel: yhChannel,
udid: udid,
limit: limit,
rec_pos: '100003',
uid: uid
}).then((preferenceData) => {
if (preferenceData.code === 200) {
// 获取信息成功
}
res.render('recommend-for-you/index', {
result: preferenceData,
module: 'product',
page: 'recommend'
});
}).catch(next);
};