zhengyiming
2025-03-28 8bb9173a95a87e3ceab4f48b5b34041af38b7c70
packages/core/src/lifeRecharge.ts
@@ -2,21 +2,29 @@
  BlLifeRechargeServices,
  PhoneMesssageCodeLoginInput,
  RequestConfig,
  ChannelOutput,
} from './lifeRechargeServices';
import { BlLifeRechargeOptions } from './types';
import { LifeRechargeConstants } from './lifeRechargeConstants';
import { BlLifeRechargeAccountModel } from './lifeRechargeAccountModel';
import { LifeRechargeListener } from './listener';
export class BlLifeRecharge<TResponse = any, TRequestOptions = any> {
  services: BlLifeRechargeServices<TResponse, TRequestOptions>;
  accountModel: BlLifeRechargeAccountModel;
  listener: LifeRechargeListener;
  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);
    this.accountModel = new BlLifeRechargeAccountModel({
    this.accountModel = new BlLifeRechargeAccountModel(this, {
      userId: options.userId,
      phoneNumber: options.phoneNumber,
      channlesNum: options.channlesNum,
@@ -26,7 +34,7 @@
  async login(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) {
    try {
      let res = await this.services.lifePayPhoneMesssageCodeLogin(body, options);
      this.accountModel.setUserId(res);
      this.accountModel.setUserId(res.userId);
      this.accountModel.setPhoneNumber(body.phoneNumber);
      return res;
    } catch (error) {
@@ -37,6 +45,7 @@
  loginout() {
    this.accountModel.setUserId('');
    this.accountModel.setPhoneNumber('');
    this.accountModel.setUserChannles([]);
  }
  isLogin() {