global-api.js
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* 全球购API
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/4/6
*/
'use strict';
const globalApi = global.yoho.GlobalAPI;
const config = global.yoho.config;
const getGlobalProductListAsync = (params, from) => {
let finalParams = {
limit: 60
};
Object.assign(finalParams, params);
if (from) {
finalParams.fromPage = from;
}
return globalApi.get('product/api/v2/detail/getlist', finalParams, config.apiCache);
};
const getGlobalProductDetailAsync = (skn, channelNum) => {
return globalApi.get('product/api/v2/detail/get', {
physical_channel: channelNum,
product_skn: skn
}, config.apiCache);
};
const getGlobalProductHtmlAsync = (skn, channelNum) => {
return globalApi.get('product/api/v1/detail/gethtml', {
physical_channel: channelNum,
product_skn: skn,
return_type: 'html'
}, config.apiCache);
};
const getGlobalBrandInfoAsync = brand => {
return globalApi.get('editor/api/v1/brand/get', {
brandId: brand
}, config.apiCache);
};
module.exports = {
getGlobalProductListAsync,
getGlobalProductDetailAsync,
getGlobalProductHtmlAsync,
getGlobalBrandInfoAsync
};