From 58c6417603cc9e4c1012ba4fc4c6306dcb0e2324 Mon Sep 17 00:00:00 2001 From: zhengyiming <540361168@qq.com> Date: 星期一, 24 二月 2025 09:34:53 +0800 Subject: [PATCH] fix: 对接 --- packages/components/src/utils/lifeRecharge.ts | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/components/src/utils/lifeRecharge.ts b/packages/components/src/utils/lifeRecharge.ts index 36714ce..1cdaf07 100644 --- a/packages/components/src/utils/lifeRecharge.ts +++ b/packages/components/src/utils/lifeRecharge.ts @@ -4,28 +4,38 @@ RequestConfig, } from './lifeRechargeServices'; import { IRequest, BlLifeRechargeOptions } from './types'; +import { LifeRechargeConstants } from './lifeRechargeConstants'; +import { BlLifeRechargeAccountModel } from './lifeRechargeAccountModel'; export class BlLifeRecharge<T extends IRequest = IRequest> { services: BlLifeRechargeServices<T>; - userId = ''; + accountModel: BlLifeRechargeAccountModel; + + static constants = LifeRechargeConstants; + constants = LifeRechargeConstants; constructor(options: BlLifeRechargeOptions<T>) { this.services = new BlLifeRechargeServices(options); - this.userId = options.userId || ''; + this.accountModel = new BlLifeRechargeAccountModel({ + userId: options.userId, + phoneNumber: options.phoneNumber, + }); } async login(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) { let res = await this.services.lifePayPhoneMesssageCodeLogin(body, options); - this.userId = res; + this.accountModel.setUserId(res); + this.accountModel.setPhoneNumber(body.phoneNumber); return res; } loginout() { - this.userId = ''; + this.accountModel.setUserId(''); + this.accountModel.setPhoneNumber(''); } isLogin() { - return !!this.userId; + return !!this.accountModel.userId; } getRechargeParValue(amount: number, rate: number) { -- Gitblit v1.9.1