wupengfei
2 天以前 ddddcf83e7deb9d0a674d2bbead300089530d87e
packages/core/src/lifeRecharge.ts
@@ -17,10 +17,6 @@
  static constants = LifeRechargeConstants;
  constants = LifeRechargeConstants;
  /**用户所有的渠道 */
  userChannles = [] as ChannelOutput[];
  isBackClientUser: boolean;
  constructor(options: BlLifeRechargeOptions<TResponse, TRequestOptions>) {
    this.listener = new LifeRechargeListener();
    this.services = new BlLifeRechargeServices(this, options);
@@ -31,10 +27,17 @@
    });
  }
  init() {
    if (this.accountModel.userId) {
      this.accountModel.getUserInfo();
    }
  }
  async login(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) {
    try {
      let res = await this.services.lifePayPhoneMesssageCodeLogin(body, options);
      this.accountModel.setUserId(res.userId);
      this.accountModel.getUserInfo();
      this.accountModel.setPhoneNumber(body.phoneNumber);
      return res;
    } catch (error) {
@@ -46,6 +49,7 @@
    this.accountModel.setUserId('');
    this.accountModel.setPhoneNumber('');
    this.accountModel.setUserChannles([]);
    this.accountModel.isBackClientUser = false;
  }
  isLogin() {
@@ -53,7 +57,10 @@
  }
  getRechargeParValue(amount: number | string, rate: number) {
    return ((Number(amount) * rate) / 100).toFixed(2);
    if (rate > 0) {
      return ((Number(amount) * rate) / 100).toFixed(2);
    }
    return Number(amount).toFixed(2);
  }
  MaxParValue = 300;