zhengyiming
2025-03-12 8525b5c780d8855eca89c46790627c00b3d83c79
packages/core/src/lifeRechargeServices.ts
@@ -1,15 +1,36 @@
import { BlLifeRechargeServicesOptions } from './types';
import { LifeRechargeConstants } from './lifeRechargeConstants';
import { Request, IRequest } from 'senior-request';
import { BlLifeRecharge } from './lifeRecharge';
export interface RequestConfig {}
export class BlLifeRechargeServices<TResponse = any, TRequestOptions = any> {
  private request: IRequest;
  constructor({ axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>) {
  ctx: BlLifeRecharge<TResponse, TRequestOptions>;
  constructor(
    ctx: BlLifeRecharge<TResponse, TRequestOptions>,
    { axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>
  ) {
    this.ctx = ctx;
    this.request = Request.create({
      ...axiosConfig,
      // baseURL: process.env.NODE_ENV === 'development' ? '/' : 'https://api.81812333.com',
      requestInterceptors: [
        [
          (config) => {
            if (config.params) {
              config.params.checkChannelId = this.ctx.accountModel.channlesNum;
            }
            if (config.data) {
              config.data.checkChannelId = this.ctx.accountModel.channlesNum;
            }
            return config;
          },
        ],
        ...axiosConfig.requestInterceptors,
      ],
      timeout: 10 * 1000,
      headers: {
        Accept: 'application/json, text/plain, */*',
@@ -40,25 +61,37 @@
  }
  /** 获取电费充值区域 GET /api/LifePay/GetElectricSupportArea */
  async getElectricSupportArea(options?: RequestConfig) {
  async getElectricSupportArea(body: ChannelsBaseInput, options?: RequestConfig) {
    return this.request<ElectricSupportAreaResponse>('/api/LifePay/GetElectricSupportArea', {
      method: 'GET',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 获取电费面值 GET /api/LifePay/GetElectricParValue */
  async getElectricParValue(options?: RequestConfig) {
  /** 获取电费面值 POST /api/LifePay/GetElectricParValue */
  async getElectricParValue(body: ChannelsBaseInput, options?: RequestConfig) {
    return this.request<ElectricParValueResponse>('/api/LifePay/GetElectricParValue', {
      method: 'GET',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 获取话费面值 GET /api/LifePay/GetPhoneParValue */
  async getPhoneParValue(options?: RequestConfig) {
  async getPhoneParValue(body: ChannelsBaseInput, options?: RequestConfig) {
    return this.request<PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', {
      method: 'GET',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
@@ -94,14 +127,15 @@
  }
  /** 根据订单号获取支付状态 GET /api/LifePay/GetPayStatusByOrderNo */
  async getPayStatusByOrderNo(params: APIgetPayStatusByOrderNoParams, options?: RequestConfig) {
  async getPayStatusByOrderNo(body: GetPayStatusByOrderNoInput, options?: RequestConfig) {
    return this.request<LifeRechargeConstants.LifePayStatusEnum>(
      '/api/LifePay/GetPayStatusByOrderNo',
      {
        method: 'GET',
        params: {
          ...params,
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
        },
        data: body,
        ...(options || {}),
      }
    );
@@ -206,9 +240,13 @@
  }
  /** 获取燃气面值 GET /api/LifePay/GetGasParValue */
  async getGasParValue(options?: RequestConfig) {
  async getGasParValue(body: ChannelsBaseInput, options?: RequestConfig) {
    return this.request<GasParValueResponse>('/api/LifePay/GetGasParValue', {
      method: 'GET',
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
@@ -221,6 +259,59 @@
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
  /** 删除我的户号 POST /api/LifePay/DeleteUserAccount */
  async deleteUserAccount(
    // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
    params: APIdeleteUserAccountParams,
    options?: RequestConfig
  ) {
    return this.request<number>('/api/LifePay/DeleteUserAccount', {
      method: 'POST',
      params: {
        ...params,
      },
      ...(options || {}),
    });
  }
  /** 获取我的户号详情 GET /api/LifePay/GetUserAccountDetail */
  async getUserAccountDetail(
    // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
    params: APIgetUserAccountDetailParams,
    options?: RequestConfig
  ) {
    return this.request<UserAccountOutput>('/api/LifePay/GetUserAccountDetail', {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    });
  }
  /** 获取我的订单详情 GET /api/LifePay/GetUserLifePayOrderDetail */
  async getUserLifePayOrderDetail(
    // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
    params: APIgetUserLifePayOrderDetailParams,
    options?: RequestConfig
  ) {
    return this.request<UserLifePayOrderOutput>('/api/LifePay/GetUserLifePayOrderDetail', {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    });
  }
  /** 搜索管理--列表(区域管理) GET /api/Area/GetRegionalManagementList */
  async getRegionalManagementList(options?: RequestConfig) {
    return this.request<AreaInfo[]>('/api/Area/GetRegionalManagementList', {
      method: 'GET',
      ...(options || {}),
    });
  }
@@ -287,6 +378,8 @@
export interface LifePhoneDataCreateLifePayOrderInput {
  userId?: string;
  /** 渠道Id */
  channelId?: string;
  productData?: LifePhoneData;
}
@@ -307,6 +400,8 @@
export interface LifeElectricDataCreateLifePayOrderInput {
  userId?: string;
  /** 渠道Id */
  channelId?: string;
  productData?: LifeElectricData;
}
@@ -396,6 +491,12 @@
  creationTime?: string;
  /** 退款时间 */
  refundTime?: string;
  /** 退款凭证 */
  refundCredentialsImgUrl?: string;
  refundApplyRemark?: string;
  refundCheckRemark?: string;
  /** 渠道流水号 */
  acoolyOrderNo?: string;
}
export interface ElectricSupportAreaResponse {
@@ -508,6 +609,8 @@
export interface LifeGasDataCreateLifePayOrderInput {
  userId?: string;
  /** 渠道Id */
  channelId?: string;
  productData?: LifeGasData;
}
@@ -536,7 +639,7 @@
  code?: string;
  message?: string;
  detail?: string;
  gasParValue?: GasParValueOutput;
  gasParValue?: GasParValueOutput[];
}
export interface GasParValueOutput {
@@ -566,3 +669,58 @@
  objectData?: any;
  data?: UserAccountListOutput[];
}
export interface APIdeleteUserAccountParams {
  id?: string;
}
export interface APIgetUserAccountDetailParams {
  id?: string;
}
export interface UserAccountOutput {
  id?: string;
  lifePayType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 运营商 */
  operators?: string;
  /** 手机号/户号 */
  content?: string;
  /** 省 */
  province?: string;
  /** 市 */
  city?: string;
  /** 拓展字段(电费类型) */
  extraProperties?: string;
  /** 备注 */
  remark?: string;
  /** 创建时间 */
  creationTime?: string;
  isDeleted?: boolean;
}
export interface APIgetUserLifePayOrderDetailParams {
  orderNo?: string;
}
export interface ChannelsBaseInput {
  checkChannelId?: string;
}
export interface AreaInfo {
  areaCode?: number;
  parentId?: number;
  areaName?: string;
  /** 1省 2市 3区 4镇 */
  layer?: number;
  sort?: number;
  children?: AreaInfo[];
  /** 简易拼音 */
  simpleSpelling?: string;
  /** 快速检索 */
  quickQuery?: string;
}
export interface GetPayStatusByOrderNoInput {
  checkChannelId?: string;
  orderNo?: string;
}