Files
team-api/internal/model/entity/bil_wallets.go
T
chengqian 108078614d fix: 金额 float64 → decimal 全链路迁移,消除浮点累积漂移
将全库资金金额从 float64 迁移到 shopspring/decimal,落定边界架构:
入口 NewFromFloat → 内部多步运算全程 decimal → 出口 InexactFloat64;
DB NUMERIC(20,10) 走 driver.Valuer 精确直传,Redis 钱包用整数 micro-USD,
CNY→USD 换汇仅在 payment.FulfillOrder recharge 分支。

- money.go 重写为 decimal 原生(运算/收敛/比较/边界/micro 工具)
- billing/tenant/admin/payment/open/task 各层金额运算 decimal 化
- entity/do 资金列重生成为 decimal.Decimal(可空列 *decimal.Decimal)
- 000013 迁移:非金额 NUMERIC 列 → double precision(5 表 13 列)
- Res 出口 .InexactFloat64() 收敛,JSONB 快照缝隙显式转 float64
- CLAUDE.md 新增 decimal 强约束;补充迁移基线/完成总结文档
2026-07-23 22:08:54 +08:00

25 lines
2.4 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
"github.com/shopspring/decimal"
)
// BilWallets is the golang structure for table bil_wallets.
type BilWallets struct {
Id int64 `json:"id" orm:"id" description:"主键ID"` // 主键ID
TenantId int64 `json:"tenant_id" orm:"tenant_id" description:"租户ID(每个租户一个钱包)"` // 租户ID(每个租户一个钱包)
Balance decimal.Decimal `json:"balance" orm:"balance" description:"总余额"` // 总余额
FrozenBalance decimal.Decimal `json:"frozen_balance" orm:"frozen_balance" description:"冻结余额(支付中/退款中,可用余额 = balance - frozen_balance)"` // 冻结余额(支付中/退款中,可用余额 = balance - frozen_balance)
WarningThreshold *decimal.Decimal `json:"warning_threshold" orm:"warning_threshold" description:"余额预警线(低于此值触发通知)"` // 余额预警线(低于此值触发通知)
Currency string `json:"currency" orm:"currency" description:"货币(USD)"` // 货币(USD)
CreatedAt *gtime.Time `json:"created_at" orm:"created_at" description:"创建时间"` // 创建时间
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at" description:"更新时间"` // 更新时间
CumulativeRecharge decimal.Decimal `json:"cumulative_recharge" orm:"cumulative_recharge" description:"累计充值总额(USD)"` // 累计充值总额(USD)
LowBalanceNotified bool `json:"low_balance_notified" orm:"low_balance_notified" description:"低余额预警是否已推送(充值恢复后重置为 false)"` // 低余额预警是否已推送(充值恢复后重置为 false)
}