slotmgr.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package slot
  2. import (
  3. "sort"
  4. )
  5. var mgr *slotManager
  6. type slotManager struct {
  7. statDetail_list map[string][]*statInfo
  8. }
  9. func Run() {
  10. mgr = new(slotManager)
  11. mgr.statDetail_list = make(map[string][]*statInfo)
  12. }
  13. // 统计列表
  14. func (this *slotManager) getStat(req req_base) (*statInfo, []*statInfo) {
  15. var list []*statInfo
  16. info := new(statInfo)
  17. for _, v := range getStat(req) {
  18. info.InvestAmount += v.InvestAmount
  19. if v.InvestAmount%100 == 0 {
  20. info.BetAmount += v.BetAmount
  21. info.BetTimes += v.BetTimes
  22. info.WinTimes += v.WinTimes
  23. }
  24. info.ResultAmount += v.ResultAmount
  25. info.WinAmount += v.WinAmount
  26. info.Tax += v.Tax
  27. list = append(list, v)
  28. }
  29. sort.SliceStable(list, func(i, j int) bool {
  30. return list[i].InvestAmount < list[j].InvestAmount
  31. })
  32. return info, list
  33. }
  34. // 统计详情
  35. func (this *slotManager) getStatDetail(req req_base) []*statInfo {
  36. return getStatDetail(req)
  37. }
  38. // 统计列表
  39. func (this *slotManager) getChipStat(req req_base) (*statInfo, []*statInfo) {
  40. var list []*statInfo
  41. info := new(statInfo)
  42. for _, v := range getChipStat(req) {
  43. info.InvestAmount += v.InvestAmount
  44. if v.InvestAmount%100 == 0 {
  45. info.BetAmount += v.BetAmount
  46. info.BetTimes += v.BetTimes
  47. info.WinTimes += v.WinTimes
  48. }
  49. info.ResultAmount += v.ResultAmount
  50. info.WinAmount += v.WinAmount
  51. info.Tax += v.Tax
  52. list = append(list, v)
  53. }
  54. sort.SliceStable(list, func(i, j int) bool {
  55. return list[i].InvestAmount < list[j].InvestAmount
  56. })
  57. return info, list
  58. }
  59. // 统计详情
  60. func (this *slotManager) getChipStatDetail(req req_base) []*statInfo {
  61. return getChipStatDetail(req)
  62. }