subsidy.go 982 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package subsidy
  2. import (
  3. "bet24.com/log"
  4. )
  5. var mgr *subsidymgr
  6. // 补助
  7. type Subsidy struct {
  8. GiftTimes int //已领取次数
  9. Amount int //领取金币数
  10. CoolTime int // 冷却时间戳
  11. Crdate int //时间戳
  12. IsGift bool //是否可以领取
  13. LowerAmount int //低于金额触发
  14. MaxTimes int //总次数
  15. }
  16. func Run() {
  17. log.Debug("subsidy running")
  18. mgr = newSubsidyMgr()
  19. }
  20. // 获取补助信息
  21. func GetSubsidyInfo(userId, lowerAmount int, maxTimes int) *Subsidy {
  22. return mgr.getInfo(userId, lowerAmount, maxTimes)
  23. }
  24. // 领取补助信息
  25. func GiftSubsidy(userId, lowerAmount int, maxTime int, coolSeconds []int) (int, string) {
  26. return mgr.gift(userId, lowerAmount, maxTime, coolSeconds)
  27. }
  28. // 领取元宝补助信息
  29. func GiftChipSubsidy(userId, lowerAmount int, ipAddress string) bool {
  30. return mgr.giftChip(userId, lowerAmount, ipAddress)
  31. }
  32. // 领取回归奖励
  33. func GiftReturnAward(userId int) {
  34. mgr.giftReturnAward(userId)
  35. }