asset_bill.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package entity
  2. import (
  3. "github.com/shopspring/decimal"
  4. )
  5. // Bill 资产流水
  6. type AssetBill struct {
  7. MysqlBaseModel
  8. AssetId int64 `json:"assetId" gorm:"comment:资产表ID"`
  9. UserId int64 `json:"userId" gorm:"index;index:idx_business_create_hour;index:idx_user_business_created;comment:用户ID;NOT NULL"`
  10. Uid string `json:"uid" gorm:"index;index:idx_uid_business_number;comment:用户UID;NOT NULL"`
  11. Symbol string `json:"symbol" gorm:"comment:币种名;type:VARCHAR(20)"`
  12. BusinessNumber int `json:"businessNumber" gorm:"index:idx_user_business_created;index:idx_uid_business_number;type:INT(10);comment:业务场景;NOT NULL"`
  13. BusinessName string `json:"businessName" gorm:"index:idx_business_create_hour;type:VARCHAR(50);comment:业务场名称"`
  14. BeforeAmount decimal.Decimal `json:"beforeAmount" gorm:"type:decimal(25,8); comment:交易前可用余额;NOT NULL"`
  15. Balance decimal.Decimal `json:"balance" gorm:"type:decimal(25,8); default:0;comment:净资产;"`
  16. Frozen decimal.Decimal `json:"frozen" gorm:"type:decimal(25,8);default:0;comment:冻结资产"`
  17. Amount decimal.Decimal `json:"amount" gorm:"type:decimal(25,8);comment:发生可用金额;NOT NULL"`
  18. AfterAmount decimal.Decimal `json:"afterAmount" gorm:"type:decimal(25,8);comment:交易后可用余额;NOT NULL"`
  19. ContextName string `json:"contextName" gorm:"type:VARCHAR(128);comment:上下文名"`
  20. ContextValue string `json:"contextValue" gorm:"type:VARCHAR(128);comment:上下文值"`
  21. Describe string `json:"describe" gorm:"type:text;comment:流水备注信息"`
  22. }
  23. func (*AssetBill) TableName() string {
  24. return ModelPrefix + "asset_bill"
  25. }
  26. func (*AssetBill) Comment() string {
  27. return "用户资产变化流水"
  28. }
  29. func NewAssetBill() *AssetBill {
  30. return &AssetBill{}
  31. }