yoho-api.js
1.64 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
'use strict';
/**
* 连接提交
* http://ziyuan.baidu.com/linksubmit/index?site=https://www.yohobuy.com/
*/
class YohoApi extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
searchList(params, cache) {
params = Object.assign({
limit: 100,
method: 'app.search.li',
status: 1,
stocknumber: 1,
attribute_not: 2,
udid: 'seo_format_data'
}, params);
return this.get({
data: params,
param: {
cache: cache || false
}
}).catch(e => {
console.log(e.message);
return {code: 400, data: {}, message: e.message};
});
}
bdPromotion(params, cache) {
params = Object.assign({
method: 'web.product.bdPromotion',
udid: 'seo_format_data'
}, params);
return this.get({
data: params,
param: {
cache: cache || false
}
}).catch(e => {
console.log(e.message);
return {code: e.statusCode || 400, data: {}, message: e.message};
});
}
getLastArticleList(params) {
params = Object.assign({
limit: 100,
udid: 'seo_format_data'
}, params);
return this.get({
url: '/guang/api/v2/article/getLastArticleList',
data: params,
api: global.yoho.ServiceAPI
}).catch(e => {
console.log(e.message);
return {code: e.statusCode || 400, data: {}, message: e.message};
});
}
}
module.exports = YohoApi;