...
|
...
|
@@ -20,6 +20,15 @@ const log = require(`${library}/logger`); |
|
|
const serviceApi = new ServiceAPI();
|
|
|
const api = new API();
|
|
|
|
|
|
const dateFormate = (str) =>{
|
|
|
var time = new Date(str * 1000);
|
|
|
var y = time.getFullYear();
|
|
|
var m = time.getMonth()+1;
|
|
|
var d = time.getDate();
|
|
|
var h = time.getHours();
|
|
|
|
|
|
return y + '年' + m + '月' + d + '日' + h + '时';
|
|
|
}
|
|
|
|
|
|
const getOutletResource = (channel, contentcode) => {
|
|
|
const params = {
|
...
|
...
|
@@ -73,26 +82,6 @@ const getNavData = (categoryId) => { |
|
|
});
|
|
|
};
|
|
|
|
|
|
const getActivityDetail = (id) => {
|
|
|
var params = {
|
|
|
method: 'app.outlets.activityGet',
|
|
|
sort: 2,
|
|
|
platform: 3,
|
|
|
yh_channel: 1,
|
|
|
id: id,
|
|
|
type: 0
|
|
|
};
|
|
|
|
|
|
return api.get('', sign.apiSign(params)).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
return res.data;
|
|
|
} else {
|
|
|
log.error('获取奥莱活动详情页接口返回状态码 不是 200', res);
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const convertActicityData = (data) => {
|
|
|
const formatData = [];
|
|
|
|
...
|
...
|
@@ -118,7 +107,7 @@ const convertActicityData = (data) => { |
|
|
title: item.title,
|
|
|
discountNum: discountNum,
|
|
|
discountText: discountText,
|
|
|
leftTime: item.startLeftTime > 0 ? item.startLeftTime : item.endLeftTime,
|
|
|
leftTime: item.startLeftTime > 0 ? dateFormate(item.startTime) : item.endLeftTime,
|
|
|
hide: false
|
|
|
});
|
|
|
});
|
...
|
...
|
@@ -126,6 +115,26 @@ const convertActicityData = (data) => { |
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
const getActivityDetail = (id) => {
|
|
|
var params = {
|
|
|
method: 'app.outlets.activityGet',
|
|
|
sort: 2,
|
|
|
platform: 3,
|
|
|
yh_channel: 1,
|
|
|
id: id,
|
|
|
type: 0
|
|
|
};
|
|
|
|
|
|
return api.get('', sign.apiSign(params)).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
return convertActicityData(res.data);
|
|
|
} else {
|
|
|
log.error('获取奥莱活动详情页接口返回状态码 不是 200', res);
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
const getHomeActivity = (data) => {
|
|
|
var params = {
|
|
|
method: 'app.outlets.activityGet',
|
...
|
...
|
@@ -158,9 +167,8 @@ exports.getContent = (categoryId, channel, code) => { |
|
|
|
|
|
exports.getActivity = (id) => {
|
|
|
return getActivityDetail(id).then(res => {
|
|
|
|
|
|
return {
|
|
|
outletActivity: res,
|
|
|
activity: res,
|
|
|
productPool: res[0] && res[0].productPoolId || '',
|
|
|
activityTitle: res[0] && res[0].title || 'OUTLET',
|
|
|
saleType: 4
|
...
|
...
|
|