From dfb8f993f691eedc558d52347b1a93a105f6b0d2 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期一, 03 三月 2025 16:43:14 +0800
Subject: [PATCH] fix: 对接

---
 packages/core/src/lifeRechargeServices.ts |   36 ++++++------------------------------
 1 files changed, 6 insertions(+), 30 deletions(-)

diff --git a/packages/core/src/lifeRechargeServices.ts b/packages/core/src/lifeRechargeServices.ts
index 4127822..6e3e758 100644
--- a/packages/core/src/lifeRechargeServices.ts
+++ b/packages/core/src/lifeRechargeServices.ts
@@ -1,37 +1,13 @@
-import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
-import { IRequest, BlLifeRechargeServicesOptions } from './types';
+import { BlLifeRechargeServicesOptions } from './types';
 import { LifeRechargeConstants } from './lifeRechargeConstants';
+import { Request, IRequest } from 'senior-request';
 
 export interface RequestConfig {}
 
-export class BlLifeRechargeServices<T extends IRequest> {
-  private request: T;
-  request2: T;
-  constructor({ request, axiosOptions }: BlLifeRechargeServicesOptions<T>) {
-    this.request = request;
-    const axiosInstance = axios.create(axiosOptions);
-    // @ts-expect-error
-    this.request2 = (url: string, opts: any = { method: 'GET' }) => {
-      return new Promise((resolve, reject) => {
-        axiosInstance
-          .request({ ...opts, url })
-          .then((res) => {
-            //@ts-ignore
-            resolve(res);
-          })
-          .catch((error) => {
-            try {
-              // const handler = config?.errorConfig?.errorHandler;
-              // if (handler) {
-              //   handler(error, opts, config);
-              // }
-            } catch (e) {
-              reject(e);
-            }
-            reject(error);
-          });
-      });
-    };
+export class BlLifeRechargeServices<TResponse = any, TRequestOptions = any> {
+  private request: IRequest;
+  constructor({ axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>) {
+    this.request = Request.create(axiosConfig);
   }
 
   async lifePayPhoneMesssageCodeLogin(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) {

--
Gitblit v1.9.1