comcode.go 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package comcode
  2. import (
  3. "active/tools"
  4. "fmt"
  5. )
  6. var conf = &Config{}
  7. type Config struct {
  8. AwardMap map[string][][]int64 `json:"award_map" yaml:"award_map"`
  9. LimitMap map[string]int `json:"limit_map" yaml:"limit_map"`
  10. DailyLimitMap map[string]int `json:"daily_limit_map" yaml:"daily_limit_map"`
  11. NameMap map[string]string `json:"name_map" yaml:"name_map"`
  12. ChannelAPPMap map[string][][]int32 `json:"channel_app_map" yaml:"channel_app_map"`
  13. ErrMap map[string]string `json:"err_map" yaml:"err_map"`
  14. TotalNumber map[string]int `json:"total_number" yaml:"total_number"`
  15. OpenTime map[string]int64 `json:"open_time" yaml:"open_time"`
  16. EndTime map[string]int64 `json:"end_time" yaml:"end_time"`
  17. KbljVip888 map[string]int64 `json:"kblj_vip888" yaml:"kblj_vip888"`
  18. KbljOpentime int64 `json:"kblj_opentime" yaml:"kblj_opentime"`
  19. KbljEndtime int64 `json:"kblj_endtime" yaml:"kblj_endtime"`
  20. CommonCode map[string]int `json:"commoncode" yaml:"commoncode"`
  21. ZBCode ZBCodeConfig `json:"zb_code" yaml:"zb_code"` // zb类型兑换码
  22. FLCode ZBCodeConfig `json:"fl_code" yaml:"fl_code"` // fl类型兑换码
  23. WeileCode WeileCodeConfig `json:"weile888" yaml:"weile888"`
  24. Weile666Code WeileCodeConfig `json:"weile666" yaml:"weile666"`
  25. WL777Code WeileCodeConfig `json:"wl777" yaml:"wl777"`
  26. WLCJ666Code WeileCodeConfig `json:"wlcj666" yaml:"wlcj666"`
  27. Vip9999 WeileCodeConfig `json:"vip9999" yaml:"vip9999"` //【ID1024244】【web】提供通码,斗地主直播研究院用
  28. Vip666 WeileCodeConfig `json:"vip666" yaml:"vip666"` // 【ID1013546】【web】生成一个通用兑换码vip666
  29. WL1001 WeileCodeConfig `json:"wl1001" yaml:"wl1001"` // 【ID1013546】【web】生成一个通用兑换码vip666
  30. Common8 Common8CodeConfig `json:"common8" yaml:"common8"` // 【ID1025900】【活动】通用兑换码需求
  31. }
  32. // ZB类型兑换码
  33. type ZBCodeConfig struct {
  34. Code []string `yaml:"code"` //兑换码
  35. Prob []int `yaml:"prob"` //概率
  36. Award [][]int64 `yaml:"award"` //豆豆奖励范围
  37. OpenTime int `yaml:"open_time"` //开始时间
  38. EndTime int `yaml:"end_time"` //结束时间
  39. }
  40. // weile类型兑换码
  41. type WeileCodeConfig struct {
  42. Code string `yaml:"code"` //兑换码
  43. Award [][]int64 `yaml:"award"` //豆豆奖励
  44. OpenTime int `yaml:"open_time"` //开始时间
  45. EndTime int `yaml:"end_time"` //结束时间
  46. AppId []int `yaml:"appid"` //appid
  47. Channel []int `yaml:"channel"` //渠道
  48. }
  49. type Common8CodeConfig struct {
  50. Code []string `yaml:"code"` //兑换码
  51. Award [][]int64 `yaml:"award"` //豆豆奖励
  52. OpenTime int `yaml:"open_time"` //开始时间
  53. EndTime int `yaml:"end_time"` //结束时间
  54. AppId []int `yaml:"appid"` //appid
  55. Channel []int `yaml:"channel"` //渠道
  56. }
  57. func Init() {
  58. tools.ReloadYaml("comcode.yaml", conf)
  59. }
  60. func ConfInstance() *Config {
  61. return conf
  62. }
  63. func (this *Config) GetAwardList(activeId string, awardId int64) [][]int64 {
  64. awardList, result := this.AwardMap[fmt.Sprintf("%v_%v", activeId, awardId)]
  65. if !result {
  66. return [][]int64{}
  67. }
  68. tmp := make([][]int64, len(awardList))
  69. copy(tmp, awardList)
  70. return tmp
  71. }