Commit bf627bc7 by 蒋勇

d

parent b98fc42a
const TaskBase=require("../../task.base"); const TaskBase=require("../../task.base");
class TestTask extends TaskBase{ class ParseRptTask extends TaskBase{
constructor(){ constructor(){
super(TaskBase.getServiceName(TestTask)); super(TaskBase.getServiceName(ParseRptTask));
this.cacheData=[]; this.cacheData=[];
} }
async subBeforeTask(params){ async subBeforeTask(params){
...@@ -13,18 +13,22 @@ class TestTask extends TaskBase{ ...@@ -13,18 +13,22 @@ class TestTask extends TaskBase{
async subTaskHandle(channel, message){ async subTaskHandle(channel, message){
var x=await this.redisClient.rpop(message); var x=await this.redisClient.rpop(message);
if(x){ if(x){
console.log("cache"+x);
this.cacheData.push(x); this.cacheData.push(x);
} }
setImmediate(()=>{ setImmediate(()=>{
this.paseXls(); await this.paseXls();
}); });
} }
async paseXls(){ async paseXls(){
var pv=this.cacheData.pop(); var pv=this.cacheData.pop();
if(pv){ if(pv){
console.log(pv); var tohandleurls=pv.split("~");
this.sleep(5000); var rptDate=tohandleurls[0];
var rptCode=tohandleurls[1];
var urldownload=tohandleurls[2];
//下载文件
this.paseXls(); this.paseXls();
} }
} }
...@@ -33,4 +37,4 @@ class TestTask extends TaskBase{ ...@@ -33,4 +37,4 @@ class TestTask extends TaskBase{
console.log("TestTask1....."); console.log("TestTask1.....");
} }
} }
module.exports=TestTask; module.exports=ParseRptTask;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment