From afdc0faf165dbc0c90e45043b4f500a3d53ba20f Mon Sep 17 00:00:00 2001 From: zym2525 <540361168@qq.com> Date: 星期二, 11 三月 2025 21:02:24 +0800 Subject: [PATCH] fix: some --- packages/core/src/lifeRechargeServices.ts | 298 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 291 insertions(+), 7 deletions(-) diff --git a/packages/core/src/lifeRechargeServices.ts b/packages/core/src/lifeRechargeServices.ts index f08a967..200ad7e 100644 --- a/packages/core/src/lifeRechargeServices.ts +++ b/packages/core/src/lifeRechargeServices.ts @@ -1,13 +1,23 @@ -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; - constructor({ request }: BlLifeRechargeServicesOptions<T>) { - this.request = request; +export class BlLifeRechargeServices<TResponse = any, TRequestOptions = any> { + private request: IRequest; + constructor({ axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>) { + this.request = Request.create({ + ...axiosConfig, + // baseURL: process.env.NODE_ENV === 'development' ? '/' : 'https://api.81812333.com', + timeout: 10 * 1000, + headers: { + Accept: 'application/json, text/plain, */*', + 'Content-Type': 'application/json', + 'X-Requested-With': 'XMLHttpRequest', + }, + withCredentials: true, + }); } async lifePayPhoneMesssageCodeLogin(body: PhoneMesssageCodeLoginInput, options?: RequestConfig) { @@ -24,6 +34,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 || {}), }); @@ -111,13 +129,108 @@ ...(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', + }, + data: body, + ...(options || {}), + }); + } + + /** 鑾峰彇鎴戠殑鍏ㄩ儴鎴峰彿鍒楄〃 POST /api/LifePay/GetUserAccountAllList */ + async getUserAccountAllList(body: QueryUserAccountAllListInput, options?: RequestConfig) { + return this.request<UserAccountListOutput[]>('/api/LifePay/GetUserAccountAllList', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); + } + + /** 鑾峰彇鎴戠殑鎴峰彿鍒楄〃 POST /api/LifePay/GetUserAccountList */ + async getUserAccountList(body: QueryUserAccountListInput, options?: RequestConfig) { + return this.request<UserAccountListOutputPageOutput>('/api/LifePay/GetUserAccountList', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); + } + + /** 娣诲姞鎴栦慨鏀规垜鐨勬埛鍙� POST /api/LifePay/AddUpdateUserAccount */ + async addUpdateUserAccount(body: AddUpdateUserAccountInput, options?: RequestConfig) { + return this.request<number>('/api/LifePay/AddUpdateUserAccount', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); + } + + /** 鍒涘缓鐢熸椿缂磋垂鐕冩皵璁㈠崟 POST /api/LifePay/CreateLifePayGasOrder */ + async createLifePayGasOrder(body: LifeGasDataCreateLifePayOrderInput, options?: RequestConfig) { + return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayGasOrder', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); + } + + /** 鑾峰彇鐕冩皵闈㈠�� GET /api/LifePay/GetGasParValue */ + async getGasParValue(options?: RequestConfig) { + return this.request<GasParValueResponse>('/api/LifePay/GetGasParValue', { + method: 'GET', + ...(options || {}), + }); + } + + /** 鐢ㄦ埛鍙戣捣鐢熸椿缂磋垂閫�娆� POST /api/LifePay/RefundUserLifePayOrder */ + async refundUserLifePayOrder(body: RefundUserLifePayOrderInput, options?: RequestConfig) { + return this.request<number>('/api/LifePay/RefundUserLifePayOrder', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + data: body, + ...(options || {}), + }); + } } export interface PhoneMesssageCodeLoginInput { /** 鎵嬫満鍙� */ phoneNumber: string; /** 楠岃瘉鐮� */ - code: string; + // code: string; } export interface LifePayRateListOutput { @@ -281,4 +394,175 @@ orderParamDetailJsonStr?: string; /** 涓嬪崟鏃堕棿 */ creationTime?: string; + /** 閫�娆炬椂闂� */ + 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; + payAppId?: string; +} + +export interface ModelPaymentMiniPay { + nonceStr?: string; + package?: string; + signType?: string; + paySign?: string; + timestamp?: string; + timeExpire?: string; + message?: string; +} + +export interface QueryUserAccountAllListInput { + /** 鐢ㄦ埛Id */ + userId?: string; + lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum; +} + +export interface UserAccountListOutput { + id?: string; + lifePayType?: LifeRechargeConstants.LifePayOrderTypeEnum; + /** 杩愯惀鍟� */ + operators?: string; + /** 鎵嬫満鍙�/鎴峰彿 */ + content?: string; + /** 鐪� */ + province?: string; + /** 甯� */ + city?: string; + /** 鎷撳睍瀛楁锛堢數璐圭被鍨嬶級 */ + extraProperties?: string; + /** 澶囨敞 */ + remark?: string; + /** 鍒涘缓鏃堕棿 */ + creationTime?: string; + isDeleted?: boolean; +} + +export interface AddUpdateUserAccountInput { + id?: string; + /** 鐢ㄦ埛缂栧彿 */ + userId?: string; + lifePayType?: LifeRechargeConstants.LifePayOrderTypeEnum; + /** 杩愯惀鍟� */ + operators?: string; + /** 鎵嬫満鍙�/鎴峰彿 */ + content?: string; + /** 鐪� */ + province?: string; + /** 甯� */ + city?: string; + /** 鎷撳睍瀛楁锛堢數璐圭被鍨嬶級 */ + extraProperties?: string; + /** 澶囨敞 */ + remark?: string; +} + +export interface LifeGasDataCreateLifePayOrderInput { + userId?: string; + productData?: LifeGasData; +} + +export interface LifeGasData { + /** 鍏呭�奸潰棰濓紝鍗曚綅涓哄厓銆� */ + parValue: number; + /** 澶╃劧姘斿叕鍙哥被鍨嬶紝"zhong_ran"浠h〃涓噧鐕冩皵锛�"bei_jing"浠h〃鍖椾含鐕冩皵銆� */ + gasOrgType: string; + /** 鐕冩皵鎴峰彿 */ + gasAccount: string; + /** 鐪佷唤 */ + province: string; + /** 鍩庡競 */ + city?: string; +} + +export interface GasParValueResponse { + success?: boolean; + requestNo?: string; + partnerId?: string; + service?: string; + version?: string; + protocol?: string; + context?: string; + ext?: any; + code?: string; + message?: string; + detail?: string; + gasParValue?: GasParValueOutput; +} + +export interface GasParValueOutput { + gasOrgName?: string; + gasOrgCode?: string; + parValue?: string[]; + rate?: number; + comments?: string; +} + +export interface RefundUserLifePayOrderInput { + id?: string; + /** 鐢ㄦ埛Id */ + userId?: string; + refundApplyRemark?: string; +} + +export interface QueryUserAccountListInput { + pageModel?: Pagination; + /** 鐢ㄦ埛Id */ + userId?: string; + lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum; +} + +export interface UserAccountListOutputPageOutput { + pageModel?: Pagination; + objectData?: any; + data?: UserAccountListOutput[]; } -- Gitblit v1.9.1