feat(supply-api): 完善domain层和main入口

修改内容:
- cmd/supply-api/main.go: 完善HTTP API入口和路由配置
- go.mod: 更新依赖版本
- domain/account.go: 完善账户领域模型
- domain/package.go: 完善套餐领域模型
- domain/settlement.go: 完善结算领域模型

这些是supply-api的核心domain层实现
This commit is contained in:
Your Name
2026-04-01 08:53:47 +08:00
parent 0196ee5d47
commit ecb5fad1c9
5 changed files with 560 additions and 70 deletions

View File

@@ -3,6 +3,7 @@ package domain
import (
"context"
"errors"
"net/netip"
"time"
"lijiaoqiao/supply-api/internal/audit"
@@ -29,18 +30,40 @@ const (
// 结算单
type Settlement struct {
ID int64 `json:"settlement_id"`
SupplierID int64 `json:"supplier_id"`
SettlementNo string `json:"settlement_no"`
Status SettlementStatus `json:"status"`
TotalAmount float64 `json:"total_amount"`
FeeAmount float64 `json:"fee_amount"`
NetAmount float64 `json:"net_amount"`
PaymentMethod PaymentMethod `json:"payment_method"`
PaymentAccount string `json:"payment_account,omitempty"`
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID int64 `json:"settlement_id"`
SupplierID int64 `json:"supplier_id"`
SettlementNo string `json:"settlement_no"`
Status SettlementStatus `json:"status"`
TotalAmount float64 `json:"total_amount"`
FeeAmount float64 `json:"fee_amount"`
NetAmount float64 `json:"net_amount"`
PaymentMethod PaymentMethod `json:"payment_method"`
PaymentAccount string `json:"payment_account,omitempty"`
PaymentTransactionID string `json:"payment_transaction_id,omitempty"`
PaidAt *time.Time `json:"paid_at,omitempty"`
// 账期 (XR-001)
PeriodStart time.Time `json:"period_start"`
PeriodEnd time.Time `json:"period_end"`
TotalOrders int `json:"total_orders"`
TotalUsageRecords int `json:"total_usage_records"`
// 单位与币种 (XR-001)
CurrencyCode string `json:"currency_code"`
AmountUnit string `json:"amount_unit"`
// 幂等字段 (XR-001)
RequestID string `json:"request_id,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
// 审计字段 (XR-001)
AuditTraceID string `json:"audit_trace_id,omitempty"`
Version int `json:"version"`
CreatedIP *netip.Addr `json:"created_ip,omitempty"`
UpdatedIP *netip.Addr `json:"updated_ip,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// 收益记录