|
@@ -20,6 +20,15 @@ const log = require(`${library}/logger`); |
|
@@ -20,6 +20,15 @@ const log = require(`${library}/logger`); |
20
|
const serviceApi = new ServiceAPI();
|
20
|
const serviceApi = new ServiceAPI();
|
21
|
const api = new API();
|
21
|
const api = new API();
|
22
|
|
22
|
|
|
|
23
|
+const dateFormate = (str) =>{
|
|
|
24
|
+ var time = new Date(str * 1000);
|
|
|
25
|
+ var y = time.getFullYear();
|
|
|
26
|
+ var m = time.getMonth()+1;
|
|
|
27
|
+ var d = time.getDate();
|
|
|
28
|
+ var h = time.getHours();
|
|
|
29
|
+
|
|
|
30
|
+ return y + '年' + m + '月' + d + '日' + h + '时';
|
|
|
31
|
+}
|
23
|
|
32
|
|
24
|
const getOutletResource = (channel, contentcode) => {
|
33
|
const getOutletResource = (channel, contentcode) => {
|
25
|
const params = {
|
34
|
const params = {
|
|
@@ -73,26 +82,6 @@ const getNavData = (categoryId) => { |
|
@@ -73,26 +82,6 @@ const getNavData = (categoryId) => { |
73
|
});
|
82
|
});
|
74
|
};
|
83
|
};
|
75
|
|
84
|
|
76
|
-const getActivityDetail = (id) => {
|
|
|
77
|
- var params = {
|
|
|
78
|
- method: 'app.outlets.activityGet',
|
|
|
79
|
- sort: 2,
|
|
|
80
|
- platform: 3,
|
|
|
81
|
- yh_channel: 1,
|
|
|
82
|
- id: id,
|
|
|
83
|
- type: 0
|
|
|
84
|
- };
|
|
|
85
|
-
|
|
|
86
|
- return api.get('', sign.apiSign(params)).then(res => {
|
|
|
87
|
- if (res.code === 200) {
|
|
|
88
|
- return res.data;
|
|
|
89
|
- } else {
|
|
|
90
|
- log.error('获取奥莱活动详情页接口返回状态码 不是 200', res);
|
|
|
91
|
- return {};
|
|
|
92
|
- }
|
|
|
93
|
- });
|
|
|
94
|
-};
|
|
|
95
|
-
|
|
|
96
|
const convertActicityData = (data) => {
|
85
|
const convertActicityData = (data) => {
|
97
|
const formatData = [];
|
86
|
const formatData = [];
|
98
|
|
87
|
|
|
@@ -118,7 +107,7 @@ const convertActicityData = (data) => { |
|
@@ -118,7 +107,7 @@ const convertActicityData = (data) => { |
118
|
title: item.title,
|
107
|
title: item.title,
|
119
|
discountNum: discountNum,
|
108
|
discountNum: discountNum,
|
120
|
discountText: discountText,
|
109
|
discountText: discountText,
|
121
|
- leftTime: item.startLeftTime > 0 ? item.startLeftTime : item.endLeftTime,
|
110
|
+ leftTime: item.startLeftTime > 0 ? dateFormate(item.startTime) : item.endLeftTime,
|
122
|
hide: false
|
111
|
hide: false
|
123
|
});
|
112
|
});
|
124
|
});
|
113
|
});
|
|
@@ -126,6 +115,26 @@ const convertActicityData = (data) => { |
|
@@ -126,6 +115,26 @@ const convertActicityData = (data) => { |
126
|
return formatData;
|
115
|
return formatData;
|
127
|
};
|
116
|
};
|
128
|
|
117
|
|
|
|
118
|
+const getActivityDetail = (id) => {
|
|
|
119
|
+ var params = {
|
|
|
120
|
+ method: 'app.outlets.activityGet',
|
|
|
121
|
+ sort: 2,
|
|
|
122
|
+ platform: 3,
|
|
|
123
|
+ yh_channel: 1,
|
|
|
124
|
+ id: id,
|
|
|
125
|
+ type: 0
|
|
|
126
|
+ };
|
|
|
127
|
+
|
|
|
128
|
+ return api.get('', sign.apiSign(params)).then(res => {
|
|
|
129
|
+ if (res.code === 200) {
|
|
|
130
|
+ return convertActicityData(res.data);
|
|
|
131
|
+ } else {
|
|
|
132
|
+ log.error('获取奥莱活动详情页接口返回状态码 不是 200', res);
|
|
|
133
|
+ return {};
|
|
|
134
|
+ }
|
|
|
135
|
+ });
|
|
|
136
|
+};
|
|
|
137
|
+
|
129
|
const getHomeActivity = (data) => {
|
138
|
const getHomeActivity = (data) => {
|
130
|
var params = {
|
139
|
var params = {
|
131
|
method: 'app.outlets.activityGet',
|
140
|
method: 'app.outlets.activityGet',
|
|
@@ -158,9 +167,8 @@ exports.getContent = (categoryId, channel, code) => { |
|
@@ -158,9 +167,8 @@ exports.getContent = (categoryId, channel, code) => { |
158
|
|
167
|
|
159
|
exports.getActivity = (id) => {
|
168
|
exports.getActivity = (id) => {
|
160
|
return getActivityDetail(id).then(res => {
|
169
|
return getActivityDetail(id).then(res => {
|
161
|
-
|
|
|
162
|
return {
|
170
|
return {
|
163
|
- outletActivity: res,
|
171
|
+ activity: res,
|
164
|
productPool: res[0] && res[0].productPoolId || '',
|
172
|
productPool: res[0] && res[0].productPoolId || '',
|
165
|
activityTitle: res[0] && res[0].title || 'OUTLET',
|
173
|
activityTitle: res[0] && res[0].title || 'OUTLET',
|
166
|
saleType: 4
|
174
|
saleType: 4
|