...
|
...
|
@@ -10,6 +10,11 @@ const _ = require('lodash'); |
|
|
const model = require('../models/detail');
|
|
|
const searchModel = require('../models/search');
|
|
|
|
|
|
const GENDER = {
|
|
|
1: '1,3',
|
|
|
2: '2,3'
|
|
|
};
|
|
|
|
|
|
// 频道映射
|
|
|
const CHANNEL_MAP = {
|
|
|
men: 1,
|
...
|
...
|
@@ -229,26 +234,42 @@ const component = { |
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 为你优选
|
|
|
* 猜你喜欢
|
|
|
* @param req
|
|
|
* @param res
|
|
|
* @param next
|
|
|
*/
|
|
|
prefer: (req, res, next) => {
|
|
|
let udid = req.sessionID;
|
|
|
let channel = req.query.channel || req.cookies._Channel || 'men';
|
|
|
let params = {
|
|
|
udid,
|
|
|
mightLike: (req, res, next) => {
|
|
|
const uid = req.user.uid;
|
|
|
|
|
|
if (!uid) {
|
|
|
return res.json({
|
|
|
code: 200,
|
|
|
data: []
|
|
|
});
|
|
|
}
|
|
|
|
|
|
const channel = req.query.channel || req.cookies._Channel || 'men';
|
|
|
const params = {
|
|
|
uid: req.user.uid,
|
|
|
page: req.query.page || 1,
|
|
|
limit: 20,
|
|
|
gender: GENDER[CHANNEL_MAP[channel]],
|
|
|
udid: req.sessionID ,
|
|
|
rec_pos: req.query.rec_pos || 100001,
|
|
|
yh_channel: CHANNEL_MAP[channel] || 1,
|
|
|
limit: 30,
|
|
|
page: 1,
|
|
|
rec_pos: 100003
|
|
|
client_id: req.cookies._yasvd || '1'
|
|
|
};
|
|
|
|
|
|
model.preferList(params)
|
|
|
.then((list) => {
|
|
|
res.json(list);
|
|
|
}).catch(next);
|
|
|
model.mightLike(params).then(result => {
|
|
|
if (result && result.code === 200) {
|
|
|
res.json({
|
|
|
code: 200,
|
|
|
data: result.data.product_list || [],
|
|
|
message: result.message
|
|
|
});
|
|
|
}
|
|
|
}).catch(next);
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|