user_profit.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package entity
  2. import "github.com/shopspring/decimal"
  3. // 用户收益信息
  4. // UserProfit 用户收益统计表 - 从UserQuota表中分离出来减少表压力
  5. type UserProfit struct {
  6. MysqlTimeModel
  7. UserId int64 `json:"userId" gorm:"primarykey;not null;comment:用户ID"`
  8. Uid string `json:"uid" gorm:"unique;index;type:varchar(64);comment:交易所ID"`
  9. // 日任务 节点收益统计
  10. NodeProfitQuantity decimal.Decimal `json:"nodeProfitQuantity" gorm:"type:decimal(25,8);default:0;comment:累计节点产出系统币"`
  11. NodeProfitUsdAmount decimal.Decimal `json:"nodeProfitUsdAmount" gorm:"type:decimal(25,8);default:0;comment:累计节点产出USD价值"`
  12. // 日任务 todo: 各种排名收益指标
  13. // todo: 动态收益 -- 实际到账
  14. TodayDynamicProfitQuantity decimal.Decimal `json:"todayDynamicProfitQuantity" gorm:"type:decimal(25,8);default:0;comment:当日动态奖励产出系统币"`
  15. DynamicProfitQuantity decimal.Decimal `json:"dynamicProfitQuantity" gorm:"type:decimal(25,8);default:0;comment:累计动态奖励系统币"`
  16. DynamicProfitUsdAmount decimal.Decimal `json:"dynamicProfitUsdAmount" gorm:"type:decimal(25,8);default:0;comment:累计动态奖励USD价值"`
  17. // todo: 静态收益 -- 已领取 实际到资产钱包
  18. StaticProfitQuantity decimal.Decimal `json:"staticProfitQuantity" gorm:"type:decimal(25,8);default:0;comment:累计静态产出系统币"`
  19. StaticProfitUsdAmount decimal.Decimal `json:"staticProfitUsdAmount" gorm:"type:decimal(25,8);default:0;comment:累计静态产出USD价值"`
  20. // 总收益币+USD价值
  21. TotalProfitQuantity decimal.Decimal `json:"totalProfitQuantity" gorm:"type:decimal(25,8);default:0;comment:总收益币"`
  22. TotalProfitUsd decimal.Decimal `json:"totalProfitUsd" gorm:"type:decimal(25,8);default:0;comment:总收益USD价值"`
  23. }
  24. func (*UserProfit) TableName() string {
  25. return ModelPrefix + "user_profit"
  26. }
  27. func (*UserProfit) Comment() string {
  28. return "用户收益统计表"
  29. }
  30. func NewUserProfit() *UserProfit {
  31. return &UserProfit{}
  32. }