Authored by htoooth

add cache

... ... @@ -6,13 +6,15 @@
const serviceAPI = global.yoho.ServiceAPI;
const config = global.yoho.config;
/**
* 资源码找资源
*/
const getResourceAsync = resourceCode => {
return serviceAPI.get('/operations/api/v5/resource/get', {
content_code: resourceCode
});
}, config.apiCache);
};
module.exports = {
... ...
... ... @@ -5,12 +5,13 @@
'use strict';
const api = global.yoho.API;
const config = global.yoho.config;
const getProductBannerAsync = (pid) => {
return api.get('', {
method: 'web.productBanner.data',
product_id: pid
});
}, config.apiCache);
};
... ... @@ -18,7 +19,7 @@ const sizeInfoAsync = skn => {
return api.get('', {
method: 'h5.product.intro',
productskn: skn
});
}, config.apiCache);
};
... ... @@ -27,14 +28,14 @@ const isSupportReturnedSale = skn => {
return api.get('', {
method: 'app.product.refundExchange',
product_skn: skn
});
}, config.apiCache);
};
const getProductComfortAsync = pid => {
return api.get('', {
method: 'web.productComfort.data',
product_id: pid
});
}, config.apiCache);
};
... ... @@ -42,14 +43,14 @@ const getProductModelCardAsync = pid => {
return api.get('', {
method: 'web.productModelcard.list',
product_id: pid
});
}, config.apiCache);
};
const getProductModelTryAsync = skn => {
return api.get('', {
method: 'web.productModelTry.data',
product_skn: skn
});
}, config.apiCache);
};
/**
... ... @@ -74,7 +75,7 @@ const getProductAsync = (pid, uid, isStudents, vipLevel) => {
if (vipLevel) {
params.current_vip_level = vipLevel;
}
return api.get('', params);
return api.get('', params, config.apiCache);
};
const getPromotionAsync = (skn) => {
... ... @@ -83,7 +84,7 @@ const getPromotionAsync = (skn) => {
product_skn: skn
};
return api.get('', params);
return api.get('', params, config.apiCache);
};
const getLimitedProductStatusAsync = (code, uid, skn) => {
... ... @@ -100,7 +101,7 @@ const getLimitedProductStatusAsync = (code, uid, skn) => {
params.product_skn = skn;
}
return api.get('', params);
return api.get('', params, config.apiCache);
};
module.exports = {
... ...
... ... @@ -72,6 +72,9 @@ module.exports = {
appID: 'wx3ae21dcbb82ad672',
appSecret: 'e78afb2321e6a19085767e1a0f0d52c1'
}
},
apiCache: {
cache: true
}
};
... ...