mgr.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package report
  2. var mgr *reportManager
  3. type reportManager struct {
  4. list map[string][]*info
  5. }
  6. func Run() {
  7. mgr = new(reportManager)
  8. mgr.list = make(map[string][]*info)
  9. }
  10. // 录入日报数据
  11. func (this *reportManager) insertDaily(info *info) {
  12. defer this.clear()
  13. insertDaily(info)
  14. }
  15. // 删除日报数据
  16. func (this *reportManager) delDaily(id int) int {
  17. defer this.clear()
  18. return delDaily(id)
  19. }
  20. // 获取日报列表
  21. func (this *reportManager) getDailyList(beginTime, endTime string) []*info {
  22. return getDailyList(beginTime, endTime)
  23. }
  24. // 获取挑战赛列表
  25. func (this *reportManager) getSNGMatchList(beginTime, endTime string) []*info {
  26. return getSNGMatchList(beginTime, endTime)
  27. }
  28. // 获取游戏列表
  29. func (this *reportManager) getGameList(beginTime, endTime string) []*info {
  30. return getGameList(beginTime, endTime)
  31. }
  32. // 清空缓存
  33. func (this *reportManager) clear() {
  34. this.list = make(map[string][]*info)
  35. return
  36. }
  37. // 获取发行统计列表
  38. func (this *reportManager) getIssueStatList(beginTime, endTime string) []*info {
  39. return getIssueStatList(beginTime, endTime)
  40. }
  41. // 时段统计报表
  42. func (this *reportManager) timePeriodReport(beginTime, endTime string) []timePeriodInfo {
  43. return timePeriodReport(beginTime, endTime)
  44. }
  45. // 时段统计
  46. func (this *reportManager) timePeriodStat(beginTime, endTime string) []timePeriodInfo {
  47. return timePeriodStat(beginTime, endTime)
  48. }
  49. // 时段用户列表
  50. func (this *reportManager) timePeriodUsers(timePeriod string, beginTime, endTime string, pageIndex, pageSize int) (int, []timePeriodUser) {
  51. var (
  52. minSeconds int
  53. maxSeconds int
  54. )
  55. switch timePeriod {
  56. case "0~5分钟":
  57. minSeconds, maxSeconds = 0, 300
  58. case "5~15分钟":
  59. minSeconds, maxSeconds = 301, 900
  60. case "15~30分钟":
  61. minSeconds, maxSeconds = 901, 1800
  62. case "30~45分钟":
  63. minSeconds, maxSeconds = 1801, 2700
  64. case "45~60分钟":
  65. minSeconds, maxSeconds = 2701, 3600
  66. case "60~75分钟":
  67. minSeconds, maxSeconds = 3601, 4500
  68. case "75~90分钟":
  69. minSeconds, maxSeconds = 4501, 5400
  70. case "90~105分钟":
  71. minSeconds, maxSeconds = 5401, 6300
  72. case "105~120分钟":
  73. minSeconds, maxSeconds = 6301, 7200
  74. case "2小时以上":
  75. minSeconds, maxSeconds = 7201, 2000000000
  76. }
  77. return timePeriodUsers(minSeconds, maxSeconds, beginTime, endTime, pageIndex, pageSize)
  78. }