...
|
...
|
@@ -7,8 +7,6 @@ |
|
|
|
|
|
'use strict';
|
|
|
|
|
|
const serviceApi = global.yoho.ServiceAPI;
|
|
|
const api = global.yoho.API;
|
|
|
const _ = require('lodash');
|
|
|
const config = global.yoho.config;
|
|
|
|
...
|
...
|
@@ -30,86 +28,101 @@ const yhChannel = { |
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取奥莱活动列表接口
|
|
|
* @param {[int]} id 活动id 为空表示查询全部活动
|
|
|
* @param {[int ]} platform 活动平台 1--WEB,2--APP,3--WAP,4--IPAD
|
|
|
* @param {[int]} size 查询数量,默认查询全部
|
|
|
* @param {[int]} channel 频道: 1 || 2 || 3 || 4
|
|
|
* @param {[int]} type
|
|
|
* @return {[type]} 0 活动列表,1 限时嗨购 2 即将结束 3.即将上线
|
|
|
*/
|
|
|
exports.getOutletsActivityOrigin = (params) => {
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
/**
|
|
|
* 获取奥莱活动列表接口
|
|
|
* @param {[int]} id 活动id 为空表示查询全部活动
|
|
|
* @param {[int ]} platform 活动平台 1--WEB,2--APP,3--WAP,4--IPAD
|
|
|
* @param {[int]} size 查询数量,默认查询全部
|
|
|
* @param {[int]} channel 频道: 1 || 2 || 3 || 4
|
|
|
* @param {[int]} type
|
|
|
* @return {[type]} 0 活动列表,1 限时嗨购 2 即将结束 3.即将上线
|
|
|
*/
|
|
|
getOutletsActivityOrigin(params) {
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.outlets.activityGet',
|
|
|
id: params.id || null,
|
|
|
platform: params.platform || 1,
|
|
|
size: params.size || 0,
|
|
|
yh_channel: yhChannel[tempChannel].channel,
|
|
|
type: params.type || 0
|
|
|
}, config.apiCache);
|
|
|
};
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
|
|
|
/**
|
|
|
* 获取奥莱频道资源位数据
|
|
|
* @param {[object]} params
|
|
|
* @return {[type]}
|
|
|
*/
|
|
|
exports.getChannelResouceData = (params) => {
|
|
|
return serviceApi.get('operations/api/v5/resource/home', params, config.apiCache);
|
|
|
};
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.outlets.activityGet',
|
|
|
id: params.id || null,
|
|
|
platform: params.platform || 1,
|
|
|
size: params.size || 0,
|
|
|
yh_channel: yhChannel[tempChannel].channel,
|
|
|
type: params.type || 0
|
|
|
}, params: {cache: config.apiCache}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取奥莱潮品速递商品数据
|
|
|
* @param {[type]} params [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
exports.getOutletsTrendData = (params) => {
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
/**
|
|
|
* 获取奥莱频道资源位数据
|
|
|
* @param {[object]} params
|
|
|
* @return {[type]}
|
|
|
*/
|
|
|
getChannelResouceData(params) {
|
|
|
return this.get({
|
|
|
url: 'operations/api/v5/resource/home',
|
|
|
data: params,
|
|
|
params: {cache: config.apiCache},
|
|
|
api: global.yoho.ServiceAPI
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.search.trend',
|
|
|
yh_channel: yhChannel[tempChannel].channel,
|
|
|
order: params.order || 's_s_desc,s_n_desc',
|
|
|
gender: params.gender || '1,3',
|
|
|
stocknumber: 1, // 过滤出库存 > 1的商品
|
|
|
limit: params.limit || 5,
|
|
|
outlets: params.outlets || 1 // 默认取奥莱商品
|
|
|
}, config.apiCache);
|
|
|
};
|
|
|
/**
|
|
|
* 获取奥莱潮品速递商品数据
|
|
|
* @param {[type]} params [description]
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
getOutletsTrendData(params) {
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.search.trend',
|
|
|
yh_channel: yhChannel[tempChannel].channel,
|
|
|
order: params.order || 's_s_desc,s_n_desc',
|
|
|
gender: params.gender || '1,3',
|
|
|
stocknumber: 1, // 过滤出库存 > 1的商品
|
|
|
limit: params.limit || 5,
|
|
|
outlets: params.outlets || 1 // 默认取奥莱商品
|
|
|
}, params: {cache: config.apiCache}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取奥莱商品列表 promise 对象
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
exports.getOutletsGoodsList = (params) => {
|
|
|
// 频道
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
/**
|
|
|
* 获取奥莱商品列表 promise 对象
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
getOutletsGoodsList(params) {
|
|
|
// 频道
|
|
|
let tempChannel = params.channel || 'boys';
|
|
|
|
|
|
// 接口可接收的参数
|
|
|
let apiParams = ['outlets', 'page', 'limit', 'order', 'productSize', 'yh_channel', 'query',
|
|
|
'p_d', 'gender', 'msort', 'misort', 'sort', 'brand', 'color', 'size', 'saleType',
|
|
|
'breakSize', 'breakSort', 'productPool', 'price', 'method'];
|
|
|
// 接口可接收的参数
|
|
|
let apiParams = ['outlets', 'page', 'limit', 'order', 'productSize', 'yh_channel', 'query',
|
|
|
'p_d', 'gender', 'msort', 'misort', 'sort', 'brand', 'color', 'size', 'saleType',
|
|
|
'breakSize', 'breakSort', 'productPool', 'price', 'method'];
|
|
|
|
|
|
// 初始化必填的接口参数
|
|
|
let tempParams = {
|
|
|
method: 'app.search.li',
|
|
|
outlets: 1,
|
|
|
page: params.page || 1,
|
|
|
limit: params.limit || 60,
|
|
|
order: params.order || 's_t_desc',
|
|
|
productSize: '384x511',
|
|
|
yh_channel: yhChannel[tempChannel].channel
|
|
|
};
|
|
|
// 初始化必填的接口参数
|
|
|
let tempParams = {
|
|
|
method: 'app.search.li',
|
|
|
outlets: 1,
|
|
|
page: params.page || 1,
|
|
|
limit: params.limit || 60,
|
|
|
order: params.order || 's_t_desc',
|
|
|
productSize: '384x511',
|
|
|
yh_channel: yhChannel[tempChannel].channel
|
|
|
};
|
|
|
|
|
|
_.forEach(apiParams, (paramsName) => {
|
|
|
if (params[paramsName]) {
|
|
|
tempParams[paramsName] = params[paramsName];
|
|
|
}
|
|
|
});
|
|
|
return api.get('', tempParams, config.apiCache);
|
|
|
_.forEach(apiParams, (paramsName) => {
|
|
|
if (params[paramsName]) {
|
|
|
tempParams[paramsName] = params[paramsName];
|
|
|
}
|
|
|
});
|
|
|
return this.get({data: tempParams, params: {cache: config.apiCache}});
|
|
|
}
|
|
|
}; |
...
|
...
|
|