site-map-service.js
1.71 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
69
70
71
72
73
74
75
76
77
78
79
80
/**
* map
* @author: xiaoxiao<xiaoxiao.hao@yoho.cn>
* @date: 2017/10/24
*/
'use strict';
const _ = require('lodash');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
guangList(page, lres) {
return this.get({
url: 'guang/api/v2/article/getList',
data: {
page: page,
limit: 1000
},
param: {
cache: true
},
api: global.yoho.ServiceAPI
}).then(rdata => {
let artList = _.get(rdata, 'data.list.artList', []);
if (artList.length <= 0) {
return lres;
}
lres = lres.concat(_.map(artList, (art) => {
return art.id;
}));
rdata = [];
artList = [];
return this.guangList(++page, lres);
});
}
newsList(page, lres) {
return this.get({
url: 'yohonow/api/page/getPolymerizationList',
data: {
type: 'wechat',
limit: 100,
id: 'yohobuy4008899646,yohogroup,YOHO_GIRL,mars-app',
page: page
},
param: {
cache: true
},
api: global.yoho.YohoNowApi
}).then(rdata => {
let artList = _.get(rdata, 'data.content', []);
if (artList.length <= 0) {
return lres;
}
lres = lres.concat(_.map(artList, (art) => {
return `${art.id}_${art.cid}`;
}));
rdata = [];
artList = [];
return this.newsList(++page, lres);
});
}
};