var system = require("../../../system");
const http = require("http");
const querystring = require('querystring');
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
const moment = require('moment');
class StatusLogCtl extends CtlBase {
  constructor() {
    super("bizchance", CtlBase.getServiceName(StatusLogCtl));
  }

  /*插入缓存信息 */
  async insertInfo(mobj,qobj,req){
    var pobj = mobj.d;
    if (pobj.flowType && pobj.flowType != 'undefined' && pobj.flowId && pobj.flowId != 'undefined' 
        && pobj.statusCode && pobj.statusCode != 'undefined'){
        try{
          var res = await this.service.insertInfo(pobj);
          return system.getResult("插入成功！");
        }
        catch (error){
          return system.getResultError(error);
        }
      }
      else{
        return system.getResultError("参数错误!");
      }
  }

  timeFormat(date) {
    let localTime = moment.utc(date).toDate();
    localTime = moment(localTime).format("YYYY-MM-DD");
    return localTime;
  }
}
module.exports = StatusLogCtl;

// var task = new CacheInfoCtl();
// var obj={"demand_code":"30030302992","business_status":"isFinished"};
// task.updateStatusByDemandCode(obj,{},{}).then(d=>{
//   console.log(d);
//   //console.log(d[0].analyse);

// })
