const TaskBase=require("../task.base");
var system=require("../../system")
const logCtl=system.getObject("web.oplogCtl");
class BehivetoBossCustomerTask extends TaskBase{
  constructor(){
    super(TaskBase.getServiceName(BehivetoBossCustomerTask));
    this.wxapi=system.getObject("applet.bossShopApplet");
  }
  async subDoTask(){
    await this.execCustomer();
    await this.execOrder();
    await this.exectm();

  }
  async execCustomer(){
    console.log("导入老客户数据*******************************任务*************************************99");
    var tmp=await this.wxapi.customersbysalemanlist();
    //日志记录
    logCtl.info({
       optitle:"导入老客户数据",
       op:"base/db/task/BehivetoBossCustomerTask.js",
       content:"执行结果："+JSON.stringify(tmp),
       clientIp:""
     });
  }

  async execOrder(){
    console.log("导入老客户订单数据*******************************任务*************************************99");
    var tmp=await this.wxapi.customersbysalemanlist();
    //日志记录
    logCtl.info({
       optitle:"导入老客户订单数据",
       op:"base/db/task/BehivetoBossCustomerTask.js",
       content:"执行结果："+JSON.stringify(tmp),
       clientIp:""
     });
  }

  async exectm(){
    console.log("导入商标数据*******************************任务*************************************99");
    var tmp=await this.wxapi.findbhtm();
    //日志记录
    logCtl.info({
       optitle:"导入商标数据",
       op:"base/db/task/BehivetoBossCustomerTask.js",
       content:"执行结果："+JSON.stringify(tmp),
       clientIp:""
     });
  }

}
module.exports=BehivetoBossCustomerTask;

//
// var task=new PlatformBalanceTask();
// task.checkPlatformBalance().then(function(result){
//   console.log((result));
// }).catch(function(e){
//   console.log(e);
// });
