Model层:新增金额分字段定义

- 所有 Model 添加对应的 *Cent int64 字段
- 旧的 float64 字段保留但不输出到 JSON (json:"-")
- 涉及文件:user.go, listing.go, order.go, order_checkout.go, wallet.go, withdrawal.go
- 目标:为后续业务逻辑切换到分存储做准备

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
yml
2026-06-09 13:31:29 +08:00
co-authored by Claude Opus 4.8
parent eaa10d839c
commit b80719d538
6 changed files with 119 additions and 94 deletions
+13 -12
View File
@@ -3,18 +3,19 @@ package model
import "time"
type User struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Phone string `gorm:"size:32;not null;uniqueIndex" json:"phone"`
Nickname string `gorm:"size:64;not null;default:''" json:"nickname"`
AvatarURL string `gorm:"size:512;not null;default:''" json:"avatar_url"`
RealnameStatus string `gorm:"size:32;not null;default:'unverified'" json:"realname_status"`
RiskStatus string `gorm:"size:32;not null;default:'normal'" json:"risk_status"`
CreditScore int `gorm:"not null;default:100" json:"credit_score"`
DepositFreeQuota float64 `gorm:"type:decimal(12,2);not null;default:0" json:"deposit_free_quota"`
Status string `gorm:"size:32;not null;default:'active'" json:"status"`
LastLoginAt *time.Time `json:"last_login_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID uint64 `gorm:"primaryKey" json:"id"`
Phone string `gorm:"size:32;not null;uniqueIndex" json:"phone"`
Nickname string `gorm:"size:64;not null;default:''" json:"nickname"`
AvatarURL string `gorm:"size:512;not null;default:''" json:"avatar_url"`
RealnameStatus string `gorm:"size:32;not null;default:'unverified'" json:"realname_status"`
RiskStatus string `gorm:"size:32;not null;default:'normal'" json:"risk_status"`
CreditScore int `gorm:"not null;default:100" json:"credit_score"`
DepositFreeQuota float64 `gorm:"type:decimal(12,2);not null;default:0" json:"-"`
DepositFreeQuotaCent int64 `gorm:"not null;default:0" json:"-"`
Status string `gorm:"size:32;not null;default:'active'" json:"status"`
LastLoginAt *time.Time `json:"last_login_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (User) TableName() string {