Authored by 刘志远

Merge branch 'feature/lzhy-20200423' into 'master'

爬虫ip限制

爬虫ip限制

See merge request !32
... ... @@ -19,14 +19,14 @@ const app = express();
global.isProduction = process.env.NODE_ENV === 'production';
global.sender = new Sender(config.monitorReport); // 初始化数据上报
schedule.scheduleJob('0 */15 * * * *', () => {
schedule.scheduleJob('0 10 * * * *', () => {
logger.info('[process]task start spiderTask'); // 比价任务
spiderTask(dayjs().unix());
});
schedule.scheduleJob('0 0 * * * *', () => {
logger.info('[process]task start spiderAllTask'); // 比价任务-all
spiderAllTask(dayjs().unix());
});
// schedule.scheduleJob('0 0 * * * *', () => {
// logger.info('[process]task start spiderAllTask'); // 比价任务-all
// spiderAllTask(dayjs().unix());
// });
schedule.scheduleJob('0 15 10 * * *', () => {
logger.info('[process]task start calvAvgTask'); // 根据比价记录表计算昨日平均价
... ... @@ -38,10 +38,10 @@ schedule.scheduleJob('0 59 23 * * *', () => {
clearTask();
});
schedule.scheduleJob('0 10 1 * * *', () => {
logger.info('[process]task start priceTask');
priceTask(); // 全量更新毒的价格数据
});
// schedule.scheduleJob('0 10 1 * * *', () => {
// logger.info('[process]task start priceTask');
// priceTask(); // 全量更新毒的价格数据
// });
priceLineTask.forEach(taskInfo => {
schedule.scheduleJob(taskInfo.cron, taskInfo.task); // 启动所有价格区间任务
... ...
... ... @@ -45,7 +45,8 @@ const requestDu = (params, type) => {
appVersion: '4.4.0',
Referer: `https://m.poizon.com/router/product/ProductDetail?spuId=${params.spuId || 1}&sourceName=shareDetail`,
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 Safari/604.1',
'X-Requested-With': 'XMLHttpRequest'
'X-Requested-With': 'XMLHttpRequest',
'X-Forwarded-For': '47.111.45.185'
},
timeout: 2000
});
... ...