manager.go 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. package service
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/coreservice/agent"
  5. "bet24.com/servers/coreservice/announce"
  6. "bet24.com/servers/coreservice/award"
  7. "bet24.com/servers/coreservice/bet"
  8. "bet24.com/servers/coreservice/card"
  9. "bet24.com/servers/coreservice/chat"
  10. "bet24.com/servers/coreservice/client"
  11. "bet24.com/servers/coreservice/coupontask"
  12. "bet24.com/servers/coreservice/exchange"
  13. "bet24.com/servers/coreservice/friend"
  14. "bet24.com/servers/coreservice/gamelist"
  15. "bet24.com/servers/coreservice/giftpack"
  16. "bet24.com/servers/coreservice/gold2chipwheel"
  17. "bet24.com/servers/coreservice/jackpot"
  18. "bet24.com/servers/coreservice/keyword"
  19. "bet24.com/servers/coreservice/limiteditems"
  20. "bet24.com/servers/coreservice/monthlycard"
  21. "bet24.com/servers/coreservice/newusergift"
  22. "bet24.com/servers/coreservice/prizewheel"
  23. "bet24.com/servers/coreservice/purchase"
  24. "bet24.com/servers/coreservice/qqwry"
  25. "bet24.com/servers/coreservice/rank"
  26. "bet24.com/servers/coreservice/redpoint"
  27. "bet24.com/servers/coreservice/shop"
  28. "bet24.com/servers/coreservice/signin"
  29. "bet24.com/servers/coreservice/signinwheel"
  30. "bet24.com/servers/coreservice/slotscore"
  31. "bet24.com/servers/coreservice/spread"
  32. "bet24.com/servers/coreservice/subsidy"
  33. "bet24.com/servers/coreservice/teacher"
  34. "bet24.com/servers/coreservice/track"
  35. "bet24.com/servers/coreservice/userwin"
  36. "bet24.com/servers/coreservice/video"
  37. "bet24.com/servers/coreservice/vitality"
  38. activityservice "bet24.com/servers/micros/activityservice/proto"
  39. inventory "bet24.com/servers/micros/item_inventory/proto"
  40. notification "bet24.com/servers/micros/notification/proto"
  41. task "bet24.com/servers/micros/task/proto"
  42. robot "bet24.com/servers/micros/userservices/proto"
  43. vipservice "bet24.com/servers/micros/userservices/proto"
  44. )
  45. type manager struct {
  46. }
  47. func newManager() *manager {
  48. qqwry.Run()
  49. rank.Run()
  50. monthlycard.Run()
  51. giftpack.Run()
  52. shop.Run()
  53. prizewheel.Run()
  54. subsidy.Run()
  55. vitality.Run()
  56. redpoint.Run()
  57. exchange.Run()
  58. bet.Run()
  59. chat.Run()
  60. friend.Run()
  61. jackpot.Run()
  62. signinwheel.Run()
  63. track.Run()
  64. newusergift.Run()
  65. spread.Run() // 推广
  66. video.Run() // 视频
  67. teacher.Run() // 师徒
  68. coupontask.Run() // 红包券任务
  69. slotscore.Run()
  70. gamelist.Run()
  71. signin.Run()
  72. agent.Run() // 代理体系
  73. gold2chipwheel.Run()
  74. purchase.Run() // 100K购
  75. award.Run() // 奖励模块
  76. limiteditems.Run()
  77. keyword.Run()
  78. //battlepass.Run(inventory.AddItems)
  79. announce.Run() // 公告
  80. card.Run()
  81. userwin.Run()
  82. log.Release("coreservice running")
  83. return mgr
  84. }
  85. func (m *manager) onUserEnter(userId int, ipAddress string) client.Response {
  86. var ret client.Response
  87. ret.RetCode = 1
  88. if robot.IsRobot(userId) {
  89. return ret
  90. }
  91. log.Debug("manager.onUserEnter %d", userId)
  92. notification.AddUser(userId)
  93. friend.AddUser(userId)
  94. inventory.AddUser(userId, ipAddress)
  95. signin.AddUser(userId)
  96. task.AddUser(userId)
  97. //userservices.AddUser(userId)
  98. vitality.AddUser(userId)
  99. monthlycard.AddUser(userId)
  100. giftpack.AddUser(userId)
  101. prizewheel.AddUser(userId)
  102. video.AddUser(userId)
  103. coupontask.AddUser(userId)
  104. redpoint.AddUser(userId) // 放到最后
  105. chat.OnUserEnter(userId)
  106. userwin.AddUser(userId)
  107. vipservice.AddUser(userId) // 新版vip
  108. activityservice.AddUser(userId)
  109. return ret
  110. }
  111. func (m *manager) onUserExit(userId int) client.Response {
  112. var ret client.Response
  113. ret.RetCode = 1
  114. if robot.IsRobot(userId) {
  115. return ret
  116. }
  117. log.Debug("manager.onUserExit %d", userId)
  118. notification.RemoveUser(userId)
  119. redpoint.RemoveUser(userId)
  120. inventory.RemoveUser(userId)
  121. signin.RemoveUser(userId)
  122. task.RemoveUser(userId)
  123. //userservices.RemoveUser(userId)
  124. vitality.RemoveUser(userId)
  125. monthlycard.RemoveUser(userId)
  126. giftpack.RemoveUser(userId)
  127. friend.RemoveUser(userId)
  128. prizewheel.RemoveUser(userId)
  129. video.RemoveUser(userId)
  130. coupontask.RemoveUser(userId)
  131. userwin.RemoveUser(userId)
  132. chat.OnUserExit(userId)
  133. vipservice.RemoveUser(userId) // 新版vip
  134. activityservice.RemoveUser(userId)
  135. return ret
  136. }
  137. func (m *manager) syncUserList(userlist []int) {
  138. }