zhengyiming
2025-03-06 ad032ad0889156572271868601d6665e560318b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
import { BlLifeRechargeServicesOptions } from './types';
import { LifeRechargeConstants } from './lifeRechargeConstants';
import { Request, IRequest } from 'senior-request';
 
export interface RequestConfig {}
 
export class BlLifeRechargeServices<TResponse = any, TRequestOptions = any> {
  private request: IRequest;
  constructor({ axiosConfig }: BlLifeRechargeServicesOptions<TResponse, TRequestOptions>) {
    this.request = Request.create({
      ...axiosConfig,
      // baseURL: isWeb ? process.env.BASE_URL_H5 : process.env.BASE_URL,
      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) {
    return this.request<string>('/api/Account/LifePayPhoneMesssageCodeLogin', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
 
  /** 获取折扣 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 || {}),
    });
  }
 
  /** 获取电费面值 GET /api/LifePay/GetElectricParValue */
  async getElectricParValue(options?: RequestConfig) {
    return this.request<ElectricParValueResponse>('/api/LifePay/GetElectricParValue', {
      method: 'GET',
      ...(options || {}),
    });
  }
 
  /** 获取话费面值 GET /api/LifePay/GetPhoneParValue */
  async getPhoneParValue(options?: RequestConfig) {
    return this.request<PhoneParValueResponse>('/api/LifePay/GetPhoneParValue', {
      method: 'GET',
      ...(options || {}),
    });
  }
 
  /** 创建生活缴费话费订单 POST /api/LifePay/CreateLifePayPhoneOrder */
  async createLifePayPhoneOrder(
    body: LifePhoneDataCreateLifePayOrderInput,
    options?: RequestConfig
  ) {
    return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayPhoneOrder', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
 
  /** 创建生活缴费电费订单 POST /api/LifePay/CreateLifePayElectricOrder */
  async createLifePayElectricOrder(
    body: LifeElectricDataCreateLifePayOrderInput,
    options?: RequestConfig
  ) {
    return this.request<CreateLifePayOrderOutput>('/api/LifePay/CreateLifePayElectricOrder', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
 
  /** 根据订单号获取支付状态 GET /api/LifePay/GetPayStatusByOrderNo */
  async getPayStatusByOrderNo(params: APIgetPayStatusByOrderNoParams, options?: RequestConfig) {
    return this.request<LifeRechargeConstants.LifePayStatusEnum>(
      '/api/LifePay/GetPayStatusByOrderNo',
      {
        method: 'GET',
        params: {
          ...params,
        },
        ...(options || {}),
      }
    );
  }
 
  async setLifePayOrderPayType(body: SetLifePayOrderPayTypeInput, options?: RequestConfig) {
    return this.request<string>('/api/LifePay/SetLifePayOrderPayType', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }
 
  /** 获取我的订单分页数据 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(
    // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
    params: APIgetLifePayWxIndentityParams,
    options?: RequestConfig
  ) {
    return this.request<WxMiniAppIndentityInfo>('/api/Account/GetLifePayWxIndentity', {
      method: 'GET',
      params: {
        ...params,
      },
      ...(options || {}),
    });
  }
 
  /** 获取微信支付的JSAPI 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 || {}),
    });
  }
}
 
export interface PhoneMesssageCodeLoginInput {
  /** 手机号 */
  phoneNumber: string;
  /** 验证码 */
  // code: string;
}
 
export interface LifePayRateListOutput {
  rateType?: LifeRechargeConstants.LifePayRateTypeEnum;
  rate?: number;
}
 
export interface ElectricParValueResponse {
  success?: string;
  requestNo?: string;
  partnerId?: string;
  service?: string;
  version?: string;
  protocol?: string;
  context?: string;
  ext?: string;
  code?: string;
  message?: string;
  detail?: string;
  electricParValue?: ElectricParValueOutput[];
}
 
export interface ElectricParValueOutput {
  electricType?: string;
  areaName?: string;
  parValue?: string;
  rate?: number;
  comments?: string;
}
 
export interface PhoneParValueResponse {
  success?: boolean;
  requestNo?: string;
  partnerId?: string;
  service?: string;
  version?: string;
  protocol?: string;
  context?: string;
  ext?: any;
  code?: string;
  message?: string;
  detail?: string;
  phoneParValue?: PhoneParValueOutput[];
}
 
export interface PhoneParValueOutput {
  ispCode?: string;
  ispName?: string;
  parValue?: string[];
  rate?: number;
  phoneSection?: string;
  comments?: string;
}
 
export interface LifePhoneDataCreateLifePayOrderInput {
  userId?: string;
  productData?: LifePhoneData;
}
 
export interface LifePhoneData {
  /** 运营商编码,例如:"yidong", "dianxin", "liantong"。 */
  ispCode: string;
  /** 充值面额,单位为元。测试账户:parValue=100:缴费成功,parValue>100:缴费失败。 */
  parValue: number;
  /** 手机号。 */
  phone: string;
  /** 机主名称(电信手机号必填) */
  name?: string;
}
 
export interface CreateLifePayOrderOutput {
  orderNo?: string;
}
 
export interface LifeElectricDataCreateLifePayOrderInput {
  userId?: string;
  productData?: LifeElectricData;
}
 
export interface LifeElectricData {
  /** 充值面额,单位为元。 */
  parValue: number;
  /** 电网类型,例如:"guowang"代表国家电网,"nanwang"代表南方电网。 */
  electricType: string;
  /** 电费类型,国网必传:住宅、企事业、店铺三个选项。 */
  electricAccountType: string;
  /** 电费户号。 */
  electricAccount: string;
  /** 省份。 */
  province: string;
  /** 城市。 */
  city: string;
  /** 客户身份证后6位,南网必传。 */
  sixID?: string;
}
 
export interface APIgetPayStatusByOrderNoParams {
  orderNo?: string;
}
 
export interface SetLifePayOrderPayTypeInput {
  orderNo: string;
  lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
}
 
export interface QueryLifePayOrderListInput {
  pageModel?: Pagination;
  lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 开始支付时间 */
  beginPayTime?: string;
  /** 结束支付时间 */
  endPayTime?: string;
  payStatus?: LifeRechargeConstants.LifePayStatusEnum;
  lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
  /** 开始完成时间 */
  beginFinishTime?: string;
  /** 结束完成时间 */
  endFinishTime?: string;
  /** 用户Id */
  userId?: string;
}
 
export interface Pagination {
  rows?: number;
  page?: number;
  orderInput?: OrderInput[];
  totalCount?: number;
  totalPage?: number;
}
 
export interface OrderInput {
  property?: string;
  order?: any;
}
 
export interface UserLifePayOrderOutputPageOutput {
  pageModel?: Pagination;
  objectData?: any;
  data?: UserLifePayOrderOutput[];
}
 
export interface UserLifePayOrderOutput {
  id?: string;
  lifePayType?: LifeRechargeConstants.LifePayTypeEnum;
  lifePayOrderType?: LifeRechargeConstants.LifePayOrderTypeEnum;
  /** 订单号 */
  orderNo?: string;
  /** 充值金额 */
  rechargeAmount?: number;
  /** 优惠金额 */
  discountAmount?: number;
  /** 实付金额 */
  payAmount?: number;
  /** 支付时间 */
  payTime?: string;
  payStatus?: LifeRechargeConstants.LifePayStatusEnum;
  lifePayOrderStatus?: LifeRechargeConstants.LifePayOrderStatusEnum;
  /** 完成时间 */
  finishTime?: string;
  /** 订单详细数据 */
  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;
  /** 小程序OpenId */
  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;
}