common.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. package model
  2. import (
  3. "database/sql/driver"
  4. "fmt"
  5. jsoniter "github.com/json-iterator/go"
  6. )
  7. type PageResult struct {
  8. List any `json:"list"`
  9. Total int64 `json:"total"`
  10. }
  11. // PageInfo Paging common input parameter structure
  12. type PageInfo struct {
  13. Page int64 `json:"page" form:"page"` // 页码
  14. PageSize int64 `json:"pageSize" form:"pageSize"` // 每页大小
  15. Keyword string `json:"keyword" form:"keyword"` // 关键字
  16. }
  17. // ReqById Find by id structure
  18. type ReqById struct {
  19. Id int64 `json:"id" form:"id"` // 主键ID
  20. }
  21. // ReqByType Find by type structure
  22. type ReqByType struct {
  23. Type string `json:"type" form:"type"` // 类型
  24. }
  25. // ActPrize 活动奖励格式
  26. type ActPrize struct {
  27. Type int64 `json:"type"`
  28. Num int64 `json:"num"`
  29. Rtype int64 `json:"rtype"`
  30. Skin int64 `json:"skin"`
  31. IsTs int64 `json:"is_ts,omitempty"`
  32. }
  33. // PropPrize 除活动外的奖励格式
  34. type PropPrize struct {
  35. PropsId int64 `json:"propsId"`
  36. Num int64 `json:"num"`
  37. Skin int64 `json:"skin"`
  38. Rtype int64 `json:"rtype"`
  39. }
  40. type PropPrizes []PropPrize
  41. func (e *PropPrizes) Value() (driver.Value, error) {
  42. return jsoniter.Marshal(e)
  43. }
  44. // Scan 实现方法
  45. func (e *PropPrizes) Scan(input interface{}) error {
  46. return jsoniter.Unmarshal(input.([]byte), &e)
  47. }
  48. // StartEnd 范围
  49. type StartEnd struct {
  50. Start int64 `json:"start"`
  51. End int64 `json:"end"`
  52. }
  53. // LvRange 等级分组
  54. type LvRange struct {
  55. LvStart int64 `json:"lvStart"`
  56. LvEnd int64 `json:"lvEnd"`
  57. }
  58. // SpinsRange 体力分组
  59. type SpinsRange struct {
  60. SpinsStart int64 `json:"spinsStart"`
  61. SpinsEnd int64 `json:"spinsEnd"`
  62. }
  63. // VipPointRange Vip积分分组
  64. type VipPointRange struct {
  65. VipPointStart int64 `json:"vipPointStart"`
  66. VipPointEnd int64 `json:"vipPointEnd"`
  67. }
  68. // LostHourRange 流失小时分组
  69. type LostHourRange struct {
  70. LostHourStart int64 `json:"lostHourStart"`
  71. LostHourEnd int64 `json:"lostHourEnd"`
  72. }
  73. // StarRange 星星数分组
  74. type StarRange struct {
  75. StarStart int64 `json:"starStart"`
  76. StarEnd int64 `json:"starEnd"`
  77. }
  78. // CoinYRange Y值分组
  79. type CoinYRange struct {
  80. CoinYStart int64 `json:"coinYStart"`
  81. CoinYEnd int64 `json:"coinYEnd"`
  82. }
  83. // SsGroup 数数分组
  84. type SsGroup struct {
  85. Shushu []int64 `json:"shushu"`
  86. }
  87. // SlotWeightGroup 老虎机权重分组
  88. type SlotWeightGroup struct {
  89. SlotWeightGroup int64 `json:"slotWeightGroup"`
  90. }
  91. // OneLayerLvGroup 等级 一层分组
  92. type OneLayerLvGroup struct {
  93. Id int64 `json:"id"`
  94. LvRange
  95. }
  96. // OneLayerSsGroup 数数 一层分组
  97. type OneLayerSsGroup struct {
  98. Id int64 `json:"id"`
  99. SsGroup
  100. }
  101. // TwoLayerLvSpins 等级=>体力 两层分组
  102. type TwoLayerLvSpins struct {
  103. Id int64 `json:"id"`
  104. LvRange
  105. SpinsRange
  106. }
  107. // TwoLayerLvSsGroup 等级=>数数 两层分组
  108. type TwoLayerLvSsGroup struct {
  109. Id int64 `json:"id"`
  110. LvRange
  111. SsGroup
  112. }
  113. // ThreeLayer 等级=>体力=>数数 三层分组
  114. type ThreeLayer struct {
  115. Id int64 `json:"id"`
  116. LvRange
  117. SpinsRange
  118. SsGroup
  119. }
  120. type PrizeShow struct {
  121. PropsId int64 `json:"propsId"`
  122. Num int64 `json:"num"`
  123. Skin int64 `json:"skin"`
  124. JokerCardExpireTime int64 `json:"jokerCardExpireTime"`
  125. Cards []CardInfo `json:"cards"`
  126. ChestProps *ChestProps `json:"chestProps,omitempty"`
  127. SkinResourceId int64 `json:"skinResourceId"`
  128. }
  129. type CardInfo struct {
  130. Id int64 `json:"id"`
  131. IsNew bool `json:"isNew"`
  132. }
  133. type ChestProps struct {
  134. Skin int64 `json:"skin"`
  135. CardNum int64 `json:"cardNum"`
  136. JokerCardNum int64 `json:"jokerCardNum"`
  137. CoinsNum []int64 `json:"coinsNum"`
  138. SpinsNum []int64 `json:"spinsNum"`
  139. PetExp []int64 `json:"petExp"`
  140. PetFood int64 `json:"petFood"`
  141. SkinResourceId int64 `json:"skinResourceId"` //道具皮肤资源id
  142. LastRewardPid int64 `json:"lastRewardPid"` //最终大奖类型
  143. Props []*PrizeShow `json:"props"` //额外奖励道具
  144. }
  145. type Option struct {
  146. Value int64 `json:"value"`
  147. Label string `json:"label"`
  148. }
  149. type Options []Option
  150. type Option2 struct {
  151. Value string `json:"value"`
  152. Label string `json:"label"`
  153. }
  154. type Options2 []Option2
  155. type CollectFullConf struct {
  156. CollectBaseConf
  157. OneHit int64 `json:"one_hit"`
  158. TwoHit int64 `json:"two_hit"`
  159. ThreeHit int64 `json:"three_hit"`
  160. ConfType int64 `json:"confType"`
  161. }
  162. type CollectBaseConf struct {
  163. StealBreak int64 `json:"steal_break"` // 普通偷
  164. StealSuccess int64 `json:"steal_success"` // 完美偷
  165. AttackSuccess int64 `json:"attack_success"` // 打成功
  166. AttackBreak int64 `json:"attack_break"` // 打到盾
  167. }
  168. type ItemTitle struct {
  169. Item string `db:"item" json:"item"` // 类别
  170. Title string `db:"title" json:"title"` // 参数名 KEY
  171. }
  172. func (i *ItemTitle) String() string {
  173. return i.Item + "-" + i.Title
  174. }
  175. type Lang struct {
  176. ZH string `json:"ZH"` // 中文
  177. EN string `json:"EN"` // 英文
  178. TW string `json:"TW"` // 繁体
  179. FR string `json:"FR"` // 法语
  180. PT string `json:"PT"` // 葡萄牙语
  181. DE string `json:"DE"` // 德语
  182. ES string `json:"ES"` // 西班牙语
  183. TH string `json:"TH"` // 泰语
  184. ID string `json:"ID"` // 印尼语
  185. VI string `json:"VI"` // 越南语
  186. NO string `json:"NO"` // 挪威语
  187. RO string `json:"RO"` // 罗马尼亚
  188. MY string `json:"MY"` // 马来西亚
  189. IT string `json:"IT"` // 意大利
  190. PL string `json:"PL"` // 波兰
  191. }
  192. type EmailRepo struct {
  193. Id int64 `json:"id" db:"id"`
  194. Uid int64 `json:"uid" db:"uid"`
  195. Msgid int64 `json:"msgid" db:"msgid"`
  196. Got int64 `json:"got" db:"got"`
  197. Rewards any `json:"rewards" db:"rewards"`
  198. Expire int64 `json:"expire" db:"expire"`
  199. CreateTime int64 `json:"create_time" db:"create_time"`
  200. }
  201. func (*EmailRepo) TableName(uid int64) string {
  202. dbIdx := uid % 100
  203. return fmt.Sprintf("crazygod_user_sysmail.user_sysmail_%v", dbIdx)
  204. }