Authored by 郝肖肖

'定时推送逛文章'

@@ -187,7 +187,7 @@ class SeoIndexModel extends global.yoho.BaseModel { @@ -187,7 +187,7 @@ class SeoIndexModel extends global.yoho.BaseModel {
187 _getJob(params) { 187 _getJob(params) {
188 let task = {}; 188 let task = {};
189 189
190 - switch(params.type) { 190 + switch (params.type) {
191 case 'minute': 191 case 'minute':
192 task = jobTask[0]; 192 task = jobTask[0];
193 break; 193 break;
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
3 const ROOT_PATH = global.ROOT_PATH; 3 const ROOT_PATH = global.ROOT_PATH;
4 const _ = require('lodash'); 4 const _ = require('lodash');
5 const rp = require('request-promise'); 5 const rp = require('request-promise');
6 -const util = require(`${ROOT_PATH}/libs/util`);  
7 const redis = require(`${ROOT_PATH}/libs/redis`); 6 const redis = require(`${ROOT_PATH}/libs/redis`);
8 const senUrl = 'http://data.zz.baidu.com/urls?appid=1583402501013173&token=K0L5PUhk1XOko81r&type='; 7 const senUrl = 'http://data.zz.baidu.com/urls?appid=1583402501013173&token=K0L5PUhk1XOko81r&type=';
9 8
@@ -21,9 +21,9 @@ const SeoTask = { @@ -21,9 +21,9 @@ const SeoTask = {
21 return redis.hvalsAsync(item.k).then(urls => { 21 return redis.hvalsAsync(item.k).then(urls => {
22 console.log(`task key: ${item.k}, urls: ${JSON.stringify(urls)}, exec...`); 22 console.log(`task key: ${item.k}, urls: ${JSON.stringify(urls)}, exec...`);
23 23
24 - urls.forEach((item) => {  
25 - item = JSON.parse(item || '[]');  
26 - this.execTask(item.url, item.time); 24 + urls.forEach(val => {
  25 + val = JSON.parse(val || '[]');
  26 + this.execTask(val.url, val.time);
27 }); 27 });
28 }); 28 });
29 }); 29 });