global-api.js
1.05 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
/**
* 全球购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('api/v2/detail/getlist', finalParams, config.apiCache);
};
const getGlobalProductDetailAsync = (skn, channelNum) => {
return globalApi.get('api/v2/detail/get', {
physical_channel: channelNum,
product_skn: skn,
client_type: 'iphone'
}, config.apiCache);
};
const getGlobalProductHtmlAsync = (skn, channelNum) => {
return globalApi.get('api/v1/detail/gethtml', {
physical_channel: channelNum,
product_skn: skn,
return_type: 'html',
client_type: 'iphone'
}, config.apiCache);
};
module.exports = {
getGlobalProductListAsync,
getGlobalProductDetailAsync,
getGlobalProductHtmlAsync
};