Authored by 陈峰

commit

... ... @@ -7,12 +7,13 @@ const {logger} = require('./libs/logger');
const spiderTask = require('./tasks/spider-task');
const calvAvgTask = require('./tasks/calc-task');
const clearTask = require('./tasks/clear-task');
const priceTask = require('./tasks/price-task');
// const priceTask = require('./tasks/price-task');
global.isProduction = process.env.NODE_ENV === 'production';
global.sender = new Sender(config.monitorReport); // 初始化数据上报
schedule.scheduleJob('0 */30 * * * *', () => {
schedule.scheduleJob('0 */15 * * * *', () => {
logger.info('[process]task start spiderTask');
spiderTask(dayjs().unix());
});
... ... @@ -27,8 +28,7 @@ schedule.scheduleJob('0 59 23 * * *', () => {
clearTask();
});
schedule.scheduleJob('0 10 * * * *', () => {
logger.info('[process]task start priceTask');
priceTask();
});
priceTask();
// schedule.scheduleJob('0 10 * * * *', () => {
// logger.info('[process]task start priceTask');
// priceTask();
// });
... ...
... ... @@ -8,7 +8,7 @@ const {logger} = require('../libs/logger');
const {sendMessage} = require('../libs/influx-report');
module.exports = async(time) => {
spider(sknsData.map(p => p.productId))
spider(sknsData.map(p => p.productId), 'http://du.hupu.com/mapi/product/detail', {}, 1)
.forEach(promise => promise.then(result => {
if (result.status !== 200 && !_.has(result, 'data.detail')) {
logger.warn(`[spider-task]爬取失败记录: ${JSON.stringify(result)}`);
... ...