Authored by ccbikai(👎🏻🍜)

部分接口增加缓存

... ... @@ -36,6 +36,8 @@ const _packageAd = (params) => {
gender: 1,
limit: 1000,
page: 1
}, {
cache: true
}).then(result => {
return result;
... ... @@ -49,7 +51,10 @@ const _packageList = (params) => {
method: 'app.brand.newBrandList',
yh_channel: params.channel
}, { code: 200 }).then(result => {
}, {
cache: true,
code: 200
}).then(result => {
return result;
... ... @@ -269,7 +274,10 @@ const getBrandForSearch = (channel) => {
method: 'app.brand.brandlist',
yh_channel: channel || 1
}, { code: 200 }).then(result => {
}, {
cache: true,
code: 200
}).then(result => {
return result;
... ... @@ -289,7 +297,9 @@ const branchSearchHistory = (params) => {
uid: params.uid,
records: params.records || ''
}, { code: 200 }).then(result => {
}, {
code: 200
}).then(result => {
return result;
... ... @@ -316,7 +326,10 @@ const branchSearchHot = () => {
return api.get('', {
method: 'app.search.hotBrands'
}, { code: 200 }).then(result => {
}, {
cache: true,
code: 200
}).then(result => {
return result;
... ...
... ... @@ -260,7 +260,9 @@ let getBottomBannerData = (gender) => {
if (gender === 'boys' || gender === 'girls') {
return api.get('operations/api/v5/resource/get', {
content_code: bottomBannerCode[gender] // eslint-disable-line
}, true);
}, {
cache: true
});
}
return Promise.resolve({
code: 400,
... ...
... ... @@ -14,6 +14,8 @@ const getAllChannels = (params) => {
return api.get('', {
method: 'app.blk.getAllChannels',
app_type: params.app_type
}, {
cache: true
}).then(result => {
let data = {channel: []};
... ... @@ -53,6 +55,8 @@ const getProductBatch = (productSkn, options) => {
limit: productSkn.length,
page: 1,
productSkn: productSkn.join(',')
}, {
cache: true
}).then(result => {
return result && result.data ? productProcess.processProductList(result.data.product_list, options) : [];
});
... ... @@ -70,7 +74,9 @@ const getResources = (params, options) => {
params.platform = 'iphone';
}
return serviceAPI.get('operations/api/v5/resource/get', params).then(result => {
return serviceAPI.get('operations/api/v5/resource/get', params, {
cache: true
}).then(result => {
let data = {
goods: {},
recommend: {}
... ...
... ... @@ -343,6 +343,8 @@ let getintroIntro = (data) => {
return api.get('', {
method: 'app.product.intro',
product_skn: data.productskn
}, {
cache: true
}).then(result => {
result = $.load(result);
... ...
... ... @@ -8,6 +8,8 @@ const logger = global.yoho.logger;
const getHotRank = (codeKey) => {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: codeKey
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -53,7 +55,9 @@ const selectHotrank = (yhChannel, gender, sort, tabId, limit, page, notab) => {
param.tab_id = tabId;
}
return api.get('', param).then((result) => {
return api.get('', param, {
cache: true
}).then((result) => {
if (result && result.code === 200 && result.data.product_list) {
... ...
... ... @@ -240,6 +240,8 @@ const getFuzzyDatas = (params) => {
return api.get('', {
method: 'app.search.fuzzy',
keyword: params
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return result.data;
... ... @@ -259,7 +261,10 @@ const searchKeyActivity = (params) => {
return api.get('', {
method: 'app.search.word',
query: params
}, {code: 200}).then(result => {
}, {
cache: true,
code: 200
}).then(result => {
if (result.data) {
return result.data;
} else {
... ...