Authored by 王水玲

星潮教室 outlet 读接口添加cache

... ... @@ -24,6 +24,8 @@ const _getResources = (page) => {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode[page],
client_type: 'iphone'
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return resourcesProcess(result.data);
... ... @@ -104,7 +106,7 @@ const _processIndexData = (dataList) => {
// 首页明星头像数据处理
if (list.tags) {
_.forEach(list.tags, (data, index) => {
_.forEach(list.tags, (data) => {
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
formatData.starAvatar.push({
... ... @@ -161,6 +163,8 @@ const getIndexData = () => {
method: 'app.starClass.index',
code: '8adc27fcf5676f356602889afcfd2a8e',
client_type: 'iphone'
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return _processIndexData(result);
... ... @@ -182,6 +186,8 @@ const getDetailData = (params, uid) => {
size: 10,
uid: uid,
client_type: 'iphone'
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
if (params.page > result.data.totalPage) {
... ... @@ -230,7 +236,9 @@ const getCollocationListData = (params, uid) => {
return serviceAPI.get('guang/api/v5/article/getStarClassroomArticleList', Object.assign({
limit: '20',
uid: uid
}, params)).then((result) => {
}, params), {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return _processGuangData(result.data.list.artList);
} else {
... ...
... ... @@ -54,7 +54,9 @@ const _getOutletResource = (channel, contentcode) => {
yh_channel: channel || ''
};
return serviceApi.get('operations/api/v5/resource/home', params).then(result => {
return serviceApi.get('operations/api/v5/resource/home', params, {
cache: true
}).then(result => {
if (result && result.code === 200) {
return resourcesProcess(result.data.list);
} else {
... ... @@ -96,7 +98,9 @@ const _getNavData = (categoryId) => {
parent_id: categoryId
};
return serviceApi.get('operations/api/v6/category/getCategory', params).then(result => {
return serviceApi.get('operations/api/v6/category/getCategory', params, {
cache: true
}).then(result => {
if (result && result.code === 200) {
let data = _convertNavData(result.data);
... ... @@ -167,7 +171,9 @@ const _getActivityDetail = (id) => {
};
return api.get('', params).then(res => {
return api.get('', params, {
cache: true
}).then(res => {
if (res.code === 200) {
return _convertActicityData(res.data);
} else {
... ... @@ -188,7 +194,9 @@ const _getHomeActivity = (data) => {
platform: 3 // h5平台代号
};
return api.get('', _.assign(params, data)).then(res => {
return api.get('', _.assign(params, data), {
cache: true
}).then(res => {
return _convertActicityData(res.data);
});
};
... ... @@ -258,7 +266,9 @@ const getActivityTime = (params) => {
return api.get('', _.assign({
method: 'app.outlets.activityGet',
platform: 3 // h5平台代号
}, params)).then(res => {
}, params), {
cache: true
}).then(res => {
var times = [];
if (res && res.code === 200) {
... ... @@ -274,8 +284,8 @@ const getActivityTime = (params) => {
};
module.exports = {
getContent: getContent,
getActivity: getActivity,
getRecentActivity: getRecentActivity,
getActivityTime: getActivityTime
getContent,
getActivity,
getRecentActivity,
getActivityTime
};
... ...