Showing
1 changed file
with
8 additions
and
1 deletions
@@ -24,9 +24,11 @@ class XzhIndexModel extends global.yoho.BaseModel { | @@ -24,9 +24,11 @@ class XzhIndexModel extends global.yoho.BaseModel { | ||
24 | return util.sleep(3000).then(() => { | 24 | return util.sleep(3000).then(() => { |
25 | return this.getLastArticleList({page: 1, limit: 1000}); | 25 | return this.getLastArticleList({page: 1, limit: 1000}); |
26 | }).then(rdata => { | 26 | }).then(rdata => { |
27 | + let code = rdata.code || 400; | ||
28 | + | ||
27 | rdata = _.get(rdata, 'data.artList', []); | 29 | rdata = _.get(rdata, 'data.artList', []); |
28 | 30 | ||
29 | - if (rdata.length <= 0) { | 31 | + if (code === 200 && rdata.length <= 0) { |
30 | return false; | 32 | return false; |
31 | } | 33 | } |
32 | 34 | ||
@@ -39,6 +41,11 @@ class XzhIndexModel extends global.yoho.BaseModel { | @@ -39,6 +41,11 @@ class XzhIndexModel extends global.yoho.BaseModel { | ||
39 | 41 | ||
40 | // 向百度发送数据 | 42 | // 向百度发送数据 |
41 | sendData(data, type) { | 43 | sendData(data, type) { |
44 | + | ||
45 | + if (data.length <= 0) { | ||
46 | + return Promise.resolve({code: 400, data:{}, message: 'data is empty'}); | ||
47 | + } | ||
48 | + | ||
42 | type = type || 'batch'; | 49 | type = type || 'batch'; |
43 | 50 | ||
44 | data = _.map(data, item => { | 51 | data = _.map(data, item => { |
-
Please register or login to post a comment