var system = require("../../../system")
const CtlBase = require("../../ctlms.base");
class MerchantCtl extends CtlBase {
  constructor() {
    super();
    this.merchantSve = system.getObject("service.saas.merchantSve");
  }

  async dics(params, pobj2, req) {
    try {
      return await this.merchantSve.dics(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async info(params, pobj2, req) {
    try {
      return await this.merchantSve.info(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async page(params, pobj2, req) {
    try {
      this.doTimeCondition(params, ["createBegin", "createEnd"]);
      return await this.merchantSve.page(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async signPage(params, pobj2, req) {
    try {
      params.is_sign = 1;
      this.doTimeCondition(params, ["createBegin", "createEnd"]);
      return await this.merchantSve.page(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async save(params, pobj2, req) {
    try {
      return await this.merchantSve.save(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async sign(params, pobj2, req) {
    try {
      params.bm_reg_price = system.y2f(params.bm_reg_price || 0);
      params.invoice_service_rate = system.y2f(params.invoice_service_rate || 0);
      params.trans_service_rate = system.y2f(params.trans_service_rate || 0);
      return await this.merchantSve.sign(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }

  async signInfo(params, pobj2, req) {
    try {
      return await this.merchantSve.signInfo(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }
  async title(params, pobj2, req) {
    try {
      return await this.merchantSve.title(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }
  async addr(params, pobj2, req) {
    try {
      return await this.merchantSve.addr(params);
    } catch (error) {
      return system.getResult(null, `系统错误 错误信息 ${error}`);
    }
  }


}
module.exports = MerchantCtl;
