configv2.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package wxbroadcastv2
  2. import "sync"
  3. var (
  4. confv2 Configv2
  5. upListConf UpListConf
  6. poolConfv2 = sync.Pool{
  7. New: newConfigV2,
  8. }
  9. )
  10. func newConfigV2() interface{} {
  11. temp := &Configv2{}
  12. for _, award := range confv2.AwardList {
  13. temp.AwardList = append(temp.AwardList, &Award{
  14. TaskId: award.TaskId,
  15. AwardTitle: award.AwardTitle,
  16. Bean: award.Bean,
  17. AwardType: award.AwardType,
  18. Type: award.Type,
  19. TotalProcess: award.TotalProcess,
  20. Rate: award.Rate,
  21. BeanList: award.BeanList,
  22. })
  23. }
  24. for _, award := range confv2.AwardListV1 {
  25. temp.AwardListV1 = append(temp.AwardListV1, &Award{
  26. TaskId: award.TaskId,
  27. AwardTitle: award.AwardTitle,
  28. Bean: award.Bean,
  29. AwardType: award.AwardType,
  30. Type: award.Type,
  31. TotalProcess: award.TotalProcess,
  32. Rate: award.Rate,
  33. BeanList: award.BeanList,
  34. })
  35. }
  36. return temp
  37. }
  38. type Configv2 struct {
  39. AwardList []*Award `yaml:"award_list" json:"award_list"`
  40. AwardListV1 []*Award `yaml:"award_listv1" json:"award_listv1"`
  41. Time int64 `json:"time"`
  42. GameNumber int64 `json:"game_number"`
  43. }
  44. type Award struct {
  45. TaskId int64 `json:"task_id" yaml:"task_id"`
  46. AwardTitle string `json:"award_title" yaml:"award_title"`
  47. Bean int64 `json:"bean" yaml:"bean"`
  48. Rate []int64 `json:"-" yaml:"rate"`
  49. BeanList [][]int64 `json:"-" yaml:"bean_list"`
  50. AwardType int64 `json:"award_type" yaml:"award_type"` // 0表示豆豆,1表示宝箱1, 2表示宝箱2, 3表示宝箱3, 4表示宝箱4
  51. Type int64 `json:"type" yaml:"type"` //0 首次 1 是局数 2 时间 3是 连续3天数 4 是连续4天数
  52. Status int64 `json:"status" yaml:"status"`
  53. PreProcess int64 `json:"pre_process" yaml:"pre_process"`
  54. TotalProcess int64 `json:"total_process" yaml:"total_process"`
  55. }
  56. func Instancev2() *sync.Pool {
  57. return &poolConfv2
  58. }
  59. func GetUpAwardListConf() (temp []*UpAward) {
  60. det := make([]UpAward, len(upListConf.UpawardList))
  61. copy(det, upListConf.UpawardList)
  62. for i := range det {
  63. temp = append(temp, &det[i])
  64. }
  65. return temp
  66. }