sevendayac.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package model
  2. import (
  3. "leafstalk/otherutils/deepcopy"
  4. "strconv"
  5. "xorm.io/xorm"
  6. )
  7. type PlayerSevenDayAc struct {
  8. Id int64
  9. PlayerId int64 `xorm:"BIGINT 'playerid'"`
  10. StartTs int64 `xorm:"BIGINT 'startts'"`
  11. TotalPoints int64 `xorm:"BIGINT 'totalpoints'"`
  12. ChallengeAwards map[int64]*ChallengeTaskStatus `xorm:"TEXT json 'challengeAwards'"` // 任务完成状态 {taskType:任务状态} 0:未完成 1:已完成未领取 2:已领取
  13. GiftAwards map[int64]int64 `xorm:"TEXT json 'giftAwards'"` // 礼包购买状态 {uid:购买次数}
  14. PointAward int64 `xorm:"TEXT json 'pointAward'"` // 已领取积分奖励最大的uid
  15. GateId int64 `xorm:"-"`
  16. }
  17. type ChallengeTaskStatus struct {
  18. ClaimedAwards map[int64]struct{} `json:"claimedAwards"` // 已领取的uids {uid:{}}
  19. Progress int64 `json:"progress"` // 任务进度
  20. }
  21. func (m PlayerSevenDayAc) TableName() string {
  22. return "player_sevenday_ac"
  23. }
  24. func (m *PlayerSevenDayAc) QueryExist(eng *xorm.Engine) (bool, error) {
  25. player := new(PlayerSevenDayAc)
  26. player.PlayerId = m.PlayerId
  27. return eng.Exist(player)
  28. }
  29. func (m *PlayerSevenDayAc) UpdateDB(eng *xorm.Engine) (int64, error) {
  30. return eng.Where("playerid=?", m.PlayerId).AllCols().Update(m)
  31. }
  32. func (m *PlayerSevenDayAc) GetUniqueKey() string {
  33. return strconv.FormatInt(m.PlayerId, 10)
  34. }
  35. func CopyPlayerSevenDayAc(old *PlayerSevenDayAc) *PlayerSevenDayAc {
  36. nu := deepcopy.MustCopy(old).(*PlayerSevenDayAc)
  37. return nu
  38. }
  39. // 7日任务-SevenDayMission exported from 活动-7日活动.xlsx
  40. type SevenDayMission struct {
  41. Uid int64 `json:"Uid"` // ID
  42. Days int64 `json:"Days"` // 天数
  43. TaskType int64 `json:"TaskType"` // 任务类型
  44. Value []int64 `json:"Value"` // 任务参数
  45. Reward [][]int64 `json:"Reward"` // 奖励
  46. Points int64 `json:"Points"` // 积分
  47. Des string `json:"Des"` // 任务描述
  48. } // package model
  49. // 7日礼包-SevenDayGiftPack exported from 活动-7日活动.xlsx
  50. type SevenDayGiftPack struct {
  51. Uid int64 `json:"Uid"` // ID
  52. Days int64 `json:"Days"` // 天数
  53. Name string `json:"Name"` // 礼包名称
  54. GiftPack [][]int64 `json:"GiftPack"` // 礼包
  55. Price []int64 `json:"Price"` // 价格
  56. CdrpId int64 `json:"CdrpId"` // 计费点
  57. Discount float64 `json:"Discount"` // 折扣 用于前端界面显示(百分比值)
  58. Quota int64 `json:"Quota"` // 限购次数
  59. Points int64 `json:"Points"` // 积分
  60. } // package model
  61. // 7日积分奖励-SevenDayActive exported from 活动-7日活动.xlsx
  62. type SevenDayActive struct {
  63. Uid int64 `json:"Uid"` // ID
  64. Points int64 `json:"Points"` // 积分
  65. Reward [][]int64 `json:"Reward"` // 奖励
  66. }