From c5743e1072ed629d721f45db8237874ac9a5df45 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 26 二月 2025 10:16:38 +0800
Subject: [PATCH] fix: 对接

---
 packages/core/src/lifeRechargeServices.ts |  123 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 1 deletions(-)

diff --git a/packages/core/src/lifeRechargeServices.ts b/packages/core/src/lifeRechargeServices.ts
index 753b3b0..4127822 100644
--- a/packages/core/src/lifeRechargeServices.ts
+++ b/packages/core/src/lifeRechargeServices.ts
@@ -6,8 +6,32 @@
 
 export class BlLifeRechargeServices<T extends IRequest> {
   private request: T;
-  constructor({ request }: BlLifeRechargeServicesOptions<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);
+          });
+      });
+    };
   }
 
   async lifePayPhoneMesssageCodeLogin(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) {
@@ -24,6 +48,14 @@
   /** 鑾峰彇鎶樻墸 GET /api/LifePay/GetRate */
   async getRate(options?: RequestConfig) {
     return this.request<LifePayRateListOutput[]>('/api/LifePay/GetRate', {
+      method: 'GET',
+      ...(options || {}),
+    });
+  }
+
+  /** 鑾峰彇鐢佃垂鍏呭�煎尯鍩� GET /api/LifePay/GetElectricSupportArea */
+  async getElectricSupportArea(options?: RequestConfig) {
+    return this.request<ElectricSupportAreaResponse>('/api/LifePay/GetElectricSupportArea', {
       method: 'GET',
       ...(options || {}),
     });
@@ -103,6 +135,33 @@
   /** 鑾峰彇鎴戠殑璁㈠崟鍒嗛〉鏁版嵁 POST /api/LifePay/GetUserLifePayOrderPage */
   async getUserLifePayOrderPage(body: QueryLifePayOrderListInput, options?: RequestConfig) {
     return this.request<UserLifePayOrderOutputPageOutput>('/api/LifePay/GetUserLifePayOrderPage', {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+      },
+      data: body,
+      ...(options || {}),
+    });
+  }
+
+  /** 鑾峰彇鐢熸椿缂磋垂鐢ㄦ埛韬唤浼氳瘽淇℃伅 GET /api/Account/GetLifePayWxIndentity */
+  async getLifePayWxIndentity(
+    // 鍙犲姞鐢熸垚鐨凱aram绫诲瀷 (闈瀊ody鍙傛暟swagger榛樿娌℃湁鐢熸垚瀵硅薄)
+    params: APIgetLifePayWxIndentityParams,
+    options?: RequestConfig
+  ) {
+    return this.request<WxMiniAppIndentityInfo>('/api/Account/GetLifePayWxIndentity', {
+      method: 'GET',
+      params: {
+        ...params,
+      },
+      ...(options || {}),
+    });
+  }
+
+  /** 鑾峰彇寰俊鏀粯鐨凧SAPI POST /api/LifePay/GetPayOrderForJsAPI */
+  async getPayOrderForJsAPI(body: GetPayOrderForJsAPIInput, options?: RequestConfig) {
+    return this.request<ModelPaymentMiniPay>('/api/LifePay/GetPayOrderForJsAPI', {
       method: 'POST',
       headers: {
         'Content-Type': 'application/json',
@@ -284,3 +343,65 @@
   /** 閫�娆炬椂闂� */
   refundTime?: string;
 }
+
+export interface ElectricSupportAreaResponse {
+  success?: boolean;
+  requestNo?: string;
+  partnerId?: string;
+  service?: string;
+  version?: string;
+  protocol?: string;
+  context?: string;
+  ext?: any;
+  code?: string;
+  message?: string;
+  detail?: string;
+  electricAreaList?: ElectricSupportAreaListOutput[];
+}
+
+export interface ElectricSupportAreaListOutput {
+  childCityList?: ElectricSupportAreaChildCityListOutput[];
+  cityName?: string;
+  cityParentId?: string;
+  ciytId?: string;
+  electricType?: string;
+  parValue?: string[];
+  rate?: number;
+}
+
+export interface ElectricSupportAreaChildCityListOutput {
+  cityName?: string;
+  cityParentId?: string;
+  ciytId?: string;
+}
+export interface APIgetLifePayWxIndentityParams {
+  /** 鐢ㄦ埛鐧诲綍鍑瘉 */
+  code?: string;
+}
+
+export interface WxMiniAppIndentityInfo {
+  /** 浼氳瘽瀵嗛挜 */
+  sessionKey?: string;
+  /** 灏忕▼搴廜penId */
+  openId?: string;
+  /** 鐢ㄦ埛鍚嶏紙璇ュ�间负绌哄垯闇�鎵嬫満鎺堟潈鐧诲綍锛屼笉涓虹┖鍒欏凡鏈夎灏忕▼搴忕敤鎴凤級 */
+  userName?: string;
+  unionId?: string;
+}
+
+export interface GetPayOrderForJsAPIInput {
+  orderNo: string;
+  lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
+  openId?: string;
+  attach?: string;
+}
+
+export interface ModelPaymentMiniPay {
+  nonceStr?: string;
+  package?: string;
+  signType?: string;
+  paySign?: string;
+  timestamp?: string;
+  timeExpire?: string;
+  message?: string;
+}

--
Gitblit v1.9.1