Authored by 李奇

app.search.newPromotion及其关联接口验证通过

... ... @@ -15,7 +15,7 @@ exports.productLst = function(req, res, next) {
let getProductList;
if (req.query.maybeLike) {
getProductList = model.maybeLikeList(Object.assign({
getProductList = req.ctx(model).maybeLikeList(Object.assign({
uid: uid,
udid: udid,
yh_channel: req.query.yh_channel || (req.cookies._Channel && channels[req.cookies._Channel]) || 1,
... ... @@ -58,7 +58,7 @@ exports.productLst = function(req, res, next) {
}
}
getProductList = model.productLst(params);
getProductList = req.ctx(model).productLst(params);
}
getProductList.then((result) => {
... ... @@ -93,7 +93,7 @@ exports.coupon = function(req, res, next) {
});
}
model.getCoupon({
req.ctx(model).getCoupon({
activity_template_id,
uid
}).then((result) => {
... ...
'use strict';
const api = global.yoho.API;
let _getProduct = function(o) {
return {
small_sort_id: o.small_sort_id,
... ... @@ -30,12 +28,16 @@ const gender = {
2: '2,3'
};
module.exports = {
productLst: function(params) {
return api.get('', Object.assign({
method: 'app.search.newPromotion'
}, params), {
cache: true
class individuationModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
productLst(params) {
return this.get({
data: Object.assign({
method: 'app.search.newPromotion'
}, params),
param: {cache: true}
}).then(res => {
var data = [],
lst = (res && res.data && res.data.product_list) || [];
... ... @@ -45,19 +47,20 @@ module.exports = {
});
return data;
});
},
maybeLikeList: function(params) {
return api.get('', {
method: 'app.home.newPreference',
uid: params.uid || 0,
udid: params.udid || 0,
yh_channel: params.yh_channel,
limit: params.limit || 60,
need_filter: 'null',
rec_pos: '100053',
gender: params.gender || gender[params.yh_channel]
}, {
cache: true
}
maybeLikeList(params) {
return this.get({
data: {
method: 'app.home.newPreference',
uid: params.uid || 0,
udid: params.udid || 0,
yh_channel: params.yh_channel,
limit: params.limit || 60,
need_filter: 'null',
rec_pos: '100053',
gender: params.gender || gender[params.yh_channel]
},
param: {cache: true}
}).then(res => {
var data = [],
lst = (res && res.data && res.data.product_list) || [];
... ... @@ -67,12 +70,16 @@ module.exports = {
});
return data;
});
},
getCoupon: function(params) {
return api.get('', Object.assign({
method: 'app.coupons.personalCoupons'
}, params), {
cache: true
}
getCoupon(params) {
return this.get({
data: Object.assign({
method: 'app.coupons.personalCoupons'
}, params),
param: {cache: true}
});
}
};
}
module.exports = individuationModel;
... ...