sys_period_job.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package entity
  2. import "github.com/shopspring/decimal"
  3. // todo:每批次奖励计算与发放统计数据
  4. // 记录每批次各类奖励总发放数量
  5. const (
  6. PeriodJobStateWaiting = "waiting" // 等待中
  7. PeriodJobStateRunning = "running" // 进行中
  8. PeriodJobStateSuccess = "success" // 成功
  9. PeriodJobStateFailure = "failure" // 失败
  10. )
  11. type StakePeriodJob struct {
  12. MysqlBaseModel
  13. PeriodNo string `json:"periodNo" gorm:"uniqueIndex;comment:期编号"`
  14. JobState string `json:"jobState" gorm:"type:varchar(32);comment:状态:running 进行中 success 成功 failure 失败"`
  15. Price decimal.Decimal `json:"price" gorm:"type:decimal(25,8);default:0;comment:当期单价"`
  16. // todo: 静态奖励数量 动态奖励数量 节点奖励数量 排行榜奖励数量...
  17. StaticSymbolProfit decimal.Decimal `json:"staticSymbolProfit" gorm:"type:decimal(25,8);default:0;comment:期静态币总收益"`
  18. StaticUsdProfit decimal.Decimal `json:"staticUsdProfit" gorm:"type:decimal(25,8);default:0;comment:期USD总收益"`
  19. LevelProfit decimal.Decimal `json:"levelProfit" gorm:"type:decimal(25,8);default:0;comment:动态等级奖励"`
  20. LevelProfitIsCal bool `json:"levelProfitIsCal" gorm:"default:0;comment:动态等级奖励是否计算完成"`
  21. Desc string `json:"desc" gorm:"type:text;comment:错误信息"`
  22. }
  23. func (*StakePeriodJob) TableName() string {
  24. return SysModelPrefix + "stake_period_job"
  25. }
  26. func (*StakePeriodJob) Comment() string {
  27. return "质押期任务"
  28. }
  29. func NewStakePeriodJob() *StakePeriodJob {
  30. return &StakePeriodJob{}
  31. }