Files
hfb_sys/backend/internal/modules/wallet/dto.go
T
ymlandClaude Opus 4.8 01909ee7e5 Wallet与Withdrawal模块:完成分字段重构
核心改造:
1. Wallet模块DTO层全部改为*Cent int64字段
2. Wallet.Entry结构从Amount float64改为AmountCent int64
3. Repository层applyEntry函数使用整数加减,无需浮点运算
4. Withdrawal模块DTO/Request全部改为*Cent字段
5. 所有wallet.AppendEntries调用点改为AmountCent
6. 提现手续费计算改为分单位

技术细节:
- 删除了roundWalletMoney函数(不再需要)
- toAccountDTO/toLedgerDTO使用*Cent字段
- 最小提现金额:10元=1000分
- 最大提现金额:5000元=500000分
- 编译验证通过 

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 13:44:20 +08:00

67 lines
2.0 KiB
Go

package wallet
import "time"
type AccountDTO struct {
UserID uint64 `json:"user_id"`
AvailableBalanceCent int64 `json:"available_balance_cent"`
FrozenBalanceCent int64 `json:"frozen_balance_cent"`
Status string `json:"status"`
}
type RechargeRequest struct {
AmountCent int64 `json:"amount_cent" binding:"required"`
}
type WithdrawRequest struct {
AmountCent int64 `json:"amount_cent" binding:"required"`
}
type LedgerDTO struct {
ID uint64 `json:"id"`
LedgerNo string `json:"ledger_no"`
UserID uint64 `json:"user_id"`
OrderID *uint64 `json:"order_id"`
Direction string `json:"direction"`
AmountCent int64 `json:"amount_cent"`
BalanceAfterCent int64 `json:"balance_after_cent"`
BalanceType string `json:"balance_type"`
BizType string `json:"biz_type"`
BizNo string `json:"biz_no"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"created_at"`
}
type AdminLedgerQuery struct {
UserID uint64
OrderID uint64
BizType string
Page int
PageSize int
}
type PaginatedResult struct {
Items interface{} `json:"items"`
Total int64 `json:"total"`
Page int `json:"page"`
PageSize int `json:"page_size"`
}
type AdminLedgerDTO struct {
ID uint64 `json:"id"`
LedgerNo string `json:"ledger_no"`
UserID uint64 `json:"user_id"`
UserPhone string `json:"user_phone"`
UserNickname string `json:"user_nickname"`
OrderID *uint64 `json:"order_id"`
OrderNo string `json:"order_no"`
Direction string `json:"direction"`
AmountCent int64 `json:"amount_cent"`
BalanceAfterCent int64 `json:"balance_after_cent"`
BalanceType string `json:"balance_type"`
BizType string `json:"biz_type"`
BizNo string `json:"biz_no"`
Remark string `json:"remark"`
CreatedAt time.Time `json:"created_at"`
}