Authored by 郭成尧

首页限时海沟即将结束数据处理

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-06-01 14:37:03
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-01 16:22:06
* @Last Modified time: 2016-06-02 10:09:02
*/
'use strict';
... ... @@ -26,11 +26,11 @@ exports.getOutletsActivityOrigin = (params) => {
return api.get('', sign.apiSign({
method: 'app.outlets.activityGet',
id: params.id || null,
// id: params.id || null,
platform: 2, // 1 没有数据,暂时用 2,待处理
size: params.size || 0,
yh_channel: 1,
type: params.type || 3 // 0 没有数据,暂时用 3
type: params.type || 2 // 0 没有数据,暂时用 3
}));
};
... ...
... ... @@ -2,13 +2,13 @@
* @Author: Targaryen
* @Date: 2016-05-30 16:20:03
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-02 09:47:12
* @Last Modified time: 2016-06-02 10:26:33
*/
'use strict';
const library = '../../../library';
const utils = '../../../utils';
const helpers = require(`${library}/helpers`);
const _ = require('lodash');
const API = require(`${library}/api`).API;
const api = new API();
... ... @@ -25,6 +25,23 @@ const productProcess = require(`${utils}/product-process`);
const handleOutletsActivityData = (origin) => {
let dest = {};
dest.name = '限时嗨购'; // 需要根据 origin 传值修改
dest.topic = [];
// 处理奥莱活动列表数据
_.forEach(origin, value => {
let activity = {};
activity.href = helpers.urlFormat('/outlets/special/detail', { id: value.id });
activity.img = value.coverUrl;
activity.logo = value.logoUrl;
activity.discount = value.promotionName;
activity.title = value.title;
activity.limit = value.productPoolId; // 不清楚什么数据 待处理
dest.topic.push(activity);
});
let nowTime = Math.round(new Date().getTime() / 1000);
dest.specialHead = {
... ... @@ -68,19 +85,25 @@ const handleOutletsBannersData = (origin) => {
*/
exports.getOutletsIndexData = (params) => {
return api.all([
outletsApi.getOutletsActivityOrigin(params),
outletsApi.getChannelResouceData({ content_code: 'e0565dad65fb8da1f39bc1ac83fc8346' })
outletsApi.getChannelResouceData({ content_code: 'e0565dad65fb8da1f39bc1ac83fc8346' }),
outletsApi.getOutletsActivityOrigin(params), // 获取限时活动列表
outletsApi.getOutletsActivityOrigin(params), // 获取即将结束列表
]).then(result => {
let finalResult = {};
// 处理奥莱活动列表数据
// 处理资源位数据
if (result[0].code === 200) {
finalResult.limitedBuy = handleOutletsActivityData(result[0].data);
finalResult = Object.assign(finalResult, handleOutletsBannersData(result[0].data));
}
// 处理资源位数据
// 处理限时嗨购列表数据
if (result[1].code === 200) {
finalResult = Object.assign(finalResult, handleOutletsBannersData(result[1].data));
finalResult.limitedBuy = handleOutletsActivityData(result[1].data);
}
// 处理即将结束列表数据
if (result[2].code === 200) {
finalResult.nearOver = handleOutletsActivityData(result[2].data);
}
return finalResult;
... ... @@ -105,8 +128,8 @@ exports.getOutletsChannelData = (params) => {
let channelData = {};
return api.all([
outletsApi.getChannelResouceData({content_code: channelCode[params.channel]}),
outletsApi.getOutletsActivityOrigin({platform: 2, size: 0, type: 1}),
outletsApi.getChannelResouceData({ content_code: channelCode[params.channel] }),
outletsApi.getOutletsActivityOrigin({ platform: 2, size: 0, type: 1 }),
saleApi.getSaleGoodsList(params)
]).then(result => {
// 资源楼层
... ... @@ -116,7 +139,7 @@ exports.getOutletsChannelData = (params) => {
// 限时嗨购
if (result[1].code === 200) {
Object.assign(channelData, {flashSale: outletsProcess.formatActivityData(result[1].data)});
Object.assign(channelData, { flashSale: outletsProcess.formatActivityData(result[1].data) });
}
// 商品列表
... ...