@huyooo/ui 0.13.1 → 0.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/{AuthkitAppSetting-p_ZzaAK3.js → AuthkitAppSetting-EL2ZvAVT.js} +6 -6
  2. package/dist/{AuthkitGithubBinding-Cwly1un7.js → AuthkitGithubBinding-Ba9sbNEh.js} +6 -6
  3. package/dist/{Clipboard-k0jtK4CJ.js → Clipboard-CdJtMvg6.js} +1 -1
  4. package/dist/{Contact-BGZm3i5l.js → Contact-Z2VFVeKK.js} +2 -2
  5. package/dist/{FeedbackItem-opB6y-f2.js → FeedbackItem-B_MDdk4s.js} +3 -3
  6. package/dist/{FeedbackModal-9CNnFC6B.js → FeedbackModal-qrcBDDQM.js} +3 -3
  7. package/dist/{MessageHandle-BZBT7Ii1.js → MessageHandle-Y96z-IXv.js} +2 -2
  8. package/dist/{MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-BbKvsNKj.js → MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-CfmjFcay.js} +2 -2
  9. package/dist/PaySubscriptions-C75OtmYw.js +1243 -0
  10. package/dist/{PricingPlans-CAKsTY8G.js → PricingPlans-DCYIVuuT.js} +5 -5
  11. package/dist/{ReferrerReferees-Hh88qOrp.js → ReferrerReferees-8eSsuPfa.js} +4 -4
  12. package/dist/{Upload.vue_vue_type_script_setup_true_lang-DOHui-lA.js → Upload.vue_vue_type_script_setup_true_lang-BAibfVEN.js} +1 -1
  13. package/dist/{UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-24U6PK1y.js → UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-BEVmBNlU.js} +39 -39
  14. package/dist/{WidthContainer-B2cjwKvY.js → WidthContainer-Dqf_-qGk.js} +8 -8
  15. package/dist/{apiClients-B8bOvWw_.js → apiClients-D56ALwwO.js} +2 -2
  16. package/dist/authkit.js +9 -9
  17. package/dist/common.js +1 -1
  18. package/dist/composables/Billing/useBillingStatusOptions.d.ts +93 -0
  19. package/dist/composables.d.ts +1 -0
  20. package/dist/composables.js +44 -36
  21. package/dist/feedback.js +3 -3
  22. package/dist/main.js +248 -240
  23. package/dist/message.js +3 -3
  24. package/dist/pay.d.ts +1 -0
  25. package/dist/pay.js +21 -13
  26. package/dist/privateCom.js +1 -1
  27. package/dist/referrer.js +1 -1
  28. package/dist/style.css +1 -1
  29. package/dist/types/api/billing.generated.d.ts +2252 -649
  30. package/dist/upload.js +2 -2
  31. package/dist/{useAuthkitAppsAuthPageInfo-6ncIP9RT.js → useAuthkitAppsAuthPageInfo-RMs8sOwk.js} +1 -1
  32. package/dist/{useAuthkitAuth-Bj8XxPtO.js → useAuthkitAuth-B8aO6aMa.js} +1 -1
  33. package/dist/{useAuthkitCreateAndUpdate-CUf8HARI.js → useAuthkitCreateAndUpdate-DkiLs143.js} +1 -1
  34. package/dist/{useAuthkitUsersProfile-CoQceogN.js → useAuthkitUsersProfile-CWAr0CNv.js} +2 -2
  35. package/dist/useBillingStatusOptions-CottFcAr.js +127 -0
  36. package/dist/{useDownloads-Dj91-I6H.js → useDownloads-DqF1USJ7.js} +1 -1
  37. package/dist/{useEnsureAuthenticated-MpHmn2co.js → useEnsureAuthenticated-D99GiwEk.js} +2 -2
  38. package/dist/{useLegalLinks-CVHYmza0.js → useLegalLinks-DRTOYp3n.js} +2 -2
  39. package/dist/{useMessageNotifications-Bstn2qtG.js → useMessageNotifications-CUpk6zCE.js} +1 -1
  40. package/dist/{useSEO-DU86KCMJ.js → useSEO-CUKPmGRx.js} +2 -2
  41. package/dist/{useSubscriptionCheckout-DNLuRGmx.js → useSubscriptionCheckout-CAgy1CFj.js} +2 -2
  42. package/dist/{useTableHandle-B9aFmwYM.js → useTableHandle-CCKjahT0.js} +1 -1
  43. package/dist/{useUploadCos-DTMIoW7p.js → useUploadCos-Bxctd4E6.js} +1 -1
  44. package/dist/user.js +1 -1
  45. package/package.json +1 -1
  46. package/dist/PaySubscriptions-Dxg7GZJx.js +0 -1194
@@ -87,6 +87,18 @@ export type Api = {
87
87
  return: any;
88
88
  };
89
89
  };
90
+ updateSort: {
91
+ /** 批量更新产品排序 */
92
+ post: {
93
+ body: {
94
+ items: {
95
+ id: string;
96
+ displayOrder: number;
97
+ }[];
98
+ };
99
+ return: any;
100
+ };
101
+ };
90
102
  listActive: {
91
103
  /** 获取定价页面可用产品列表(公开) */
92
104
  post: {
@@ -241,6 +253,15 @@ export type Api = {
241
253
  return: any;
242
254
  };
243
255
  };
256
+ userDetail: {
257
+ /** 管理员查询指定用户的订阅、免费体验、配额、积分和最近消费记录 */
258
+ post: {
259
+ body: {
260
+ userId: string;
261
+ };
262
+ return: any;
263
+ };
264
+ };
244
265
  find: {
245
266
  /** 分页查询订阅列表(管理端) */
246
267
  post: {
@@ -251,11 +272,32 @@ export type Api = {
251
272
  userId?: string;
252
273
  productId?: string;
253
274
  status?: string;
275
+ cancelAtPeriodEnd?: boolean;
254
276
  };
255
277
  };
256
278
  return: any;
257
279
  };
258
280
  };
281
+ history: {
282
+ /** 查询单个订阅的权益变化历史(管理端) */
283
+ post: {
284
+ body: {
285
+ subscriptionId: string;
286
+ };
287
+ return: any;
288
+ };
289
+ };
290
+ trend: {
291
+ /** 获取订阅各状态的历史趋势数据 */
292
+ post: {
293
+ body: {
294
+ startTime: string;
295
+ endTime: string;
296
+ granularity: "day" | "week" | "month";
297
+ };
298
+ return: any;
299
+ };
300
+ };
259
301
  count: {
260
302
  /** 供其他服务查询用户订阅数量 */
261
303
  post: {
@@ -276,6 +318,15 @@ export type Api = {
276
318
  return: any;
277
319
  };
278
320
  };
321
+ notify: {
322
+ alipay: {
323
+ /** 支付宝订阅支付回调通知 */
324
+ post: {
325
+ body: Record<string, unknown>;
326
+ return: any;
327
+ };
328
+ };
329
+ };
279
330
  };
280
331
  quotas: {
281
332
  create: {
@@ -332,11 +383,14 @@ export type Api = {
332
383
  };
333
384
  };
334
385
  check: {
335
- /** 检查用户配额是否足够 */
386
+ /** 供其他服务检查配额是否足够,不写入使用量 */
336
387
  post: {
337
388
  body: {
389
+ appId: string;
390
+ userId: string;
338
391
  featureKey: string;
339
- amount?: number;
392
+ quantity?: number;
393
+ used?: number;
340
394
  };
341
395
  return: any;
342
396
  };
@@ -347,13 +401,12 @@ export type Api = {
347
401
  return: any;
348
402
  };
349
403
  };
350
- };
351
- usageRecords: {
352
- record: {
353
- /** 记录用户功能使用量 */
404
+ reserve: {
405
+ /** 供其他服务检查并预占配额 */
354
406
  post: {
355
407
  body: {
356
- userId?: string;
408
+ appId: string;
409
+ userId: string;
357
410
  featureKey: string;
358
411
  quantity?: number;
359
412
  metadata?: Record<string, unknown>;
@@ -361,40 +414,109 @@ export type Api = {
361
414
  return: any;
362
415
  };
363
416
  };
364
- recordWithQuotaCheck: {
365
- /** 记录使用量并检查配额 */
417
+ commit: {
418
+ /** 供其他服务确认已预占配额 */
419
+ post: {
420
+ body: {
421
+ usageRecordId: string;
422
+ };
423
+ return: any;
424
+ };
425
+ };
426
+ release: {
427
+ /** 供其他服务释放已预占配额 */
428
+ post: {
429
+ body: {
430
+ usageRecordId: string;
431
+ };
432
+ return: any;
433
+ };
434
+ };
435
+ };
436
+ trials: {
437
+ current: {
438
+ /** 获取当前用户免费体验状态 */
439
+ post: {
440
+ return: any;
441
+ };
442
+ };
443
+ start: {
444
+ /** 领取当前应用的免费体验权益 */
445
+ post: {
446
+ body: {
447
+ priceId?: string;
448
+ };
449
+ return: any;
450
+ };
451
+ };
452
+ };
453
+ newUserDefaults: {
454
+ find: {
455
+ /** 查询注册后默认授予的免费权益配置 */
456
+ post: {
457
+ return: any;
458
+ };
459
+ };
460
+ update: {
461
+ /** 更新注册后默认授予的免费权益配置 */
462
+ post: {
463
+ body: {
464
+ autoGrantFreePriceOnSignup: boolean;
465
+ defaultFreePriceId?: string;
466
+ };
467
+ return: any;
468
+ };
469
+ };
470
+ grantMissingFreeEntitlements: {
471
+ /** 给当前应用下没有活跃订阅/体验的用户补发默认免费价格方案 */
472
+ post: {
473
+ body: {
474
+ dryRun?: boolean;
475
+ userIds?: string[];
476
+ };
477
+ return: any;
478
+ };
479
+ };
480
+ };
481
+ usageRecords: {
482
+ checkQuota: {
483
+ /** 检查配额是否足够,不写入使用量 */
366
484
  post: {
367
485
  body: {
368
486
  userId?: string;
369
487
  featureKey: string;
370
488
  quantity?: number;
371
- metadata?: Record<string, unknown>;
489
+ used?: number;
372
490
  };
373
491
  return: any;
374
492
  };
375
493
  };
376
- checkQuota: {
377
- /** 预检查配额是否足够(不记录使用量) */
494
+ reserveQuota: {
495
+ /** 检查配额并写入 reserved 使用量记录 */
378
496
  post: {
379
497
  body: {
380
498
  userId?: string;
381
499
  featureKey: string;
382
500
  quantity?: number;
501
+ metadata?: Record<string, unknown>;
383
502
  };
384
503
  return: any;
385
504
  };
386
505
  };
387
- batchRecord: {
388
- /** 批量记录使用量 */
506
+ commitQuota: {
507
+ /** reserved 使用量记录确认成 committed */
389
508
  post: {
390
509
  body: {
391
- records: {
392
- userId: string;
393
- featureKey: string;
394
- quantity?: number;
395
- metadata?: Record<string, unknown>;
396
- timestamp?: string;
397
- }[];
510
+ usageRecordId: string;
511
+ };
512
+ return: any;
513
+ };
514
+ };
515
+ releaseQuota: {
516
+ /** 将 reserved 使用量记录释放成 released */
517
+ post: {
518
+ body: {
519
+ usageRecordId: string;
398
520
  };
399
521
  return: any;
400
522
  };
@@ -408,6 +530,7 @@ export type Api = {
408
530
  where: {
409
531
  userId?: string;
410
532
  featureKey?: string;
533
+ status?: string;
411
534
  startTime?: string;
412
535
  endTime?: string;
413
536
  };
@@ -422,6 +545,7 @@ export type Api = {
422
545
  current?: number;
423
546
  pageSize?: number;
424
547
  featureKey?: string;
548
+ status?: string;
425
549
  startTime?: string;
426
550
  endTime?: string;
427
551
  };
@@ -441,22 +565,10 @@ export type Api = {
441
565
  return: any;
442
566
  };
443
567
  };
444
- getTrendChart: {
445
- /** 获取使用量趋势图表数据 */
446
- post: {
447
- body: {
448
- featureKey?: string;
449
- startTime: string;
450
- endTime: string;
451
- granularity: "hour" | "day" | "week" | "month";
452
- };
453
- return: any;
454
- };
455
- };
456
568
  };
457
569
  invoices: {
458
570
  find: {
459
- /** 分页查询发票列表(管理端) */
571
+ /** 分页查询订阅账单列表(管理端) */
460
572
  post: {
461
573
  body: {
462
574
  current: number;
@@ -473,7 +585,7 @@ export type Api = {
473
585
  };
474
586
  };
475
587
  findOne: {
476
- /** 根据 ID 查询发票详情 */
588
+ /** 根据 ID 查询订阅账单详情 */
477
589
  post: {
478
590
  body: {
479
591
  id: string;
@@ -482,7 +594,7 @@ export type Api = {
482
594
  };
483
595
  };
484
596
  my: {
485
- /** 查询当前用户的发票列表 */
597
+ /** 查询当前用户的订阅账单列表 */
486
598
  post: {
487
599
  body: {
488
600
  current?: number;
@@ -492,8 +604,18 @@ export type Api = {
492
604
  return: any;
493
605
  };
494
606
  };
607
+ cancel: {
608
+ /** 取消当前用户自己的待支付订阅账单 */
609
+ post: {
610
+ body: {
611
+ id: string;
612
+ reason?: string;
613
+ };
614
+ return: any;
615
+ };
616
+ };
495
617
  pay: {
496
- /** 支付我的账单 */
618
+ /** 为当前用户的待支付账单生成支付链接 */
497
619
  post: {
498
620
  body: {
499
621
  id: string;
@@ -501,8 +623,17 @@ export type Api = {
501
623
  return: any;
502
624
  };
503
625
  };
626
+ verifyPayment: {
627
+ /** 查询支付宝订单状态,如果已支付则完成订阅入账 */
628
+ post: {
629
+ body: {
630
+ orderId: string;
631
+ };
632
+ return: any;
633
+ };
634
+ };
504
635
  void: {
505
- /** 作废发票 */
636
+ /** 管理端作废待支付订阅账单 */
506
637
  post: {
507
638
  body: {
508
639
  id: string;
@@ -512,7 +643,7 @@ export type Api = {
512
643
  };
513
644
  };
514
645
  statistics: {
515
- /** 获取发票统计数据 */
646
+ /** 获取订阅账单统计数据 */
516
647
  post: {
517
648
  body: {
518
649
  startTime?: string;
@@ -532,6 +663,22 @@ export type Api = {
532
663
  return: any;
533
664
  };
534
665
  };
666
+ revenueByProduct: {
667
+ /** 获取按产品分布的收入数据 */
668
+ post: {
669
+ body: {
670
+ startTime?: string;
671
+ endTime?: string;
672
+ };
673
+ return: any;
674
+ };
675
+ };
676
+ statusOptions: {
677
+ /** 获取订阅账单状态下拉选项与展示文案 */
678
+ post: {
679
+ return: any;
680
+ };
681
+ };
535
682
  stats: {
536
683
  /** 供其他服务查询发票统计数据 */
537
684
  post: {
@@ -582,6 +729,19 @@ export type Api = {
582
729
  return: any;
583
730
  };
584
731
  };
732
+ consume: {
733
+ /** 按调用方计算好的积分数消费积分 */
734
+ post: {
735
+ body: {
736
+ userId: string;
737
+ amount: number;
738
+ requestId?: string;
739
+ description?: string;
740
+ metadata?: Record<string, unknown>;
741
+ };
742
+ return: any;
743
+ };
744
+ };
585
745
  consumeByPrice: {
586
746
  /** 根据计价配置消费积分 */
587
747
  post: {
@@ -1155,913 +1315,2362 @@ export type Api = {
1155
1315
  };
1156
1316
  };
1157
1317
  };
1158
- webhooks: {
1159
- events: {
1160
- /** 获取所有可用的 Webhook 事件类型 */
1161
- get: {
1162
- return: any;
1163
- };
1164
- ':id': {
1165
- /** 获取指定分类的 Webhook 事件 */
1166
- get: {
1167
- params: {
1168
- category: string;
1169
- };
1170
- return: any;
1318
+ consumption: {
1319
+ trend: {
1320
+ /** 聚合服务消费的趋势数据 */
1321
+ post: {
1322
+ body: {
1323
+ startDate?: string;
1324
+ endDate?: string;
1325
+ limit?: number;
1171
1326
  };
1327
+ return: any;
1172
1328
  };
1173
1329
  };
1174
- categories: {
1175
- /** 获取所有 Webhook 事件分类 */
1176
- get: {
1330
+ overview: {
1331
+ /** 聚合服务消费的概览数据 */
1332
+ post: {
1333
+ body: {
1334
+ startDate?: string;
1335
+ endDate?: string;
1336
+ };
1177
1337
  return: any;
1178
1338
  };
1179
1339
  };
1180
1340
  };
1181
- notify: {
1182
- alipay: {
1183
- /** 支付宝订阅支付回调通知 */
1341
+ pointsRecharge: {
1342
+ packages: {
1343
+ /** 获取可用的充值套餐列表 */
1184
1344
  post: {
1185
- body: Record<string, unknown>;
1186
1345
  return: any;
1187
1346
  };
1188
1347
  };
1189
- };
1190
- };
1191
- /** API 客户端类型(提供完整的 IDE 智能提示) */
1192
- export interface ApiClient {
1193
- health: {
1194
- get: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1195
- };
1196
- 'api-spec': {
1197
- /** 获取 API 规范,用于类型同步 */
1198
- get: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1199
- };
1200
- products: {
1201
- create: {
1202
- /** 创建新产品 */
1203
- post: (body: {
1204
- name: string;
1205
- description?: string;
1206
- features: {
1207
- key: string;
1208
- name: string;
1209
- description?: string;
1210
- type: "boolean";
1211
- value?: boolean;
1212
- highlight?: boolean;
1213
- }[];
1214
- metadata?: Record<string, unknown>;
1215
- displayOrder?: number;
1216
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1348
+ createOrder: {
1349
+ /** 创建积分充值订单 */
1350
+ post: {
1351
+ body: {
1352
+ packageId: string;
1353
+ payType: "alipay" | "weixinpay";
1354
+ };
1355
+ return: any;
1356
+ };
1217
1357
  };
1218
- delete: {
1219
- /** 删除产品 */
1220
- post: (body: {
1221
- id: string;
1222
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1358
+ createQRCodeOrder: {
1359
+ /** 创建支付宝扫码支付订单(当面付) */
1360
+ post: {
1361
+ body: {
1362
+ packageId: string;
1363
+ };
1364
+ return: any;
1365
+ };
1223
1366
  };
1224
- update: {
1225
- /** 更新产品信息 */
1226
- post: (body: {
1227
- id: string;
1228
- name?: string;
1229
- description?: string;
1230
- features?: {
1231
- key: string;
1232
- name: string;
1233
- description?: string;
1234
- type: "boolean";
1235
- value?: boolean;
1236
- highlight?: boolean;
1237
- }[];
1238
- status?: "active" | "archived";
1239
- metadata?: Record<string, unknown>;
1240
- displayOrder?: number;
1241
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1367
+ orders: {
1368
+ /** 查询用户的充值订单记录 */
1369
+ post: {
1370
+ body: {
1371
+ status?: string;
1372
+ page?: number;
1373
+ pageSize?: number;
1374
+ };
1375
+ return: any;
1376
+ };
1242
1377
  };
1243
1378
  find: {
1244
- /** 分页查询产品列表 */
1245
- post: (body: {
1246
- current: number;
1247
- pageSize: number;
1248
- where: {
1249
- name?: string;
1379
+ /** 管理端分页查询全部积分充值订单 */
1380
+ post: {
1381
+ body: {
1382
+ current: number;
1383
+ pageSize: number;
1384
+ where: {
1385
+ userId?: string;
1386
+ status?: string;
1387
+ startTime?: string;
1388
+ endTime?: string;
1389
+ };
1390
+ };
1391
+ return: any;
1392
+ };
1393
+ };
1394
+ detail: {
1395
+ /** 管理端查询单个积分充值订单详情及操作时间线 */
1396
+ post: {
1397
+ body: {
1398
+ orderId: string;
1399
+ };
1400
+ return: any;
1401
+ };
1402
+ };
1403
+ adminStatistics: {
1404
+ /** 管理端积分充值订单统计 */
1405
+ post: {
1406
+ body: {
1407
+ startTime?: string;
1408
+ endTime?: string;
1409
+ };
1410
+ return: any;
1411
+ };
1412
+ };
1413
+ statistics: {
1414
+ /** 获取用户积分充值订单统计 */
1415
+ post: {
1416
+ body: {
1417
+ startTime?: string;
1418
+ endTime?: string;
1419
+ };
1420
+ return: any;
1421
+ };
1422
+ };
1423
+ statusOptions: {
1424
+ /** 获取积分充值订单状态下拉选项与展示文案 */
1425
+ post: {
1426
+ return: any;
1427
+ };
1428
+ };
1429
+ verifyPayment: {
1430
+ /** 查询支付宝订单状态,如果已支付则完成充值 */
1431
+ post: {
1432
+ body: {
1433
+ orderId: string;
1434
+ };
1435
+ return: any;
1436
+ };
1437
+ };
1438
+ notify: {
1439
+ alipay: {
1440
+ /** 支付宝积分充值回调通知 */
1441
+ post: {
1442
+ body: Record<string, unknown>;
1443
+ return: any;
1444
+ };
1445
+ };
1446
+ };
1447
+ };
1448
+ rechargePackage: {
1449
+ list: {
1450
+ /** 获取充值套餐列表(管理端) */
1451
+ post: {
1452
+ body: {
1453
+ includeDisabled?: boolean;
1454
+ };
1455
+ return: any;
1456
+ };
1457
+ };
1458
+ create: {
1459
+ /** 创建新的充值套餐 */
1460
+ post: {
1461
+ body: {
1462
+ name: string;
1463
+ price: number;
1464
+ points: number;
1465
+ bonus: number;
1466
+ description?: string;
1467
+ sort?: number;
1468
+ };
1469
+ return: any;
1470
+ };
1471
+ };
1472
+ update: {
1473
+ /** 更新充值套餐信息 */
1474
+ post: {
1475
+ body: {
1476
+ id: string;
1477
+ name?: string;
1478
+ price?: number;
1479
+ points?: number;
1480
+ bonus?: number;
1481
+ description?: string;
1482
+ sort?: number;
1483
+ enabled?: boolean;
1484
+ };
1485
+ return: any;
1486
+ };
1487
+ };
1488
+ delete: {
1489
+ /** 删除充值套餐 */
1490
+ post: {
1491
+ body: {
1492
+ id: string;
1493
+ };
1494
+ return: any;
1495
+ };
1496
+ };
1497
+ updateSort: {
1498
+ /** 批量更新套餐排序 */
1499
+ post: {
1500
+ body: {
1501
+ items: {
1502
+ id: string;
1503
+ sort: number;
1504
+ }[];
1505
+ };
1506
+ return: any;
1507
+ };
1508
+ };
1509
+ };
1510
+ refund: {
1511
+ apply: {
1512
+ /** 对已支付订单申请退款 */
1513
+ post: {
1514
+ body: {
1515
+ orderId: string;
1516
+ reason?: string;
1517
+ refundAmount?: number;
1518
+ };
1519
+ return: any;
1520
+ };
1521
+ };
1522
+ applySubscription: {
1523
+ /** 对已支付订阅账单申请退款 */
1524
+ post: {
1525
+ body: {
1526
+ invoiceId: string;
1527
+ reason?: string;
1528
+ refundAmount?: number;
1529
+ subscriptionAction?: "cancel_immediate" | "none";
1530
+ };
1531
+ return: any;
1532
+ };
1533
+ };
1534
+ approve: {
1535
+ /** 审批退款申请(通过或拒绝) */
1536
+ post: {
1537
+ body: {
1538
+ refundNo: string;
1539
+ action: "approve" | "reject";
1540
+ remark?: string;
1541
+ };
1542
+ return: any;
1543
+ };
1544
+ };
1545
+ execute: {
1546
+ /** 执行已审批的退款(调用支付宝/微信退款接口) */
1547
+ post: {
1548
+ body: {
1549
+ refundNo: string;
1550
+ };
1551
+ return: any;
1552
+ };
1553
+ };
1554
+ manual: {
1555
+ /** 管理员手动标记退款完成(用于线上接口故障或特殊情况) */
1556
+ post: {
1557
+ body: {
1558
+ refundNo: string;
1559
+ manualRefundNo?: string;
1560
+ remark: string;
1561
+ };
1562
+ return: any;
1563
+ };
1564
+ };
1565
+ list: {
1566
+ /** 查询退款记录列表 */
1567
+ post: {
1568
+ body: {
1569
+ page?: number;
1570
+ pageSize?: number;
1571
+ status?: string;
1572
+ sourceType?: "points_recharge" | "subscription_invoice";
1573
+ userId?: string;
1574
+ startDate?: string;
1575
+ endDate?: string;
1576
+ };
1577
+ return: any;
1578
+ };
1579
+ };
1580
+ detail: {
1581
+ /** 查询单个退款单详情 */
1582
+ post: {
1583
+ body: {
1584
+ refundNo: string;
1585
+ };
1586
+ return: any;
1587
+ };
1588
+ };
1589
+ stats: {
1590
+ /** 获取退款统计数据 */
1591
+ post: {
1592
+ body: {
1593
+ startDate?: string;
1594
+ endDate?: string;
1595
+ };
1596
+ return: any;
1597
+ };
1598
+ };
1599
+ syncStatus: {
1600
+ /** 手动同步单个退款单的支付宝退款状态 */
1601
+ post: {
1602
+ body: {
1603
+ refundNo: string;
1604
+ };
1605
+ return: any;
1606
+ };
1607
+ };
1608
+ statusOptions: {
1609
+ /** 获取退款单状态下拉选项与展示文案 */
1610
+ post: {
1611
+ return: any;
1612
+ };
1613
+ };
1614
+ };
1615
+ serviceDefinition: {
1616
+ list: {
1617
+ /** 获取应用的所有服务定义 */
1618
+ post: {
1619
+ body: {
1620
+ page?: number;
1621
+ pageSize?: number;
1622
+ };
1623
+ return: any;
1624
+ };
1625
+ };
1626
+ create: {
1627
+ /** 创建新的服务定义 */
1628
+ post: {
1629
+ body: {
1630
+ serviceType: string;
1631
+ name: string;
1632
+ description?: string;
1633
+ billingUnit: string;
1634
+ billingMode?: "event" | "continuous";
1635
+ };
1636
+ return: any;
1637
+ };
1638
+ };
1639
+ update: {
1640
+ /** 更新服务定义 */
1641
+ post: {
1642
+ body: {
1643
+ id: string;
1644
+ name?: string;
1645
+ description?: string;
1646
+ billingUnit?: string;
1647
+ billingMode?: "event" | "continuous";
1648
+ enabled?: boolean;
1649
+ };
1650
+ return: any;
1651
+ };
1652
+ };
1653
+ delete: {
1654
+ /** 删除服务定义 */
1655
+ post: {
1656
+ body: {
1657
+ id: string;
1658
+ };
1659
+ return: any;
1660
+ };
1661
+ };
1662
+ };
1663
+ pricingRule: {
1664
+ get: {
1665
+ /** 获取服务的定价规则 */
1666
+ post: {
1667
+ body: {
1668
+ serviceType: string;
1669
+ };
1670
+ return: any;
1671
+ };
1672
+ };
1673
+ save: {
1674
+ /** 创建或更新定价规则 */
1675
+ post: {
1676
+ body: {
1677
+ serviceType: string;
1678
+ tiers?: {
1679
+ minUsage: number;
1680
+ maxUsage: number | null;
1681
+ pricePerUnit: number;
1682
+ }[];
1683
+ flatPrice?: number | null;
1684
+ freeQuota?: number;
1685
+ profitMargin?: number;
1686
+ enabled?: boolean;
1687
+ };
1688
+ return: any;
1689
+ };
1690
+ };
1691
+ };
1692
+ usage: {
1693
+ report: {
1694
+ /** 上报服务用量,自动计费扣费 */
1695
+ post: {
1696
+ body: {
1697
+ serviceType: string;
1698
+ metadata: Record<string, unknown>;
1699
+ requestId?: string;
1700
+ };
1701
+ return: any;
1702
+ };
1703
+ };
1704
+ preview: {
1705
+ /** 按当前定价规则预估本次用量费用,不写入记录、不扣积分 */
1706
+ post: {
1707
+ body: {
1708
+ serviceType: string;
1709
+ metadata: Record<string, unknown>;
1710
+ freeQuotaOverride?: number;
1711
+ };
1712
+ return: any;
1713
+ };
1714
+ };
1715
+ stats: {
1716
+ /** 获取用量统计数据 */
1717
+ post: {
1718
+ body: {
1719
+ startDate?: string;
1720
+ endDate?: string;
1721
+ serviceType?: string;
1722
+ groupBy?: "day" | "service" | "user";
1723
+ };
1724
+ return: any;
1725
+ };
1726
+ };
1727
+ records: {
1728
+ /** 获取用量记录列表 */
1729
+ post: {
1730
+ body: {
1731
+ page?: number;
1732
+ pageSize?: number;
1733
+ serviceType?: string;
1734
+ startDate?: string;
1735
+ endDate?: string;
1736
+ };
1737
+ return: any;
1738
+ };
1739
+ };
1740
+ };
1741
+ export: {
1742
+ recharge: {
1743
+ /** 导出充值订单记录为 CSV 格式 */
1744
+ post: {
1745
+ body: {
1746
+ startDate?: string;
1747
+ endDate?: string;
1748
+ status?: string;
1749
+ };
1750
+ return: any;
1751
+ };
1752
+ };
1753
+ refund: {
1754
+ /** 导出退款记录为 CSV 格式 */
1755
+ post: {
1756
+ body: {
1757
+ startDate?: string;
1758
+ endDate?: string;
1759
+ status?: string;
1760
+ };
1761
+ return: any;
1762
+ };
1763
+ };
1764
+ pointsHistory: {
1765
+ /** 导出积分变动记录为 CSV 格式 */
1766
+ post: {
1767
+ body: {
1768
+ startDate?: string;
1769
+ endDate?: string;
1770
+ type?: string;
1771
+ userId?: string;
1772
+ };
1773
+ return: any;
1774
+ };
1775
+ };
1776
+ };
1777
+ financeReport: {
1778
+ overview: {
1779
+ /** 获取收入概览数据 */
1780
+ post: {
1781
+ body: {
1782
+ startDate?: string;
1783
+ endDate?: string;
1784
+ };
1785
+ return: any;
1786
+ };
1787
+ };
1788
+ trend: {
1789
+ /** 获取收入趋势数据(按日/周/月) */
1790
+ post: {
1791
+ body: {
1792
+ period: "day" | "week" | "month";
1793
+ days?: number;
1794
+ };
1795
+ return: any;
1796
+ };
1797
+ };
1798
+ packageRank: {
1799
+ /** 获取套餐销售排行数据 */
1800
+ post: {
1801
+ body: {
1802
+ startDate?: string;
1803
+ endDate?: string;
1804
+ limit?: number;
1805
+ };
1806
+ return: any;
1807
+ };
1808
+ };
1809
+ userRank: {
1810
+ /** 获取用户充值排行数据 */
1811
+ post: {
1812
+ body: {
1813
+ startDate?: string;
1814
+ endDate?: string;
1815
+ limit?: number;
1816
+ };
1817
+ return: any;
1818
+ };
1819
+ };
1820
+ };
1821
+ reconciliation: {
1822
+ generate: {
1823
+ /** 生成指定日期的对账报告 */
1824
+ post: {
1825
+ body: {
1826
+ date: string;
1827
+ };
1828
+ return: any;
1829
+ };
1830
+ };
1831
+ list: {
1832
+ /** 查询对账报告列表 */
1833
+ post: {
1834
+ body: {
1835
+ page?: number;
1836
+ pageSize?: number;
1837
+ status?: string;
1838
+ startDate?: string;
1839
+ endDate?: string;
1840
+ };
1841
+ return: any;
1842
+ };
1843
+ };
1844
+ detail: {
1845
+ /** 查询对账报告详情 */
1846
+ post: {
1847
+ body: {
1848
+ id: string;
1849
+ };
1850
+ return: any;
1851
+ };
1852
+ };
1853
+ processAnomaly: {
1854
+ /** 处理对账异常订单 */
1855
+ post: {
1856
+ body: {
1857
+ reportId: string;
1858
+ orderId: string;
1859
+ action: "confirm_paid" | "mark_cancelled" | "ignore";
1860
+ remark?: string;
1861
+ };
1862
+ return: any;
1863
+ };
1864
+ };
1865
+ batchGenerate: {
1866
+ /** 批量生成指定日期范围的对账报告 */
1867
+ post: {
1868
+ body: {
1869
+ startDate: string;
1870
+ endDate: string;
1871
+ };
1872
+ return: any;
1873
+ };
1874
+ };
1875
+ };
1876
+ invoice: {
1877
+ apply: {
1878
+ /** 申请开具发票 */
1879
+ post: {
1880
+ body: {
1881
+ invoiceType: "personal" | "company" | "vat_special";
1882
+ title: string;
1883
+ taxNumber?: string;
1884
+ companyAddress?: string;
1885
+ companyPhone?: string;
1886
+ bankName?: string;
1887
+ bankAccount?: string;
1888
+ email: string;
1889
+ receiverName?: string;
1890
+ receiverPhone?: string;
1891
+ receiverAddress?: string;
1892
+ orderIds?: string[];
1893
+ remark?: string;
1894
+ };
1895
+ return: any;
1896
+ };
1897
+ };
1898
+ list: {
1899
+ /** 查询发票申请列表 */
1900
+ post: {
1901
+ body: {
1902
+ page?: number;
1903
+ pageSize?: number;
1904
+ status?: string;
1905
+ userId?: string;
1906
+ startDate?: string;
1907
+ endDate?: string;
1908
+ };
1909
+ return: any;
1910
+ };
1911
+ };
1912
+ detail: {
1913
+ /** 查询发票详情 */
1914
+ post: {
1915
+ body: {
1916
+ invoiceNo: string;
1917
+ };
1918
+ return: any;
1919
+ };
1920
+ };
1921
+ review: {
1922
+ /** 审核发票申请(通过/拒绝) */
1923
+ post: {
1924
+ body: {
1925
+ invoiceNo: string;
1926
+ action: "approve" | "reject";
1927
+ remark?: string;
1928
+ };
1929
+ return: any;
1930
+ };
1931
+ };
1932
+ issue: {
1933
+ /** 标记发票已开具 */
1934
+ post: {
1935
+ body: {
1936
+ invoiceNo: string;
1937
+ invoiceCode?: string;
1938
+ invoiceNumber?: string;
1939
+ invoiceUrl?: string;
1940
+ };
1941
+ return: any;
1942
+ };
1943
+ };
1944
+ stats: {
1945
+ /** 获取发票统计数据 */
1946
+ post: {
1947
+ body: {
1948
+ startDate?: string;
1949
+ endDate?: string;
1950
+ };
1951
+ return: any;
1952
+ };
1953
+ };
1954
+ cancel: {
1955
+ /** 取消发票申请(仅待审核状态可取消) */
1956
+ post: {
1957
+ body: {
1958
+ invoiceNo: string;
1959
+ };
1960
+ return: any;
1961
+ };
1962
+ };
1963
+ };
1964
+ agreement: {
1965
+ create: {
1966
+ /** 创建支付宝签约代扣授权 */
1967
+ post: {
1968
+ body: {
1969
+ periodType: "DAY" | "MONTH" | "YEAR";
1970
+ period: number;
1971
+ singleAmount: number;
1972
+ totalAmount?: number;
1973
+ };
1974
+ return: any;
1975
+ };
1976
+ };
1977
+ query: {
1978
+ /** 查询签约状态 */
1979
+ post: {
1980
+ body: {
1981
+ externalAgreementNo?: string;
1982
+ };
1983
+ return: any;
1984
+ };
1985
+ };
1986
+ my: {
1987
+ /** 获取当前用户的签约信息 */
1988
+ post: {
1989
+ return: any;
1990
+ };
1991
+ };
1992
+ unsign: {
1993
+ /** 解除签约授权 */
1994
+ post: {
1995
+ return: any;
1996
+ };
1997
+ };
1998
+ history: {
1999
+ /** 查询签约历史记录 */
2000
+ post: {
2001
+ body: {
2002
+ page?: number;
2003
+ pageSize?: number;
2004
+ };
2005
+ return: any;
2006
+ };
2007
+ };
2008
+ deductLogs: {
2009
+ /** 查询代扣扣款记录 */
2010
+ post: {
2011
+ body: {
2012
+ page?: number;
2013
+ pageSize?: number;
2014
+ };
2015
+ return: any;
2016
+ };
2017
+ };
2018
+ signNotify: {
2019
+ /** 支付宝签约异步通知回调 */
2020
+ post: {
2021
+ return: any;
2022
+ };
2023
+ };
2024
+ };
2025
+ internal: {
2026
+ events: {
2027
+ trigger: {
2028
+ /** 供 auth-server 等内部服务发布业务事件 */
2029
+ post: {
2030
+ body: {
2031
+ appId: string;
2032
+ userId: string;
2033
+ event: string;
2034
+ eventData?: Record<string, unknown>;
2035
+ };
2036
+ return: any;
2037
+ };
2038
+ };
2039
+ };
2040
+ usage: {
2041
+ preview: {
2042
+ /** 供内部服务预估通用计费用量,不写入记录、不扣积分 */
2043
+ post: {
2044
+ body: {
2045
+ appId: string;
2046
+ userId: string;
2047
+ serviceType: string;
2048
+ amount: number;
2049
+ freeQuotaOverride?: number;
2050
+ };
2051
+ return: any;
2052
+ };
2053
+ };
2054
+ previewBatch: {
2055
+ /** 供内部服务批量预估通用计费用量,不写入记录、不扣积分 */
2056
+ post: {
2057
+ body: {
2058
+ appId: string;
2059
+ items: {
2060
+ key: string;
2061
+ userId: string;
2062
+ serviceType: string;
2063
+ amount: number;
2064
+ freeQuotaOverride?: number;
2065
+ }[];
2066
+ };
2067
+ return: any;
2068
+ };
2069
+ };
2070
+ report: {
2071
+ /** 供内部服务上报通用计费用量并扣积分 */
2072
+ post: {
2073
+ body: {
2074
+ appId: string;
2075
+ userId: string;
2076
+ serviceType: string;
2077
+ amount: number;
2078
+ metadata?: Record<string, unknown>;
2079
+ requestId?: string;
2080
+ usageKind?: "event" | "continuous_settlement";
2081
+ periodStart?: string;
2082
+ periodEnd?: string;
2083
+ freeQuotaOverride?: number;
2084
+ };
2085
+ return: any;
2086
+ };
2087
+ };
2088
+ };
2089
+ };
2090
+ webhooks: {
2091
+ events: {
2092
+ /** 获取所有可用的 Webhook 事件类型 */
2093
+ get: {
2094
+ return: any;
2095
+ };
2096
+ ':id': {
2097
+ /** 获取指定分类的 Webhook 事件 */
2098
+ get: {
2099
+ params: {
2100
+ category: string;
2101
+ };
2102
+ return: any;
2103
+ };
2104
+ };
2105
+ };
2106
+ categories: {
2107
+ /** 获取所有 Webhook 事件分类 */
2108
+ get: {
2109
+ return: any;
2110
+ };
2111
+ };
2112
+ };
2113
+ };
2114
+ /** API 客户端类型(提供完整的 IDE 智能提示) */
2115
+ export interface ApiClient {
2116
+ health: {
2117
+ get: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2118
+ };
2119
+ 'api-spec': {
2120
+ /** 获取 API 规范,用于类型同步 */
2121
+ get: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2122
+ };
2123
+ products: {
2124
+ create: {
2125
+ /** 创建新产品 */
2126
+ post: (body: {
2127
+ name: string;
2128
+ description?: string;
2129
+ features: {
2130
+ key: string;
2131
+ name: string;
2132
+ description?: string;
2133
+ type: "boolean";
2134
+ value?: boolean;
2135
+ highlight?: boolean;
2136
+ }[];
2137
+ metadata?: Record<string, unknown>;
2138
+ displayOrder?: number;
2139
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2140
+ };
2141
+ delete: {
2142
+ /** 删除产品 */
2143
+ post: (body: {
2144
+ id: string;
2145
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2146
+ };
2147
+ update: {
2148
+ /** 更新产品信息 */
2149
+ post: (body: {
2150
+ id: string;
2151
+ name?: string;
2152
+ description?: string;
2153
+ features?: {
2154
+ key: string;
2155
+ name: string;
2156
+ description?: string;
2157
+ type: "boolean";
2158
+ value?: boolean;
2159
+ highlight?: boolean;
2160
+ }[];
2161
+ status?: "active" | "archived";
2162
+ metadata?: Record<string, unknown>;
2163
+ displayOrder?: number;
2164
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2165
+ };
2166
+ find: {
2167
+ /** 分页查询产品列表 */
2168
+ post: (body: {
2169
+ current: number;
2170
+ pageSize: number;
2171
+ where: {
2172
+ name?: string;
1250
2173
  status?: "" | "active" | "archived";
1251
2174
  };
1252
2175
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1253
2176
  };
1254
2177
  findOne: {
1255
- /** 根据 ID 查询产品详情 */
2178
+ /** 根据 ID 查询产品详情 */
2179
+ post: (body: {
2180
+ id: string;
2181
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2182
+ };
2183
+ updateSort: {
2184
+ /** 批量更新产品排序 */
2185
+ post: (body: {
2186
+ items: {
2187
+ id: string;
2188
+ displayOrder: number;
2189
+ }[];
2190
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2191
+ };
2192
+ listActive: {
2193
+ /** 获取定价页面可用产品列表(公开) */
2194
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2195
+ };
2196
+ };
2197
+ prices: {
2198
+ create: {
2199
+ /** 创建新价格方案 */
2200
+ post: (body: {
2201
+ productId: string;
2202
+ nickname?: string;
2203
+ type: "free" | "one_time" | "recurring";
2204
+ currency: string;
2205
+ unitAmount: number;
2206
+ trialPeriodDays?: number;
2207
+ allowRepeatTrial?: boolean;
2208
+ interval?: "day" | "week" | "month" | "year";
2209
+ intervalCount?: number;
2210
+ metadata?: Record<string, unknown>;
2211
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2212
+ };
2213
+ delete: {
2214
+ /** 删除价格方案 */
2215
+ post: (body: {
2216
+ id: string;
2217
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2218
+ };
2219
+ update: {
2220
+ /** 更新价格方案信息 */
2221
+ post: (body: {
2222
+ id: string;
2223
+ nickname?: string;
2224
+ active?: boolean;
2225
+ metadata?: Record<string, unknown>;
2226
+ trialPeriodDays?: number;
2227
+ allowRepeatTrial?: boolean;
2228
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2229
+ };
2230
+ find: {
2231
+ /** 分页查询价格方案列表 */
2232
+ post: (body: {
2233
+ current: number;
2234
+ pageSize: number;
2235
+ where: {
2236
+ productId?: string;
2237
+ type?: "" | "free" | "one_time" | "recurring";
2238
+ active?: boolean;
2239
+ };
2240
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2241
+ };
2242
+ findOne: {
2243
+ /** 根据 ID 查询价格方案详情 */
2244
+ post: (body: {
2245
+ id: string;
2246
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2247
+ };
2248
+ listByProduct: {
2249
+ /** 获取指定产品的所有可用价格方案 */
2250
+ post: (body: {
2251
+ productId: string;
2252
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2253
+ };
2254
+ listFreeActive: {
2255
+ /** 获取当前应用可领取的免费体验价格方案 */
2256
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2257
+ };
2258
+ };
2259
+ subscriptions: {
2260
+ create: {
2261
+ /** 创建新订阅并发起支付 */
2262
+ post: (body: {
2263
+ priceId: string;
2264
+ couponCode?: string;
2265
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2266
+ };
2267
+ cancel: {
2268
+ /** 取消订阅 */
2269
+ post: (body: {
2270
+ subscriptionId: string;
2271
+ cancelAtPeriodEnd?: boolean;
2272
+ reason?: string;
2273
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2274
+ };
2275
+ resume: {
2276
+ /** 恢复已取消的订阅 */
2277
+ post: (body: {
2278
+ subscriptionId: string;
2279
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2280
+ };
2281
+ change: {
2282
+ /** 升级或降级订阅 */
2283
+ post: (body: {
2284
+ subscriptionId: string;
2285
+ newPriceId: string;
2286
+ proration?: boolean;
2287
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2288
+ };
2289
+ my: {
2290
+ /** 查询当前用户的订阅列表 */
2291
+ post: (body: {
2292
+ current?: number;
2293
+ pageSize?: number;
2294
+ status?: string;
2295
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2296
+ };
2297
+ current: {
2298
+ /** 获取当前活跃订阅 */
2299
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2300
+ };
2301
+ summary: {
2302
+ /** 获取当前用户订阅、配额、积分和待支付账单摘要 */
2303
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2304
+ };
2305
+ userDetail: {
2306
+ /** 管理员查询指定用户的订阅、免费体验、配额、积分和最近消费记录 */
2307
+ post: (body: {
2308
+ userId: string;
2309
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2310
+ };
2311
+ find: {
2312
+ /** 分页查询订阅列表(管理端) */
2313
+ post: (body: {
2314
+ current: number;
2315
+ pageSize: number;
2316
+ where: {
2317
+ userId?: string;
2318
+ productId?: string;
2319
+ status?: string;
2320
+ cancelAtPeriodEnd?: boolean;
2321
+ };
2322
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2323
+ };
2324
+ history: {
2325
+ /** 查询单个订阅的权益变化历史(管理端) */
2326
+ post: (body: {
2327
+ subscriptionId: string;
2328
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2329
+ };
2330
+ trend: {
2331
+ /** 获取订阅各状态的历史趋势数据 */
2332
+ post: (body: {
2333
+ startTime: string;
2334
+ endTime: string;
2335
+ granularity: "day" | "week" | "month";
2336
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2337
+ };
2338
+ count: {
2339
+ /** 供其他服务查询用户订阅数量 */
2340
+ post: (body: {
2341
+ userId: string;
2342
+ appId?: string;
2343
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2344
+ };
2345
+ countBatch: {
2346
+ /** 供其他服务批量查询用户订阅数量 */
2347
+ post: (body: {
2348
+ userIds: string[];
2349
+ appId?: string;
2350
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2351
+ };
2352
+ notify: {
2353
+ alipay: {
2354
+ /** 支付宝订阅支付回调通知 */
2355
+ post: (body: Record<string, unknown>, config?: RequestConfig) => Promise<ApiResponse<any>>;
2356
+ };
2357
+ };
2358
+ };
2359
+ quotas: {
2360
+ create: {
2361
+ /** 创建配额定义 */
2362
+ post: (body: {
2363
+ priceId: string;
2364
+ featureKey: string;
2365
+ name: string;
2366
+ description?: string;
2367
+ limit: number;
2368
+ period: "day" | "week" | "month" | "year" | "lifetime";
2369
+ metadata?: Record<string, unknown>;
2370
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2371
+ };
2372
+ delete: {
2373
+ /** 删除配额定义 */
2374
+ post: (body: {
2375
+ id: string;
2376
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2377
+ };
2378
+ update: {
2379
+ /** 更新配额定义 */
2380
+ post: (body: {
2381
+ id: string;
2382
+ name?: string;
2383
+ description?: string;
2384
+ limit?: number;
2385
+ period?: "day" | "week" | "month" | "year" | "lifetime";
2386
+ metadata?: Record<string, unknown>;
2387
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2388
+ };
2389
+ find: {
2390
+ /** 分页查询配额列表 */
2391
+ post: (body: {
2392
+ current: number;
2393
+ pageSize: number;
2394
+ where: {
2395
+ productId?: string;
2396
+ priceId?: string;
2397
+ featureKey?: string;
2398
+ };
2399
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2400
+ };
2401
+ check: {
2402
+ /** 供其他服务检查配额是否足够,不写入使用量 */
2403
+ post: (body: {
2404
+ appId: string;
2405
+ userId: string;
2406
+ featureKey: string;
2407
+ quantity?: number;
2408
+ used?: number;
2409
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2410
+ };
2411
+ my: {
2412
+ /** 获取当前用户的配额使用情况 */
2413
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2414
+ };
2415
+ reserve: {
2416
+ /** 供其他服务检查并预占配额 */
2417
+ post: (body: {
2418
+ appId: string;
2419
+ userId: string;
2420
+ featureKey: string;
2421
+ quantity?: number;
2422
+ metadata?: Record<string, unknown>;
2423
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2424
+ };
2425
+ commit: {
2426
+ /** 供其他服务确认已预占配额 */
2427
+ post: (body: {
2428
+ usageRecordId: string;
2429
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2430
+ };
2431
+ release: {
2432
+ /** 供其他服务释放已预占配额 */
2433
+ post: (body: {
2434
+ usageRecordId: string;
2435
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2436
+ };
2437
+ };
2438
+ trials: {
2439
+ current: {
2440
+ /** 获取当前用户免费体验状态 */
2441
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2442
+ };
2443
+ start: {
2444
+ /** 领取当前应用的免费体验权益 */
2445
+ post: (body: {
2446
+ priceId?: string;
2447
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2448
+ };
2449
+ };
2450
+ newUserDefaults: {
2451
+ find: {
2452
+ /** 查询注册后默认授予的免费权益配置 */
2453
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2454
+ };
2455
+ update: {
2456
+ /** 更新注册后默认授予的免费权益配置 */
2457
+ post: (body: {
2458
+ autoGrantFreePriceOnSignup: boolean;
2459
+ defaultFreePriceId?: string;
2460
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2461
+ };
2462
+ grantMissingFreeEntitlements: {
2463
+ /** 给当前应用下没有活跃订阅/体验的用户补发默认免费价格方案 */
2464
+ post: (body: {
2465
+ dryRun?: boolean;
2466
+ userIds?: string[];
2467
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2468
+ };
2469
+ };
2470
+ usageRecords: {
2471
+ checkQuota: {
2472
+ /** 检查配额是否足够,不写入使用量 */
2473
+ post: (body: {
2474
+ userId?: string;
2475
+ featureKey: string;
2476
+ quantity?: number;
2477
+ used?: number;
2478
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2479
+ };
2480
+ reserveQuota: {
2481
+ /** 检查配额并写入 reserved 使用量记录 */
2482
+ post: (body: {
2483
+ userId?: string;
2484
+ featureKey: string;
2485
+ quantity?: number;
2486
+ metadata?: Record<string, unknown>;
2487
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2488
+ };
2489
+ commitQuota: {
2490
+ /** 将 reserved 使用量记录确认成 committed */
2491
+ post: (body: {
2492
+ usageRecordId: string;
2493
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2494
+ };
2495
+ releaseQuota: {
2496
+ /** 将 reserved 使用量记录释放成 released */
2497
+ post: (body: {
2498
+ usageRecordId: string;
2499
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2500
+ };
2501
+ find: {
2502
+ /** 分页查询使用记录(管理端) */
2503
+ post: (body: {
2504
+ current: number;
2505
+ pageSize: number;
2506
+ where: {
2507
+ userId?: string;
2508
+ featureKey?: string;
2509
+ status?: string;
2510
+ startTime?: string;
2511
+ endTime?: string;
2512
+ };
2513
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2514
+ };
2515
+ my: {
2516
+ /** 查询当前用户的使用记录 */
2517
+ post: (body: {
2518
+ current?: number;
2519
+ pageSize?: number;
2520
+ featureKey?: string;
2521
+ status?: string;
2522
+ startTime?: string;
2523
+ endTime?: string;
2524
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2525
+ };
2526
+ statistics: {
2527
+ /** 获取使用量统计数据 */
2528
+ post: (body: {
2529
+ userId?: string;
2530
+ featureKey?: string;
2531
+ startTime: string;
2532
+ endTime: string;
2533
+ granularity: "hour" | "day" | "week" | "month";
2534
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2535
+ };
2536
+ };
2537
+ invoices: {
2538
+ find: {
2539
+ /** 分页查询订阅账单列表(管理端) */
2540
+ post: (body: {
2541
+ current: number;
2542
+ pageSize: number;
2543
+ where: {
2544
+ userId?: string;
2545
+ subscriptionId?: string;
2546
+ status?: string;
2547
+ startTime?: string;
2548
+ endTime?: string;
2549
+ };
2550
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2551
+ };
2552
+ findOne: {
2553
+ /** 根据 ID 查询订阅账单详情 */
2554
+ post: (body: {
2555
+ id: string;
2556
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2557
+ };
2558
+ my: {
2559
+ /** 查询当前用户的订阅账单列表 */
2560
+ post: (body: {
2561
+ current?: number;
2562
+ pageSize?: number;
2563
+ status?: string;
2564
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2565
+ };
2566
+ cancel: {
2567
+ /** 取消当前用户自己的待支付订阅账单 */
2568
+ post: (body: {
2569
+ id: string;
2570
+ reason?: string;
2571
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2572
+ };
2573
+ pay: {
2574
+ /** 为当前用户的待支付账单生成支付链接 */
2575
+ post: (body: {
2576
+ id: string;
2577
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2578
+ };
2579
+ verifyPayment: {
2580
+ /** 查询支付宝订单状态,如果已支付则完成订阅入账 */
2581
+ post: (body: {
2582
+ orderId: string;
2583
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2584
+ };
2585
+ void: {
2586
+ /** 管理端作废待支付订阅账单 */
2587
+ post: (body: {
2588
+ id: string;
2589
+ reason?: string;
2590
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2591
+ };
2592
+ statistics: {
2593
+ /** 获取订阅账单统计数据 */
2594
+ post: (body: {
2595
+ startTime?: string;
2596
+ endTime?: string;
2597
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2598
+ };
2599
+ revenueReport: {
2600
+ /** 获取收入报表数据 */
2601
+ post: (body: {
2602
+ startTime: string;
2603
+ endTime: string;
2604
+ granularity: "day" | "week" | "month" | "year";
2605
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2606
+ };
2607
+ revenueByProduct: {
2608
+ /** 获取按产品分布的收入数据 */
2609
+ post: (body: {
2610
+ startTime?: string;
2611
+ endTime?: string;
2612
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2613
+ };
2614
+ statusOptions: {
2615
+ /** 获取订阅账单状态下拉选项与展示文案 */
2616
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2617
+ };
2618
+ stats: {
2619
+ /** 供其他服务查询发票统计数据 */
2620
+ post: (body: {
2621
+ appId: string;
2622
+ userIds: string[];
2623
+ status?: string;
2624
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2625
+ };
2626
+ statsByUser: {
2627
+ /** 供其他服务按用户分组查询发票统计 */
2628
+ post: (body: {
2629
+ appId: string;
2630
+ userIds: string[];
2631
+ status?: string;
2632
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2633
+ };
2634
+ };
2635
+ points: {
2636
+ account: {
2637
+ /** 查询用户积分账户余额 */
2638
+ post: (body: {
2639
+ userId?: string;
2640
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2641
+ };
2642
+ earn: {
2643
+ /** 发放积分(充值、奖励等) */
2644
+ post: (body: {
2645
+ userId: string;
2646
+ amount: number;
2647
+ subType: "recharge" | "referral" | "signup" | "subscription" | "activity" | "bonus";
2648
+ requestId?: string;
2649
+ description: string;
2650
+ orderId?: string;
2651
+ referrerId?: string;
2652
+ ruleId?: string;
2653
+ metadata?: Record<string, unknown>;
2654
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2655
+ };
2656
+ consume: {
2657
+ /** 按调用方计算好的积分数消费积分 */
2658
+ post: (body: {
2659
+ userId: string;
2660
+ amount: number;
2661
+ requestId?: string;
2662
+ description?: string;
2663
+ metadata?: Record<string, unknown>;
2664
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2665
+ };
2666
+ consumeByPrice: {
2667
+ /** 根据计价配置消费积分 */
2668
+ post: (body: {
2669
+ userId: string;
2670
+ priceCode: string;
2671
+ quantity?: number;
2672
+ requestId?: string;
2673
+ description?: string;
2674
+ metadata?: Record<string, unknown>;
2675
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2676
+ };
2677
+ checkBalance: {
2678
+ /** 检查积分是否足够(不扣费) */
2679
+ post: (body: {
2680
+ userId: string;
2681
+ priceCode: string;
2682
+ quantity?: number;
2683
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2684
+ };
2685
+ reversal: {
2686
+ /** 冲正/退还已消费的积分 */
2687
+ post: (body: {
2688
+ userId: string;
2689
+ originalTransactionId: string;
2690
+ requestId?: string;
2691
+ reason: string;
2692
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2693
+ };
2694
+ clawback: {
2695
+ /** 追回/扣回已发放的积分 */
2696
+ post: (body: {
2697
+ userId: string;
2698
+ originalTransactionId: string;
2699
+ requestId?: string;
2700
+ reason: string;
2701
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2702
+ };
2703
+ adjust: {
2704
+ /** 人工调整积分(加/减) */
2705
+ post: (body: {
2706
+ userId: string;
2707
+ amount: number;
2708
+ requestId?: string;
2709
+ reason: string;
2710
+ relatedOrderId?: string;
2711
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2712
+ };
2713
+ batchAdjust: {
2714
+ /** 批量调整多用户积分 */
2715
+ post: (body: {
2716
+ userIds: string[];
2717
+ amount: number;
2718
+ requestId?: string;
2719
+ reason: string;
2720
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2721
+ };
2722
+ statistics: {
2723
+ /** 获取用户积分统计数据 */
2724
+ post: (body: {
2725
+ userId?: string;
2726
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2727
+ };
2728
+ leaderboard: {
2729
+ /** 获取积分排行榜 */
2730
+ post: (body: {
2731
+ limit?: number;
2732
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2733
+ };
2734
+ };
2735
+ pointsHistory: {
2736
+ find: {
2737
+ /** 分页查询积分变动历史 */
2738
+ post: (body: {
2739
+ userId?: string;
2740
+ type?: "earn" | "spend" | "reversal" | "clawback" | "adjust";
2741
+ subType?: string;
2742
+ page?: number;
2743
+ pageSize?: number;
2744
+ startDate?: string;
2745
+ endDate?: string;
2746
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2747
+ };
2748
+ findOne: {
2749
+ /** 根据 ID 查询积分历史详情 */
1256
2750
  post: (body: {
1257
2751
  id: string;
1258
2752
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1259
2753
  };
1260
- listActive: {
1261
- /** 获取定价页面可用产品列表(公开) */
1262
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2754
+ statistics: {
2755
+ /** 获取积分统计数据 */
2756
+ post: (body: {
2757
+ userId?: string;
2758
+ period?: "day" | "week" | "month" | "year";
2759
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2760
+ };
2761
+ getTrendChart: {
2762
+ /** 获取积分变动趋势图表数据 */
2763
+ post: (body: {
2764
+ userId?: string;
2765
+ startTime: string;
2766
+ endTime: string;
2767
+ granularity: "minute" | "hour" | "day" | "month" | "year";
2768
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2769
+ };
2770
+ getTypeDistributionChart: {
2771
+ /** 获取积分类型分布图表数据 */
2772
+ post: (body: {
2773
+ userId?: string;
2774
+ startTime?: string;
2775
+ endTime?: string;
2776
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2777
+ };
2778
+ getRankingChart: {
2779
+ /** 获取用户积分排行榜 */
2780
+ post: (body: {
2781
+ type?: "earn" | "spend" | "reversal" | "clawback" | "adjust";
2782
+ startTime?: string;
2783
+ endTime?: string;
2784
+ limit?: number;
2785
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1263
2786
  };
1264
2787
  };
1265
- prices: {
1266
- create: {
1267
- /** 创建新价格方案 */
2788
+ pointsTrigger: {
2789
+ trigger: {
2790
+ /** 根据规则 ID 触发积分发放 */
1268
2791
  post: (body: {
1269
- productId: string;
1270
- nickname?: string;
1271
- type: "free" | "one_time" | "recurring";
1272
- currency: string;
1273
- unitAmount: number;
1274
- trialPeriodDays?: number;
1275
- allowRepeatTrial?: boolean;
1276
- interval?: "day" | "week" | "month" | "year";
1277
- intervalCount?: number;
1278
- metadata?: Record<string, unknown>;
2792
+ ruleId: string;
2793
+ eventData?: Record<string, unknown>;
1279
2794
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1280
2795
  };
1281
- delete: {
1282
- /** 删除价格方案 */
2796
+ triggerByEvent: {
2797
+ /** 根据事件自动匹配并触发积分规则 */
1283
2798
  post: (body: {
1284
- id: string;
2799
+ event: string;
2800
+ eventData?: Record<string, unknown>;
2801
+ userId?: string;
1285
2802
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1286
2803
  };
1287
- update: {
1288
- /** 更新价格方案信息 */
2804
+ batchTrigger: {
2805
+ /** 批量触发多个积分规则 */
1289
2806
  post: (body: {
1290
- id: string;
1291
- nickname?: string;
1292
- active?: boolean;
1293
- metadata?: Record<string, unknown>;
1294
- trialPeriodDays?: number;
1295
- allowRepeatTrial?: boolean;
2807
+ triggers: {
2808
+ ruleId: string;
2809
+ eventData?: Record<string, unknown>;
2810
+ }[];
1296
2811
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1297
2812
  };
2813
+ };
2814
+ pointsTriggerHistory: {
1298
2815
  find: {
1299
- /** 分页查询价格方案列表 */
2816
+ /** 分页查询积分触发历史记录 */
1300
2817
  post: (body: {
1301
- current: number;
1302
- pageSize: number;
1303
- where: {
1304
- productId?: string;
1305
- type?: "" | "free" | "one_time" | "recurring";
1306
- active?: boolean;
2818
+ current?: number;
2819
+ pageSize?: number;
2820
+ where?: {
2821
+ userId?: string;
2822
+ ruleId?: string;
2823
+ ruleCode?: string;
2824
+ event?: string;
2825
+ status?: "pending" | "success" | "completed" | "failed" | "cooldown" | "constraintFailed";
2826
+ rewardTarget?: "self" | "referrer";
2827
+ startDate?: string;
2828
+ endDate?: string;
1307
2829
  };
1308
2830
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1309
2831
  };
1310
2832
  findOne: {
1311
- /** 根据 ID 查询价格方案详情 */
2833
+ /** 根据 ID 查询积分触发历史详情 */
1312
2834
  post: (body: {
1313
2835
  id: string;
1314
2836
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1315
2837
  };
1316
- listByProduct: {
1317
- /** 获取指定产品的所有可用价格方案 */
2838
+ statusOptions: {
2839
+ /** 获取积分触发状态下拉选项 */
2840
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2841
+ };
2842
+ rewardTargetOptions: {
2843
+ /** 获取奖励目标下拉选项 */
2844
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2845
+ };
2846
+ statistics: {
2847
+ /** 获取积分触发历史统计数据 */
1318
2848
  post: (body: {
1319
- productId: string;
2849
+ userId?: string;
2850
+ ruleId?: string;
2851
+ startTime?: string;
2852
+ endTime?: string;
2853
+ period?: "today" | "week" | "month" | "year";
1320
2854
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1321
2855
  };
1322
- listFreeActive: {
1323
- /** 获取当前应用可领取的免费体验价格方案 */
1324
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2856
+ trends: {
2857
+ /** 获取积分触发趋势图表数据 */
2858
+ post: (body: {
2859
+ userId?: string;
2860
+ ruleId?: string;
2861
+ startTime?: string;
2862
+ endTime?: string;
2863
+ granularity?: "minute" | "hour" | "day" | "month" | "year";
2864
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1325
2865
  };
1326
- };
1327
- subscriptions: {
1328
- create: {
1329
- /** 创建新订阅并发起支付 */
2866
+ pointsTrends: {
2867
+ /** 获取积分变动趋势图表数据 */
1330
2868
  post: (body: {
1331
- priceId: string;
1332
- couponCode?: string;
2869
+ userId?: string;
2870
+ ruleId?: string;
2871
+ startTime?: string;
2872
+ endTime?: string;
2873
+ granularity?: "minute" | "hour" | "day" | "month" | "year";
1333
2874
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1334
2875
  };
1335
- cancel: {
1336
- /** 取消订阅 */
2876
+ completionAnalysis: {
2877
+ /** 获取积分规则完成度分析数据 */
1337
2878
  post: (body: {
1338
- subscriptionId: string;
1339
- cancelAtPeriodEnd?: boolean;
1340
- reason?: string;
2879
+ userId?: string;
2880
+ ruleId?: string;
2881
+ startTime?: string;
2882
+ endTime?: string;
1341
2883
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1342
2884
  };
1343
- resume: {
1344
- /** 恢复已取消的订阅 */
2885
+ triggerTypeTrends: {
2886
+ /** 获取积分触发类型趋势图表数据 */
1345
2887
  post: (body: {
1346
- subscriptionId: string;
2888
+ userId?: string;
2889
+ ruleId?: string;
2890
+ startTime?: string;
2891
+ endTime?: string;
2892
+ granularity?: "minute" | "hour" | "day" | "month" | "year";
1347
2893
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1348
2894
  };
1349
- change: {
1350
- /** 升级或降级订阅 */
2895
+ };
2896
+ pointsTriggerRule: {
2897
+ create: {
2898
+ /** 创建新积分触发规则 */
1351
2899
  post: (body: {
1352
- subscriptionId: string;
1353
- newPriceId: string;
1354
- proration?: boolean;
2900
+ ruleName: string;
2901
+ ruleCode: string;
2902
+ description: string;
2903
+ event?: string;
2904
+ triggerCondition: unknown;
2905
+ pointsReward: unknown;
2906
+ constraints: unknown;
2907
+ activeTimeRanges: unknown;
1355
2908
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1356
2909
  };
1357
- my: {
1358
- /** 查询当前用户的订阅列表 */
2910
+ find: {
2911
+ /** 分页查询积分触发规则列表 */
1359
2912
  post: (body: {
1360
2913
  current?: number;
1361
2914
  pageSize?: number;
1362
- status?: string;
2915
+ where?: {
2916
+ triggerType?: string;
2917
+ status?: string;
2918
+ ruleName?: string;
2919
+ ruleCode?: string;
2920
+ event?: string;
2921
+ };
1363
2922
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1364
2923
  };
1365
- current: {
1366
- /** 获取当前活跃订阅 */
1367
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1368
- };
1369
- summary: {
1370
- /** 获取当前用户订阅、配额、积分和待支付账单摘要 */
1371
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2924
+ findOne: {
2925
+ /** 根据 ID 查询积分触发规则详情 */
2926
+ post: (body: {
2927
+ id: string;
2928
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1372
2929
  };
1373
- find: {
1374
- /** 分页查询订阅列表(管理端) */
2930
+ update: {
2931
+ /** 更新积分触发规则配置 */
1375
2932
  post: (body: {
1376
- current: number;
1377
- pageSize: number;
1378
- where: {
1379
- userId?: string;
1380
- productId?: string;
1381
- status?: string;
1382
- };
2933
+ id: string;
2934
+ ruleName?: string;
2935
+ ruleCode?: string;
2936
+ description?: string;
2937
+ event?: string | null;
2938
+ triggerCondition?: unknown;
2939
+ pointsReward?: unknown;
2940
+ constraints?: unknown;
2941
+ activeTimeRanges?: unknown;
1383
2942
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1384
2943
  };
1385
- count: {
1386
- /** 供其他服务查询用户订阅数量 */
2944
+ updateStatus: {
2945
+ /** 启用或禁用积分触发规则 */
1387
2946
  post: (body: {
1388
- userId: string;
1389
- appId?: string;
2947
+ id: string;
2948
+ status: "draft" | "active" | "inactive";
1390
2949
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1391
2950
  };
1392
- countBatch: {
1393
- /** 供其他服务批量查询用户订阅数量 */
2951
+ delete: {
2952
+ /** 删除积分触发规则 */
1394
2953
  post: (body: {
1395
- userIds: string[];
1396
- appId?: string;
2954
+ id: string;
1397
2955
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1398
2956
  };
2957
+ statusOptions: {
2958
+ /** 获取积分触发规则状态下拉选项 */
2959
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2960
+ };
2961
+ eventOptions: {
2962
+ /** 获取可绑定的事件类型选项 */
2963
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2964
+ };
1399
2965
  };
1400
- quotas: {
2966
+ pointsPriceConfig: {
1401
2967
  create: {
1402
- /** 创建配额定义 */
2968
+ /** 创建新的积分计价配置 */
1403
2969
  post: (body: {
1404
- priceId: string;
1405
- featureKey: string;
2970
+ code: string;
1406
2971
  name: string;
1407
2972
  description?: string;
1408
- limit: number;
1409
- period: "day" | "week" | "month" | "year" | "lifetime";
1410
- metadata?: Record<string, unknown>;
2973
+ billingMode: "per_request" | "per_unit";
2974
+ unitPrice: number;
2975
+ unit?: string;
2976
+ minCharge?: number;
2977
+ status?: "active" | "inactive";
1411
2978
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1412
2979
  };
1413
- delete: {
1414
- /** 删除配额定义 */
2980
+ find: {
2981
+ /** 分页查询计价配置列表 */
1415
2982
  post: (body: {
1416
- id: string;
2983
+ where?: {
2984
+ code?: string;
2985
+ name?: string;
2986
+ billingMode?: string;
2987
+ status?: string;
2988
+ };
2989
+ page?: number;
2990
+ pageSize?: number;
2991
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2992
+ };
2993
+ findOne: {
2994
+ /** 根据 ID 或 code 查询计价配置详情 */
2995
+ post: (body: {
2996
+ id?: string;
2997
+ code?: string;
1417
2998
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1418
2999
  };
1419
3000
  update: {
1420
- /** 更新配额定义 */
3001
+ /** 更新计价配置 */
1421
3002
  post: (body: {
1422
3003
  id: string;
1423
3004
  name?: string;
1424
3005
  description?: string;
1425
- limit?: number;
1426
- period?: "day" | "week" | "month" | "year" | "lifetime";
1427
- metadata?: Record<string, unknown>;
3006
+ billingMode?: "per_request" | "per_unit";
3007
+ unitPrice?: number;
3008
+ unit?: string;
3009
+ minCharge?: number;
3010
+ status?: "active" | "inactive";
1428
3011
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1429
3012
  };
1430
- find: {
1431
- /** 分页查询配额列表 */
3013
+ updateStatus: {
3014
+ /** 启用或停用计价配置 */
1432
3015
  post: (body: {
1433
- current: number;
1434
- pageSize: number;
1435
- where: {
1436
- productId?: string;
1437
- priceId?: string;
1438
- featureKey?: string;
1439
- };
3016
+ id: string;
3017
+ status: "active" | "inactive";
1440
3018
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1441
3019
  };
1442
- check: {
1443
- /** 检查用户配额是否足够 */
3020
+ delete: {
3021
+ /** 删除计价配置 */
1444
3022
  post: (body: {
1445
- featureKey: string;
1446
- amount?: number;
3023
+ id: string;
1447
3024
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1448
3025
  };
1449
- my: {
1450
- /** 获取当前用户的配额使用情况 */
3026
+ billingModeOptions: {
3027
+ /** 获取计费方式下拉选项 */
1451
3028
  post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1452
3029
  };
1453
3030
  };
1454
- usageRecords: {
1455
- record: {
1456
- /** 记录用户功能使用量 */
3031
+ pointsUsageRecord: {
3032
+ find: {
3033
+ /** 分页查询积分消费记录 */
1457
3034
  post: (body: {
1458
- userId?: string;
1459
- featureKey: string;
1460
- quantity?: number;
1461
- metadata?: Record<string, unknown>;
3035
+ where?: {
3036
+ userId?: string;
3037
+ priceCode?: string;
3038
+ priceName?: string;
3039
+ billingMode?: string;
3040
+ startDate?: string;
3041
+ endDate?: string;
3042
+ };
3043
+ page?: number;
3044
+ pageSize?: number;
1462
3045
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1463
3046
  };
1464
- recordWithQuotaCheck: {
1465
- /** 记录使用量并检查配额 */
3047
+ statistics: {
3048
+ /** 按维度统计消费数据 */
1466
3049
  post: (body: {
3050
+ dimension: "priceCode" | "userId" | "date";
3051
+ startDate?: string;
3052
+ endDate?: string;
3053
+ priceCode?: string;
1467
3054
  userId?: string;
1468
- featureKey: string;
1469
- quantity?: number;
1470
- metadata?: Record<string, unknown>;
3055
+ limit?: number;
1471
3056
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1472
3057
  };
1473
- checkQuota: {
1474
- /** 预检查配额是否足够(不记录使用量) */
3058
+ overview: {
3059
+ /** 获取消费概览数据 */
1475
3060
  post: (body: {
1476
- userId?: string;
1477
- featureKey: string;
1478
- quantity?: number;
3061
+ startDate?: string;
3062
+ endDate?: string;
1479
3063
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1480
3064
  };
1481
- batchRecord: {
1482
- /** 批量记录使用量 */
3065
+ };
3066
+ pointsBalanceAlert: {
3067
+ upsertConfig: {
3068
+ /** 创建或更新预警配置 */
1483
3069
  post: (body: {
1484
- records: {
1485
- userId: string;
1486
- featureKey: string;
1487
- quantity?: number;
1488
- metadata?: Record<string, unknown>;
1489
- timestamp?: string;
1490
- }[];
3070
+ threshold: number;
3071
+ enabled?: boolean;
3072
+ notifyEmail?: boolean;
3073
+ notifyEmails?: string[];
3074
+ cooldownHours?: number;
1491
3075
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1492
3076
  };
1493
- find: {
1494
- /** 分页查询使用记录(管理端) */
3077
+ getConfig: {
3078
+ /** 获取当前预警配置 */
3079
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3080
+ };
3081
+ findAlerts: {
3082
+ /** 分页查询预警记录 */
1495
3083
  post: (body: {
1496
- current: number;
1497
- pageSize: number;
1498
- where: {
3084
+ where?: {
1499
3085
  userId?: string;
1500
- featureKey?: string;
1501
- startTime?: string;
1502
- endTime?: string;
3086
+ alertType?: string;
3087
+ startDate?: string;
3088
+ endDate?: string;
1503
3089
  };
3090
+ page?: number;
3091
+ pageSize?: number;
3092
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3093
+ };
3094
+ triggerCheck: {
3095
+ /** 手动触发预警检查(测试用) */
3096
+ post: (body: {
3097
+ userId: string;
3098
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3099
+ };
3100
+ };
3101
+ consumption: {
3102
+ trend: {
3103
+ /** 聚合服务消费的趋势数据 */
3104
+ post: (body: {
3105
+ startDate?: string;
3106
+ endDate?: string;
3107
+ limit?: number;
1504
3108
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1505
3109
  };
1506
- my: {
1507
- /** 查询当前用户的使用记录 */
3110
+ overview: {
3111
+ /** 聚合服务消费的概览数据 */
1508
3112
  post: (body: {
1509
- current?: number;
1510
- pageSize?: number;
1511
- featureKey?: string;
1512
- startTime?: string;
1513
- endTime?: string;
3113
+ startDate?: string;
3114
+ endDate?: string;
1514
3115
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1515
3116
  };
1516
- statistics: {
1517
- /** 获取使用量统计数据 */
3117
+ };
3118
+ pointsRecharge: {
3119
+ packages: {
3120
+ /** 获取可用的充值套餐列表 */
3121
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3122
+ };
3123
+ createOrder: {
3124
+ /** 创建积分充值订单 */
1518
3125
  post: (body: {
1519
- userId?: string;
1520
- featureKey?: string;
1521
- startTime: string;
1522
- endTime: string;
1523
- granularity: "hour" | "day" | "week" | "month";
3126
+ packageId: string;
3127
+ payType: "alipay" | "weixinpay";
1524
3128
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1525
3129
  };
1526
- getTrendChart: {
1527
- /** 获取使用量趋势图表数据 */
3130
+ createQRCodeOrder: {
3131
+ /** 创建支付宝扫码支付订单(当面付) */
1528
3132
  post: (body: {
1529
- featureKey?: string;
1530
- startTime: string;
1531
- endTime: string;
1532
- granularity: "hour" | "day" | "week" | "month";
3133
+ packageId: string;
3134
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3135
+ };
3136
+ orders: {
3137
+ /** 查询用户的充值订单记录 */
3138
+ post: (body: {
3139
+ status?: string;
3140
+ page?: number;
3141
+ pageSize?: number;
1533
3142
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1534
3143
  };
1535
- };
1536
- invoices: {
1537
3144
  find: {
1538
- /** 分页查询发票列表(管理端) */
3145
+ /** 管理端分页查询全部积分充值订单 */
1539
3146
  post: (body: {
1540
3147
  current: number;
1541
3148
  pageSize: number;
1542
3149
  where: {
1543
3150
  userId?: string;
1544
- subscriptionId?: string;
1545
3151
  status?: string;
1546
3152
  startTime?: string;
1547
3153
  endTime?: string;
1548
3154
  };
1549
3155
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1550
3156
  };
1551
- findOne: {
1552
- /** 根据 ID 查询发票详情 */
1553
- post: (body: {
1554
- id: string;
1555
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1556
- };
1557
- my: {
1558
- /** 查询当前用户的发票列表 */
1559
- post: (body: {
1560
- current?: number;
1561
- pageSize?: number;
1562
- status?: string;
1563
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1564
- };
1565
- pay: {
1566
- /** 支付我的账单 */
3157
+ detail: {
3158
+ /** 管理端查询单个积分充值订单详情及操作时间线 */
1567
3159
  post: (body: {
1568
- id: string;
3160
+ orderId: string;
1569
3161
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1570
3162
  };
1571
- void: {
1572
- /** 作废发票 */
3163
+ adminStatistics: {
3164
+ /** 管理端积分充值订单统计 */
1573
3165
  post: (body: {
1574
- id: string;
1575
- reason?: string;
3166
+ startTime?: string;
3167
+ endTime?: string;
1576
3168
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1577
3169
  };
1578
3170
  statistics: {
1579
- /** 获取发票统计数据 */
3171
+ /** 获取用户积分充值订单统计 */
1580
3172
  post: (body: {
1581
3173
  startTime?: string;
1582
3174
  endTime?: string;
1583
3175
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1584
3176
  };
1585
- revenueReport: {
1586
- /** 获取收入报表数据 */
1587
- post: (body: {
1588
- startTime: string;
1589
- endTime: string;
1590
- granularity: "day" | "week" | "month" | "year";
1591
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3177
+ statusOptions: {
3178
+ /** 获取积分充值订单状态下拉选项与展示文案 */
3179
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1592
3180
  };
1593
- stats: {
1594
- /** 供其他服务查询发票统计数据 */
3181
+ verifyPayment: {
3182
+ /** 查询支付宝订单状态,如果已支付则完成充值 */
1595
3183
  post: (body: {
1596
- appId: string;
1597
- userIds: string[];
1598
- status?: string;
3184
+ orderId: string;
1599
3185
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1600
3186
  };
1601
- statsByUser: {
1602
- /** 供其他服务按用户分组查询发票统计 */
1603
- post: (body: {
1604
- appId: string;
1605
- userIds: string[];
1606
- status?: string;
1607
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3187
+ notify: {
3188
+ alipay: {
3189
+ /** 支付宝积分充值回调通知 */
3190
+ post: (body: Record<string, unknown>, config?: RequestConfig) => Promise<ApiResponse<any>>;
3191
+ };
1608
3192
  };
1609
3193
  };
1610
- points: {
1611
- account: {
1612
- /** 查询用户积分账户余额 */
3194
+ rechargePackage: {
3195
+ list: {
3196
+ /** 获取充值套餐列表(管理端) */
1613
3197
  post: (body: {
1614
- userId?: string;
3198
+ includeDisabled?: boolean;
1615
3199
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1616
3200
  };
1617
- earn: {
1618
- /** 发放积分(充值、奖励等) */
3201
+ create: {
3202
+ /** 创建新的充值套餐 */
1619
3203
  post: (body: {
1620
- userId: string;
1621
- amount: number;
1622
- subType: "recharge" | "referral" | "signup" | "subscription" | "activity" | "bonus";
1623
- requestId?: string;
1624
- description: string;
1625
- orderId?: string;
1626
- referrerId?: string;
1627
- ruleId?: string;
1628
- metadata?: Record<string, unknown>;
3204
+ name: string;
3205
+ price: number;
3206
+ points: number;
3207
+ bonus: number;
3208
+ description?: string;
3209
+ sort?: number;
1629
3210
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1630
3211
  };
1631
- consumeByPrice: {
1632
- /** 根据计价配置消费积分 */
3212
+ update: {
3213
+ /** 更新充值套餐信息 */
1633
3214
  post: (body: {
1634
- userId: string;
1635
- priceCode: string;
1636
- quantity?: number;
1637
- requestId?: string;
3215
+ id: string;
3216
+ name?: string;
3217
+ price?: number;
3218
+ points?: number;
3219
+ bonus?: number;
1638
3220
  description?: string;
1639
- metadata?: Record<string, unknown>;
3221
+ sort?: number;
3222
+ enabled?: boolean;
1640
3223
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1641
3224
  };
1642
- checkBalance: {
1643
- /** 检查积分是否足够(不扣费) */
3225
+ delete: {
3226
+ /** 删除充值套餐 */
1644
3227
  post: (body: {
1645
- userId: string;
1646
- priceCode: string;
1647
- quantity?: number;
3228
+ id: string;
1648
3229
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1649
3230
  };
1650
- reversal: {
1651
- /** 冲正/退还已消费的积分 */
3231
+ updateSort: {
3232
+ /** 批量更新套餐排序 */
1652
3233
  post: (body: {
1653
- userId: string;
1654
- originalTransactionId: string;
1655
- requestId?: string;
1656
- reason: string;
3234
+ items: {
3235
+ id: string;
3236
+ sort: number;
3237
+ }[];
1657
3238
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1658
3239
  };
1659
- clawback: {
1660
- /** 追回/扣回已发放的积分 */
3240
+ };
3241
+ refund: {
3242
+ apply: {
3243
+ /** 对已支付订单申请退款 */
1661
3244
  post: (body: {
1662
- userId: string;
1663
- originalTransactionId: string;
1664
- requestId?: string;
1665
- reason: string;
3245
+ orderId: string;
3246
+ reason?: string;
3247
+ refundAmount?: number;
1666
3248
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1667
3249
  };
1668
- adjust: {
1669
- /** 人工调整积分(加/减) */
3250
+ applySubscription: {
3251
+ /** 对已支付订阅账单申请退款 */
1670
3252
  post: (body: {
1671
- userId: string;
1672
- amount: number;
1673
- requestId?: string;
1674
- reason: string;
1675
- relatedOrderId?: string;
3253
+ invoiceId: string;
3254
+ reason?: string;
3255
+ refundAmount?: number;
3256
+ subscriptionAction?: "cancel_immediate" | "none";
1676
3257
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1677
3258
  };
1678
- batchAdjust: {
1679
- /** 批量调整多用户积分 */
3259
+ approve: {
3260
+ /** 审批退款申请(通过或拒绝) */
1680
3261
  post: (body: {
1681
- userIds: string[];
1682
- amount: number;
1683
- requestId?: string;
1684
- reason: string;
3262
+ refundNo: string;
3263
+ action: "approve" | "reject";
3264
+ remark?: string;
1685
3265
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1686
3266
  };
1687
- statistics: {
1688
- /** 获取用户积分统计数据 */
3267
+ execute: {
3268
+ /** 执行已审批的退款(调用支付宝/微信退款接口) */
1689
3269
  post: (body: {
1690
- userId?: string;
3270
+ refundNo: string;
1691
3271
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1692
3272
  };
1693
- leaderboard: {
1694
- /** 获取积分排行榜 */
3273
+ manual: {
3274
+ /** 管理员手动标记退款完成(用于线上接口故障或特殊情况) */
1695
3275
  post: (body: {
1696
- limit?: number;
3276
+ refundNo: string;
3277
+ manualRefundNo?: string;
3278
+ remark: string;
1697
3279
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1698
3280
  };
1699
- };
1700
- pointsHistory: {
1701
- find: {
1702
- /** 分页查询积分变动历史 */
3281
+ list: {
3282
+ /** 查询退款记录列表 */
1703
3283
  post: (body: {
1704
- userId?: string;
1705
- type?: "earn" | "spend" | "reversal" | "clawback" | "adjust";
1706
- subType?: string;
1707
3284
  page?: number;
1708
3285
  pageSize?: number;
3286
+ status?: string;
3287
+ sourceType?: "points_recharge" | "subscription_invoice";
3288
+ userId?: string;
1709
3289
  startDate?: string;
1710
3290
  endDate?: string;
1711
3291
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1712
3292
  };
1713
- findOne: {
1714
- /** 根据 ID 查询积分历史详情 */
1715
- post: (body: {
1716
- id: string;
1717
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1718
- };
1719
- statistics: {
1720
- /** 获取积分统计数据 */
3293
+ detail: {
3294
+ /** 查询单个退款单详情 */
1721
3295
  post: (body: {
1722
- userId?: string;
1723
- period?: "day" | "week" | "month" | "year";
3296
+ refundNo: string;
1724
3297
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1725
3298
  };
1726
- getTrendChart: {
1727
- /** 获取积分变动趋势图表数据 */
3299
+ stats: {
3300
+ /** 获取退款统计数据 */
1728
3301
  post: (body: {
1729
- userId?: string;
1730
- startTime: string;
1731
- endTime: string;
1732
- granularity: "minute" | "hour" | "day" | "month" | "year";
3302
+ startDate?: string;
3303
+ endDate?: string;
1733
3304
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1734
3305
  };
1735
- getTypeDistributionChart: {
1736
- /** 获取积分类型分布图表数据 */
3306
+ syncStatus: {
3307
+ /** 手动同步单个退款单的支付宝退款状态 */
1737
3308
  post: (body: {
1738
- userId?: string;
1739
- startTime?: string;
1740
- endTime?: string;
3309
+ refundNo: string;
1741
3310
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1742
3311
  };
1743
- getRankingChart: {
1744
- /** 获取用户积分排行榜 */
1745
- post: (body: {
1746
- type?: "earn" | "spend" | "reversal" | "clawback" | "adjust";
1747
- startTime?: string;
1748
- endTime?: string;
1749
- limit?: number;
1750
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3312
+ statusOptions: {
3313
+ /** 获取退款单状态下拉选项与展示文案 */
3314
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1751
3315
  };
1752
3316
  };
1753
- pointsTrigger: {
1754
- trigger: {
1755
- /** 根据规则 ID 触发积分发放 */
1756
- post: (body: {
1757
- ruleId: string;
1758
- eventData?: Record<string, unknown>;
1759
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1760
- };
1761
- triggerByEvent: {
1762
- /** 根据事件自动匹配并触发积分规则 */
3317
+ serviceDefinition: {
3318
+ list: {
3319
+ /** 获取应用的所有服务定义 */
1763
3320
  post: (body: {
1764
- event: string;
1765
- eventData?: Record<string, unknown>;
1766
- userId?: string;
3321
+ page?: number;
3322
+ pageSize?: number;
1767
3323
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1768
3324
  };
1769
- batchTrigger: {
1770
- /** 批量触发多个积分规则 */
3325
+ create: {
3326
+ /** 创建新的服务定义 */
1771
3327
  post: (body: {
1772
- triggers: {
1773
- ruleId: string;
1774
- eventData?: Record<string, unknown>;
1775
- }[];
3328
+ serviceType: string;
3329
+ name: string;
3330
+ description?: string;
3331
+ billingUnit: string;
3332
+ billingMode?: "event" | "continuous";
1776
3333
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1777
3334
  };
1778
- };
1779
- pointsTriggerHistory: {
1780
- find: {
1781
- /** 分页查询积分触发历史记录 */
3335
+ update: {
3336
+ /** 更新服务定义 */
1782
3337
  post: (body: {
1783
- current?: number;
1784
- pageSize?: number;
1785
- where?: {
1786
- userId?: string;
1787
- ruleId?: string;
1788
- ruleCode?: string;
1789
- event?: string;
1790
- status?: "pending" | "success" | "completed" | "failed" | "cooldown" | "constraintFailed";
1791
- rewardTarget?: "self" | "referrer";
1792
- startDate?: string;
1793
- endDate?: string;
1794
- };
3338
+ id: string;
3339
+ name?: string;
3340
+ description?: string;
3341
+ billingUnit?: string;
3342
+ billingMode?: "event" | "continuous";
3343
+ enabled?: boolean;
1795
3344
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1796
3345
  };
1797
- findOne: {
1798
- /** 根据 ID 查询积分触发历史详情 */
3346
+ delete: {
3347
+ /** 删除服务定义 */
1799
3348
  post: (body: {
1800
3349
  id: string;
1801
3350
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1802
3351
  };
1803
- statusOptions: {
1804
- /** 获取积分触发状态下拉选项 */
1805
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1806
- };
1807
- rewardTargetOptions: {
1808
- /** 获取奖励目标下拉选项 */
1809
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1810
- };
1811
- statistics: {
1812
- /** 获取积分触发历史统计数据 */
3352
+ };
3353
+ pricingRule: {
3354
+ get: {
3355
+ /** 获取服务的定价规则 */
1813
3356
  post: (body: {
1814
- userId?: string;
1815
- ruleId?: string;
1816
- startTime?: string;
1817
- endTime?: string;
1818
- period?: "today" | "week" | "month" | "year";
3357
+ serviceType: string;
1819
3358
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1820
3359
  };
1821
- trends: {
1822
- /** 获取积分触发趋势图表数据 */
3360
+ save: {
3361
+ /** 创建或更新定价规则 */
1823
3362
  post: (body: {
1824
- userId?: string;
1825
- ruleId?: string;
1826
- startTime?: string;
1827
- endTime?: string;
1828
- granularity?: "minute" | "hour" | "day" | "month" | "year";
3363
+ serviceType: string;
3364
+ tiers?: {
3365
+ minUsage: number;
3366
+ maxUsage: number | null;
3367
+ pricePerUnit: number;
3368
+ }[];
3369
+ flatPrice?: number | null;
3370
+ freeQuota?: number;
3371
+ profitMargin?: number;
3372
+ enabled?: boolean;
1829
3373
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1830
3374
  };
1831
- pointsTrends: {
1832
- /** 获取积分变动趋势图表数据 */
3375
+ };
3376
+ usage: {
3377
+ report: {
3378
+ /** 上报服务用量,自动计费扣费 */
1833
3379
  post: (body: {
1834
- userId?: string;
1835
- ruleId?: string;
1836
- startTime?: string;
1837
- endTime?: string;
1838
- granularity?: "minute" | "hour" | "day" | "month" | "year";
3380
+ serviceType: string;
3381
+ metadata: Record<string, unknown>;
3382
+ requestId?: string;
1839
3383
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1840
3384
  };
1841
- completionAnalysis: {
1842
- /** 获取积分规则完成度分析数据 */
3385
+ preview: {
3386
+ /** 按当前定价规则预估本次用量费用,不写入记录、不扣积分 */
1843
3387
  post: (body: {
1844
- userId?: string;
1845
- ruleId?: string;
1846
- startTime?: string;
1847
- endTime?: string;
3388
+ serviceType: string;
3389
+ metadata: Record<string, unknown>;
3390
+ freeQuotaOverride?: number;
1848
3391
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1849
3392
  };
1850
- triggerTypeTrends: {
1851
- /** 获取积分触发类型趋势图表数据 */
3393
+ stats: {
3394
+ /** 获取用量统计数据 */
1852
3395
  post: (body: {
1853
- userId?: string;
1854
- ruleId?: string;
1855
- startTime?: string;
1856
- endTime?: string;
1857
- granularity?: "minute" | "hour" | "day" | "month" | "year";
3396
+ startDate?: string;
3397
+ endDate?: string;
3398
+ serviceType?: string;
3399
+ groupBy?: "day" | "service" | "user";
1858
3400
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1859
3401
  };
1860
- };
1861
- pointsTriggerRule: {
1862
- create: {
1863
- /** 创建新积分触发规则 */
3402
+ records: {
3403
+ /** 获取用量记录列表 */
1864
3404
  post: (body: {
1865
- ruleName: string;
1866
- ruleCode: string;
1867
- description: string;
1868
- event?: string;
1869
- triggerCondition: unknown;
1870
- pointsReward: unknown;
1871
- constraints: unknown;
1872
- activeTimeRanges: unknown;
3405
+ page?: number;
3406
+ pageSize?: number;
3407
+ serviceType?: string;
3408
+ startDate?: string;
3409
+ endDate?: string;
1873
3410
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1874
3411
  };
1875
- find: {
1876
- /** 分页查询积分触发规则列表 */
3412
+ };
3413
+ export: {
3414
+ recharge: {
3415
+ /** 导出充值订单记录为 CSV 格式 */
1877
3416
  post: (body: {
1878
- current?: number;
1879
- pageSize?: number;
1880
- where?: {
1881
- triggerType?: string;
1882
- status?: string;
1883
- ruleName?: string;
1884
- ruleCode?: string;
1885
- event?: string;
1886
- };
3417
+ startDate?: string;
3418
+ endDate?: string;
3419
+ status?: string;
1887
3420
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1888
3421
  };
1889
- findOne: {
1890
- /** 根据 ID 查询积分触发规则详情 */
3422
+ refund: {
3423
+ /** 导出退款记录为 CSV 格式 */
1891
3424
  post: (body: {
1892
- id: string;
3425
+ startDate?: string;
3426
+ endDate?: string;
3427
+ status?: string;
1893
3428
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1894
3429
  };
1895
- update: {
1896
- /** 更新积分触发规则配置 */
3430
+ pointsHistory: {
3431
+ /** 导出积分变动记录为 CSV 格式 */
1897
3432
  post: (body: {
1898
- id: string;
1899
- ruleName?: string;
1900
- ruleCode?: string;
1901
- description?: string;
1902
- event?: string | null;
1903
- triggerCondition?: unknown;
1904
- pointsReward?: unknown;
1905
- constraints?: unknown;
1906
- activeTimeRanges?: unknown;
3433
+ startDate?: string;
3434
+ endDate?: string;
3435
+ type?: string;
3436
+ userId?: string;
1907
3437
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1908
3438
  };
1909
- updateStatus: {
1910
- /** 启用或禁用积分触发规则 */
3439
+ };
3440
+ financeReport: {
3441
+ overview: {
3442
+ /** 获取收入概览数据 */
1911
3443
  post: (body: {
1912
- id: string;
1913
- status: "draft" | "active" | "inactive";
3444
+ startDate?: string;
3445
+ endDate?: string;
1914
3446
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1915
3447
  };
1916
- delete: {
1917
- /** 删除积分触发规则 */
3448
+ trend: {
3449
+ /** 获取收入趋势数据(按日/周/月) */
1918
3450
  post: (body: {
1919
- id: string;
3451
+ period: "day" | "week" | "month";
3452
+ days?: number;
1920
3453
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1921
3454
  };
1922
- statusOptions: {
1923
- /** 获取积分触发规则状态下拉选项 */
1924
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3455
+ packageRank: {
3456
+ /** 获取套餐销售排行数据 */
3457
+ post: (body: {
3458
+ startDate?: string;
3459
+ endDate?: string;
3460
+ limit?: number;
3461
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1925
3462
  };
1926
- eventOptions: {
1927
- /** 获取可绑定的事件类型选项 */
1928
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3463
+ userRank: {
3464
+ /** 获取用户充值排行数据 */
3465
+ post: (body: {
3466
+ startDate?: string;
3467
+ endDate?: string;
3468
+ limit?: number;
3469
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1929
3470
  };
1930
3471
  };
1931
- pointsPriceConfig: {
1932
- create: {
1933
- /** 创建新的积分计价配置 */
3472
+ reconciliation: {
3473
+ generate: {
3474
+ /** 生成指定日期的对账报告 */
1934
3475
  post: (body: {
1935
- code: string;
1936
- name: string;
1937
- description?: string;
1938
- billingMode: "per_request" | "per_unit";
1939
- unitPrice: number;
1940
- unit?: string;
1941
- minCharge?: number;
1942
- status?: "active" | "inactive";
3476
+ date: string;
1943
3477
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1944
3478
  };
1945
- find: {
1946
- /** 分页查询计价配置列表 */
3479
+ list: {
3480
+ /** 查询对账报告列表 */
1947
3481
  post: (body: {
1948
- where?: {
1949
- code?: string;
1950
- name?: string;
1951
- billingMode?: string;
1952
- status?: string;
1953
- };
1954
3482
  page?: number;
1955
3483
  pageSize?: number;
3484
+ status?: string;
3485
+ startDate?: string;
3486
+ endDate?: string;
1956
3487
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1957
3488
  };
1958
- findOne: {
1959
- /** 根据 ID 或 code 查询计价配置详情 */
1960
- post: (body: {
1961
- id?: string;
1962
- code?: string;
1963
- }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1964
- };
1965
- update: {
1966
- /** 更新计价配置 */
3489
+ detail: {
3490
+ /** 查询对账报告详情 */
1967
3491
  post: (body: {
1968
3492
  id: string;
1969
- name?: string;
1970
- description?: string;
1971
- billingMode?: "per_request" | "per_unit";
1972
- unitPrice?: number;
1973
- unit?: string;
1974
- minCharge?: number;
1975
- status?: "active" | "inactive";
1976
3493
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1977
3494
  };
1978
- updateStatus: {
1979
- /** 启用或停用计价配置 */
3495
+ processAnomaly: {
3496
+ /** 处理对账异常订单 */
1980
3497
  post: (body: {
1981
- id: string;
1982
- status: "active" | "inactive";
3498
+ reportId: string;
3499
+ orderId: string;
3500
+ action: "confirm_paid" | "mark_cancelled" | "ignore";
3501
+ remark?: string;
1983
3502
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1984
3503
  };
1985
- delete: {
1986
- /** 删除计价配置 */
3504
+ batchGenerate: {
3505
+ /** 批量生成指定日期范围的对账报告 */
1987
3506
  post: (body: {
1988
- id: string;
3507
+ startDate: string;
3508
+ endDate: string;
1989
3509
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
1990
3510
  };
1991
- billingModeOptions: {
1992
- /** 获取计费方式下拉选项 */
1993
- post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
1994
- };
1995
3511
  };
1996
- pointsUsageRecord: {
1997
- find: {
1998
- /** 分页查询积分消费记录 */
3512
+ invoice: {
3513
+ apply: {
3514
+ /** 申请开具发票 */
3515
+ post: (body: {
3516
+ invoiceType: "personal" | "company" | "vat_special";
3517
+ title: string;
3518
+ taxNumber?: string;
3519
+ companyAddress?: string;
3520
+ companyPhone?: string;
3521
+ bankName?: string;
3522
+ bankAccount?: string;
3523
+ email: string;
3524
+ receiverName?: string;
3525
+ receiverPhone?: string;
3526
+ receiverAddress?: string;
3527
+ orderIds?: string[];
3528
+ remark?: string;
3529
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3530
+ };
3531
+ list: {
3532
+ /** 查询发票申请列表 */
1999
3533
  post: (body: {
2000
- where?: {
2001
- userId?: string;
2002
- priceCode?: string;
2003
- priceName?: string;
2004
- billingMode?: string;
2005
- startDate?: string;
2006
- endDate?: string;
2007
- };
2008
3534
  page?: number;
2009
3535
  pageSize?: number;
3536
+ status?: string;
3537
+ userId?: string;
3538
+ startDate?: string;
3539
+ endDate?: string;
2010
3540
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2011
3541
  };
2012
- statistics: {
2013
- /** 按维度统计消费数据 */
3542
+ detail: {
3543
+ /** 查询发票详情 */
2014
3544
  post: (body: {
2015
- dimension: "priceCode" | "userId" | "date";
2016
- startDate?: string;
2017
- endDate?: string;
2018
- priceCode?: string;
2019
- userId?: string;
2020
- limit?: number;
3545
+ invoiceNo: string;
2021
3546
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2022
3547
  };
2023
- overview: {
2024
- /** 获取消费概览数据 */
3548
+ review: {
3549
+ /** 审核发票申请(通过/拒绝) */
3550
+ post: (body: {
3551
+ invoiceNo: string;
3552
+ action: "approve" | "reject";
3553
+ remark?: string;
3554
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3555
+ };
3556
+ issue: {
3557
+ /** 标记发票已开具 */
3558
+ post: (body: {
3559
+ invoiceNo: string;
3560
+ invoiceCode?: string;
3561
+ invoiceNumber?: string;
3562
+ invoiceUrl?: string;
3563
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3564
+ };
3565
+ stats: {
3566
+ /** 获取发票统计数据 */
2025
3567
  post: (body: {
2026
3568
  startDate?: string;
2027
3569
  endDate?: string;
2028
3570
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2029
3571
  };
3572
+ cancel: {
3573
+ /** 取消发票申请(仅待审核状态可取消) */
3574
+ post: (body: {
3575
+ invoiceNo: string;
3576
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3577
+ };
2030
3578
  };
2031
- pointsBalanceAlert: {
2032
- upsertConfig: {
2033
- /** 创建或更新预警配置 */
3579
+ agreement: {
3580
+ create: {
3581
+ /** 创建支付宝签约代扣授权 */
2034
3582
  post: (body: {
2035
- threshold: number;
2036
- enabled?: boolean;
2037
- notifyEmail?: boolean;
2038
- notifyEmails?: string[];
2039
- cooldownHours?: number;
3583
+ periodType: "DAY" | "MONTH" | "YEAR";
3584
+ period: number;
3585
+ singleAmount: number;
3586
+ totalAmount?: number;
2040
3587
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2041
3588
  };
2042
- getConfig: {
2043
- /** 获取当前预警配置 */
3589
+ query: {
3590
+ /** 查询签约状态 */
3591
+ post: (body: {
3592
+ externalAgreementNo?: string;
3593
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3594
+ };
3595
+ my: {
3596
+ /** 获取当前用户的签约信息 */
2044
3597
  post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2045
3598
  };
2046
- findAlerts: {
2047
- /** 分页查询预警记录 */
3599
+ unsign: {
3600
+ /** 解除签约授权 */
3601
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3602
+ };
3603
+ history: {
3604
+ /** 查询签约历史记录 */
2048
3605
  post: (body: {
2049
- where?: {
2050
- userId?: string;
2051
- alertType?: string;
2052
- startDate?: string;
2053
- endDate?: string;
2054
- };
2055
3606
  page?: number;
2056
3607
  pageSize?: number;
2057
3608
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2058
3609
  };
2059
- triggerCheck: {
2060
- /** 手动触发预警检查(测试用) */
3610
+ deductLogs: {
3611
+ /** 查询代扣扣款记录 */
2061
3612
  post: (body: {
2062
- userId: string;
3613
+ page?: number;
3614
+ pageSize?: number;
2063
3615
  }, config?: RequestConfig) => Promise<ApiResponse<any>>;
2064
3616
  };
3617
+ signNotify: {
3618
+ /** 支付宝签约异步通知回调 */
3619
+ post: (config?: RequestConfig) => Promise<ApiResponse<any>>;
3620
+ };
3621
+ };
3622
+ internal: {
3623
+ events: {
3624
+ trigger: {
3625
+ /** 供 auth-server 等内部服务发布业务事件 */
3626
+ post: (body: {
3627
+ appId: string;
3628
+ userId: string;
3629
+ event: string;
3630
+ eventData?: Record<string, unknown>;
3631
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3632
+ };
3633
+ };
3634
+ usage: {
3635
+ preview: {
3636
+ /** 供内部服务预估通用计费用量,不写入记录、不扣积分 */
3637
+ post: (body: {
3638
+ appId: string;
3639
+ userId: string;
3640
+ serviceType: string;
3641
+ amount: number;
3642
+ freeQuotaOverride?: number;
3643
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3644
+ };
3645
+ previewBatch: {
3646
+ /** 供内部服务批量预估通用计费用量,不写入记录、不扣积分 */
3647
+ post: (body: {
3648
+ appId: string;
3649
+ items: {
3650
+ key: string;
3651
+ userId: string;
3652
+ serviceType: string;
3653
+ amount: number;
3654
+ freeQuotaOverride?: number;
3655
+ }[];
3656
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3657
+ };
3658
+ report: {
3659
+ /** 供内部服务上报通用计费用量并扣积分 */
3660
+ post: (body: {
3661
+ appId: string;
3662
+ userId: string;
3663
+ serviceType: string;
3664
+ amount: number;
3665
+ metadata?: Record<string, unknown>;
3666
+ requestId?: string;
3667
+ usageKind?: "event" | "continuous_settlement";
3668
+ periodStart?: string;
3669
+ periodEnd?: string;
3670
+ freeQuotaOverride?: number;
3671
+ }, config?: RequestConfig) => Promise<ApiResponse<any>>;
3672
+ };
3673
+ };
2065
3674
  };
2066
3675
  webhooks: {
2067
3676
  events: {
@@ -2077,12 +3686,6 @@ export interface ApiClient {
2077
3686
  get: (config?: RequestConfig) => Promise<ApiResponse<any>>;
2078
3687
  };
2079
3688
  };
2080
- notify: {
2081
- alipay: {
2082
- /** 支付宝订阅支付回调通知 */
2083
- post: (body: Record<string, unknown>, config?: RequestConfig) => Promise<ApiResponse<any>>;
2084
- };
2085
- };
2086
3689
  }
2087
3690
  /** API 客户端类型别名(基于 EdenClient 推断,提供完整类型检查) */
2088
3691
  export type ApiClientType = EdenClient<Api>;