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