|
|
|
@ -22,6 +22,21 @@ import cron from 'node-cron';
@@ -22,6 +22,21 @@ import cron from 'node-cron';
|
|
|
|
|
|
|
|
|
|
taskMoniter.run(); //监控新任务
|
|
|
|
|
|
|
|
|
|
//HeroUnion英雄联盟对接
|
|
|
|
|
let heroUnionConfig = configs.herounion; |
|
|
|
|
let heroBot = new HeroBot( |
|
|
|
|
heroUnionConfig.server_url, |
|
|
|
|
heroUnionConfig.name, |
|
|
|
|
heroUnionConfig.description, |
|
|
|
|
heroUnionConfig.platforms, |
|
|
|
|
heroUnionConfig.contracts, |
|
|
|
|
heroUnionConfig.country, |
|
|
|
|
heroUnionConfig.lang, |
|
|
|
|
heroUnionConfig.contact, |
|
|
|
|
heroUnionConfig.data_mode |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//配置本地cloud server地址,cloud安装参考:./install_cloud.sh
|
|
|
|
|
const heroCloudServer = typeof(configs.cloud_server) != 'undefined' && configs.cloud_server ? configs.cloud_server : ''; |
|
|
|
|
|
|
|
|
@ -65,6 +80,11 @@ import cron from 'node-cron';
@@ -65,6 +80,11 @@ import cron from 'node-cron';
|
|
|
|
|
&& await tajian.saveDescriptionFiles(task.id, data) |
|
|
|
|
) { |
|
|
|
|
taskMoniter.setTaskDone(task.id); |
|
|
|
|
|
|
|
|
|
//保存数据到HeroUnion联盟
|
|
|
|
|
if (typeof(task.from) != 'undefined' && task.from == 'HeroUnion') { |
|
|
|
|
heroBot.saveTaskData(task.id, task.token, data); |
|
|
|
|
} |
|
|
|
|
}else { |
|
|
|
|
taskMoniter.setTaskFailed(task.id); |
|
|
|
|
} |
|
|
|
@ -86,20 +106,6 @@ import cron from 'node-cron';
@@ -86,20 +106,6 @@ import cron from 'node-cron';
|
|
|
|
|
console.log('[%s] Spider started.', common.getTimeString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//HeroUnion英雄联盟对接
|
|
|
|
|
let heroUnionConfig = configs.herounion; |
|
|
|
|
let heroBot = new HeroBot( |
|
|
|
|
heroUnionConfig.server_url, |
|
|
|
|
heroUnionConfig.name, |
|
|
|
|
heroUnionConfig.description, |
|
|
|
|
heroUnionConfig.platforms, |
|
|
|
|
heroUnionConfig.contracts, |
|
|
|
|
heroUnionConfig.country, |
|
|
|
|
heroUnionConfig.lang, |
|
|
|
|
heroUnionConfig.contact, |
|
|
|
|
heroUnionConfig.data_mode |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
//爬虫心跳上报
|
|
|
|
|
const heartBeatFrequence = 5; //5 分钟上报一次
|
|
|
|
|
const heroUnionHeartBeat = cron.schedule(`*/${heartBeatFrequence} * * * *`, async () => { |
|
|
|
|