POST /internal/billing/export-user-data

服务间内部调用(compliance-service):导出指定用户在计费服务中的所有关联数据,含订阅、计费记录、信用余额、使用统计、用量告警和计量记录

计费服务 - 内部接口 None application/json

请求体

Schema: service-billing/internal/handler/dto.ExportUserDataRequest

字段类型必填示例约束描述
user_id string 是 usr_abc123

响应

状态描述Schema
200用户数据导出成功service-billing/internal/handler/dto.ExportUserDataResponse
400请求参数错误object
401未授权object
500服务器内部错误object

引用的 Schema

service-billing/internal/handler/dto.BillingRecordResponse

字段类型必填示例约束描述
amount number 否 99
app_id string 否 app_001
billing_cycle string 否 monthly
created_at string 否 2026-04-01T00:00:00Z
currency string 否 CNY
description string 否 专业版月度订阅
invoice_number string 否 INV-2026-001
line_items array of

参见 service-billing/internal/handler/dto.InvoiceLineItemResponse

否
plan string 否 pro
record_id string 否 rec_001
status string 否 paid
tenant_id string 否 tnt_xyz789
type string 否 subscription

service-billing/internal/handler/dto.CreditBalanceResponse

字段类型必填示例约束描述
balance number 否 150
currency string 否 CNY
tenant_id string 否 tnt_xyz789
updated_at string 否 2026-05-12T10:00:00Z

service-billing/internal/handler/dto.CreditTransactionResponse

字段类型必填示例约束描述
amount number 否 50
balance number 否 150
created_at string 否 2026-05-12T10:00:00Z
id string 否 ctr_001
remark string 否 套餐降级按比例信用
source string 否 proration
source_id string 否 sub_xyz789
tenant_id string 否 tnt_xyz789
type string 否 credit

service-billing/internal/handler/dto.ExportUserDataResponse

字段类型必填示例约束描述
code integer 否
data service-billing/internal/handler/dto.ExportUserDataResult 否
message string 否
timestamp string 否

service-billing/internal/handler/dto.ExportUserDataResult

字段类型必填示例约束描述
billing_records array of

参见 service-billing/internal/handler/dto.BillingRecordResponse

否
credit_balance service-billing/internal/handler/dto.CreditBalanceResponse 否
credit_transactions array of

参见 service-billing/internal/handler/dto.CreditTransactionResponse

否
exported_at string 否
metered_billing_records array of

参见 service-billing/internal/handler/dto.MeteredBillingExportItem

否
note string 否
subscription service-billing/internal/handler/dto.SubscriptionResponse 否
tenant_id string 否
usage_alerts array of

参见 service-billing/internal/handler/dto.UsageAlertResponse

否
usage_stats array of

参见 service-billing/internal/handler/dto.UsageStatsExportItem

否
user_id string 否

service-billing/internal/handler/dto.InvoiceLineItemResponse

字段类型必填示例约束描述
amount number 否 99
description string 否 专业版月度订阅
quantity integer 否 1
resource_type string 否 subscription
tax_amount number 否 5.94
tax_rate number 否 0.06
unit_price number 否 99

service-billing/internal/handler/dto.MeteredBillingExportItem

字段类型必填示例约束描述
included_units integer 否
overage_amount string 否
overage_units integer 否
period_end string 否
period_start string 否
resource_type string 否
status string 否
total_usage integer 否

service-billing/internal/handler/dto.SubscriptionResponse

字段类型必填示例约束描述
admin_user_id string 否 usr_abc123
amount number 否 499
auto_renew boolean 否 True
billing_cycle string 否 monthly
cancel_at_period_end boolean 否 False
currency string 否 CNY
current_period_end string 否 2026-02-01T00:00:00Z
current_period_start string 否 2026-01-01T00:00:00Z
grace_period_days integer 否 7
plan_id string 否 pro
status string 否 active
tenant_id string 否 tnt_xyz789
trial_end_date string 否 2026-01-15T00:00:00Z

service-billing/internal/handler/dto.UsageAlertResponse

字段类型必填示例约束描述
app_id string 否 app_001
created_at string 否 2026-05-01T00:00:00Z
id string 否 ua_001
last_triggered_at string 否 2026-05-10T08:00:00Z
name string 否 API调用量告警
notification_channels string 否 email,in_app
resource_type string 否 api_calls
status string 否 active
tenant_id string 否 tnt_xyz789
threshold_percent integer 否 80
updated_at string 否 2026-05-05T10:00:00Z

service-billing/internal/handler/dto.UsageStatsExportItem

字段类型必填示例约束描述
api_requests integer 否
bandwidth_used integer 否
date string 否
failed_logins integer 否
login_attempts integer 否
mfa_verifications integer 否
storage_used integer 否
user_count integer 否