星潮教室 outlet 读接口添加cache
Showing
2 changed files
with
29 additions
and
11 deletions
@@ -24,6 +24,8 @@ const _getResources = (page) => { | @@ -24,6 +24,8 @@ const _getResources = (page) => { | ||
24 | return serviceAPI.get('operations/api/v5/resource/get', { | 24 | return serviceAPI.get('operations/api/v5/resource/get', { |
25 | content_code: contentCode[page], | 25 | content_code: contentCode[page], |
26 | client_type: 'iphone' | 26 | client_type: 'iphone' |
27 | + }, { | ||
28 | + cache: true | ||
27 | }).then((result) => { | 29 | }).then((result) => { |
28 | if (result && result.code === 200) { | 30 | if (result && result.code === 200) { |
29 | return resourcesProcess(result.data); | 31 | return resourcesProcess(result.data); |
@@ -104,7 +106,7 @@ const _processIndexData = (dataList) => { | @@ -104,7 +106,7 @@ const _processIndexData = (dataList) => { | ||
104 | 106 | ||
105 | // 首页明星头像数据处理 | 107 | // 首页明星头像数据处理 |
106 | if (list.tags) { | 108 | if (list.tags) { |
107 | - _.forEach(list.tags, (data, index) => { | 109 | + _.forEach(list.tags, (data) => { |
108 | let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy={"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line | 110 | let url = `/guang/star/detail?tag=${data.tagName}&openby:yohobuy={"action":"go.h5","params":{"id":"","share":"","shareparam":{},"islogin":"N","type":0,"updateflag":"N","url":"http://m.yohobuy.com/guang/star/detail","param":{"tag":"${data.tagName}"}}}`; // eslint-disable-line |
109 | 111 | ||
110 | formatData.starAvatar.push({ | 112 | formatData.starAvatar.push({ |
@@ -161,6 +163,8 @@ const getIndexData = () => { | @@ -161,6 +163,8 @@ const getIndexData = () => { | ||
161 | method: 'app.starClass.index', | 163 | method: 'app.starClass.index', |
162 | code: '8adc27fcf5676f356602889afcfd2a8e', | 164 | code: '8adc27fcf5676f356602889afcfd2a8e', |
163 | client_type: 'iphone' | 165 | client_type: 'iphone' |
166 | + }, { | ||
167 | + cache: true | ||
164 | }).then((result) => { | 168 | }).then((result) => { |
165 | if (result && result.code === 200) { | 169 | if (result && result.code === 200) { |
166 | return _processIndexData(result); | 170 | return _processIndexData(result); |
@@ -182,6 +186,8 @@ const getDetailData = (params, uid) => { | @@ -182,6 +186,8 @@ const getDetailData = (params, uid) => { | ||
182 | size: 10, | 186 | size: 10, |
183 | uid: uid, | 187 | uid: uid, |
184 | client_type: 'iphone' | 188 | client_type: 'iphone' |
189 | + }, { | ||
190 | + cache: true | ||
185 | }).then((result) => { | 191 | }).then((result) => { |
186 | if (result && result.code === 200) { | 192 | if (result && result.code === 200) { |
187 | if (params.page > result.data.totalPage) { | 193 | if (params.page > result.data.totalPage) { |
@@ -230,7 +236,9 @@ const getCollocationListData = (params, uid) => { | @@ -230,7 +236,9 @@ const getCollocationListData = (params, uid) => { | ||
230 | return serviceAPI.get('guang/api/v5/article/getStarClassroomArticleList', Object.assign({ | 236 | return serviceAPI.get('guang/api/v5/article/getStarClassroomArticleList', Object.assign({ |
231 | limit: '20', | 237 | limit: '20', |
232 | uid: uid | 238 | uid: uid |
233 | - }, params)).then((result) => { | 239 | + }, params), { |
240 | + cache: true | ||
241 | + }).then((result) => { | ||
234 | if (result && result.code === 200) { | 242 | if (result && result.code === 200) { |
235 | return _processGuangData(result.data.list.artList); | 243 | return _processGuangData(result.data.list.artList); |
236 | } else { | 244 | } else { |
@@ -54,7 +54,9 @@ const _getOutletResource = (channel, contentcode) => { | @@ -54,7 +54,9 @@ const _getOutletResource = (channel, contentcode) => { | ||
54 | yh_channel: channel || '' | 54 | yh_channel: channel || '' |
55 | }; | 55 | }; |
56 | 56 | ||
57 | - return serviceApi.get('operations/api/v5/resource/home', params).then(result => { | 57 | + return serviceApi.get('operations/api/v5/resource/home', params, { |
58 | + cache: true | ||
59 | + }).then(result => { | ||
58 | if (result && result.code === 200) { | 60 | if (result && result.code === 200) { |
59 | return resourcesProcess(result.data.list); | 61 | return resourcesProcess(result.data.list); |
60 | } else { | 62 | } else { |
@@ -96,7 +98,9 @@ const _getNavData = (categoryId) => { | @@ -96,7 +98,9 @@ const _getNavData = (categoryId) => { | ||
96 | parent_id: categoryId | 98 | parent_id: categoryId |
97 | }; | 99 | }; |
98 | 100 | ||
99 | - return serviceApi.get('operations/api/v6/category/getCategory', params).then(result => { | 101 | + return serviceApi.get('operations/api/v6/category/getCategory', params, { |
102 | + cache: true | ||
103 | + }).then(result => { | ||
100 | if (result && result.code === 200) { | 104 | if (result && result.code === 200) { |
101 | let data = _convertNavData(result.data); | 105 | let data = _convertNavData(result.data); |
102 | 106 | ||
@@ -167,7 +171,9 @@ const _getActivityDetail = (id) => { | @@ -167,7 +171,9 @@ const _getActivityDetail = (id) => { | ||
167 | }; | 171 | }; |
168 | 172 | ||
169 | 173 | ||
170 | - return api.get('', params).then(res => { | 174 | + return api.get('', params, { |
175 | + cache: true | ||
176 | + }).then(res => { | ||
171 | if (res.code === 200) { | 177 | if (res.code === 200) { |
172 | return _convertActicityData(res.data); | 178 | return _convertActicityData(res.data); |
173 | } else { | 179 | } else { |
@@ -188,7 +194,9 @@ const _getHomeActivity = (data) => { | @@ -188,7 +194,9 @@ const _getHomeActivity = (data) => { | ||
188 | platform: 3 // h5平台代号 | 194 | platform: 3 // h5平台代号 |
189 | }; | 195 | }; |
190 | 196 | ||
191 | - return api.get('', _.assign(params, data)).then(res => { | 197 | + return api.get('', _.assign(params, data), { |
198 | + cache: true | ||
199 | + }).then(res => { | ||
192 | return _convertActicityData(res.data); | 200 | return _convertActicityData(res.data); |
193 | }); | 201 | }); |
194 | }; | 202 | }; |
@@ -258,7 +266,9 @@ const getActivityTime = (params) => { | @@ -258,7 +266,9 @@ const getActivityTime = (params) => { | ||
258 | return api.get('', _.assign({ | 266 | return api.get('', _.assign({ |
259 | method: 'app.outlets.activityGet', | 267 | method: 'app.outlets.activityGet', |
260 | platform: 3 // h5平台代号 | 268 | platform: 3 // h5平台代号 |
261 | - }, params)).then(res => { | 269 | + }, params), { |
270 | + cache: true | ||
271 | + }).then(res => { | ||
262 | var times = []; | 272 | var times = []; |
263 | 273 | ||
264 | if (res && res.code === 200) { | 274 | if (res && res.code === 200) { |
@@ -274,8 +284,8 @@ const getActivityTime = (params) => { | @@ -274,8 +284,8 @@ const getActivityTime = (params) => { | ||
274 | }; | 284 | }; |
275 | 285 | ||
276 | module.exports = { | 286 | module.exports = { |
277 | - getContent: getContent, | ||
278 | - getActivity: getActivity, | ||
279 | - getRecentActivity: getRecentActivity, | ||
280 | - getActivityTime: getActivityTime | 287 | + getContent, |
288 | + getActivity, | ||
289 | + getRecentActivity, | ||
290 | + getActivityTime | ||
281 | }; | 291 | }; |
-
Please register or login to post a comment