global-api.js
1.61 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* 全球购API
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2017/4/6
*/
'use strict';
const config = global.yoho.config;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getGlobalProductListAsync(params, from) {
let finalParams = {
limit: 60
};
Object.assign(finalParams, params);
if (from) {
finalParams.fromPage = from;
}
return this.get({
url: 'product/api/v2/detail/getlist',
data: finalParams,
params: {cache: config.apiCache},
api: global.yoho.GlobalAPI
});
}
getGlobalProductDetailAsync(skn, channelNum) {
return this.get({
url: 'product/api/v2/detail/get',
data: {
physical_channel: channelNum,
product_skn: skn
},
params: { cache: config.apiCache },
api: global.yoho.GlobalAPI
});
}
getGlobalProductHtmlAsync(skn, channelNum) {
return this.get({
url: 'product/api/v1/detail/gethtml',
data: {
physical_channel: channelNum,
product_skn: skn,
return_type: 'html'
},
params: {cache: config.apiCache},
api: global.yoho.GlobalAPI
});
}
getGlobalBrandInfoAsync(brand) {
return this.get({
url: 'editor/api/v1/brand/get',
data: { brandId: brand },
params: {cache: config.apiCache},
api: global.yoho.GlobalAPI
});
}
};