var system=require("../../system")
var settings=require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
class EcompanyCtl extends CtlBase{
   constructor(){
     super(CtlBase.getServiceName(EcompanyCtl));
   }
   async getByName(queryobj,qobj,req){

   }
   async mysave(queryobj,qobj,req){
     try {
       console.log(queryobj, "--------------------------queryobj---------------");
       console.log(qobj, "--------------------------qobj---------------");
       var old=null;
       if(qobj.id){
         old = await this.service.findById(qobj.id);
       }
       console.log(old, "--------------------------old---------------");
   
       var rtn = null;
       if(old){//修改
         console.log("edit++++++++++++++++++++++++++++++++++++");
         rtn = await this.service.update(qobj);
       }else{//新增
         console.log("new++++++++++++++++++++++++++++++++++++");
         rtn=await this.service.create(qobj);
       }
   
       // 调用e签宝接口生成accountid
       return system.getResult2(rtn, null);
     } catch (e) {
       console.log("-----------------------------e");
       console.log(e);
       return {code:-1}
     }
   }
}
module.exports=EcompanyCtl;
