From 915424730f27445da2e8de13b62e77179cc1a15a Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 18 八月 2025 17:07:39 +0800
Subject: [PATCH] fix: 关闭移动充值渠道,打开电信充值渠道
---
packages/core/src/lifeRechargeAccountModel.ts | 62 +++++++++++++++++++++++++++++-
1 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/packages/core/src/lifeRechargeAccountModel.ts b/packages/core/src/lifeRechargeAccountModel.ts
index 2433cc1..952fec3 100644
--- a/packages/core/src/lifeRechargeAccountModel.ts
+++ b/packages/core/src/lifeRechargeAccountModel.ts
@@ -1,20 +1,76 @@
import { BlLifeRechargeAccountModelOptions } from './types';
+import { ChannelOutput } from './lifeRechargeServices';
+import { BlLifeRecharge } from './lifeRecharge';
-export class BlLifeRechargeAccountModel {
+export class BlLifeRechargeAccountModel<TResponse = any, TRequestOptions = any> {
+ ctx: BlLifeRecharge<TResponse, TRequestOptions>;
+
userId = '';
phoneNumber = '';
+ channlesNum = '';
+ promoterIdNumber = '';
- constructor(options: BlLifeRechargeAccountModelOptions = {}) {
- const { userId = '', phoneNumber = '' } = options;
+ /**鐢ㄦ埛鎵�鏈夌殑娓犻亾 */
+ userChannles = [] as ChannelOutput[];
+ isBackClientUser: boolean;
+ isGetUserInfo = false;
+
+ constructor(
+ ctx: BlLifeRecharge<TResponse, TRequestOptions>,
+ options: BlLifeRechargeAccountModelOptions = {}
+ ) {
+ const { userId = '', phoneNumber = '', channlesNum } = options;
+ this.ctx = ctx;
this.setUserId(userId);
this.setPhoneNumber(phoneNumber);
+ this.setChannlesNum(channlesNum);
}
setUserId(userId: string) {
this.userId = userId;
+ this.ctx.listener.fireEvent('update', this.ctx);
+ // if (userId) {
+ // this.getUserInfo(userId);
+ // }
+ }
+
+ async getUserInfo(userId?: string) {
+ try {
+ let res = await this.ctx.services.lifePayUserMesssageByIduser(
+ {
+ id: userId || this.userId,
+ },
+ {
+ showLoading: false,
+ }
+ );
+ if (res && res.isBackClientUser) {
+ this.setUserChannles(res.channlesNum ?? []);
+ }
+ this.isBackClientUser = res.isBackClientUser;
+ this.promoterIdNumber = res.promoterIdNumber;
+ this.isGetUserInfo = true;
+ return res;
+ } catch (error) {
+ console.log('error: ', error);
+ }
}
setPhoneNumber(phoneNumber: string) {
this.phoneNumber = phoneNumber;
+ this.ctx.listener.fireEvent('update', this.ctx);
+ }
+ setChannlesNum(channlesNum: string) {
+ this.channlesNum = channlesNum;
+ this.ctx.listener.fireEvent('update', this.ctx);
+ }
+ setUserChannles(userChannles: ChannelOutput[]) {
+ this.userChannles = userChannles;
+ this.ctx.listener.fireEvent('update', this.ctx);
+ }
+
+ setUserPromoterIdNumber(promoterIdNumber: string) {
+ this.promoterIdNumber = promoterIdNumber;
+ this.ctx.listener.fireEvent('update', this.ctx);
}
}
--
Gitblit v1.9.1