zhengyiming
2025-03-28 381c97332e567a1b95a9a5220275461d0ae3f74e
packages/core/src/lifeRechargeAccountModel.ts
@@ -9,6 +9,10 @@
  phoneNumber = '';
  channlesNum = '';
  /**用户所有的渠道 */
  userChannles = [] as ChannelOutput[];
  isBackClientUser: boolean;
  constructor(
    ctx: BlLifeRecharge<TResponse, TRequestOptions>,
    options: BlLifeRechargeAccountModelOptions = {}
@@ -23,22 +27,22 @@
  setUserId(userId: string) {
    this.userId = userId;
    this.ctx.listener.fireEvent('update', this.ctx);
    if (userId) {
      this.getUserInfo(userId);
    }
    // if (userId) {
    //   this.getUserInfo(userId);
    // }
  }
  async getUserInfo(userId: string) {
  async getUserInfo(userId?: string) {
    try {
      let res = await this.ctx.services.lifePayUserMesssageByIduser(
        {
          id: userId,
          id: userId || this.userId,
        },
        {
          showLoading: false,
        }
      );
      this.ctx.isBackClientUser = res.isBackClientUser;
      this.isBackClientUser = res.isBackClientUser;
      if (res && res.isBackClientUser) {
        this.setUserChannles(res.channlesNum ?? []);
      }
@@ -57,7 +61,7 @@
    this.ctx.listener.fireEvent('update', this.ctx);
  }
  setUserChannles(userChannles: ChannelOutput[]) {
    this.ctx.userChannles = userChannles;
    this.userChannles = userChannles;
    this.ctx.listener.fireEvent('update', this.ctx);
  }
}