individualwaterpool.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package individualwaterpool
  2. import (
  3. "bet24.com/log"
  4. pb "bet24.com/servers/micros/waterpool/proto"
  5. )
  6. func Run() {
  7. mgr = newWaterPoolManager()
  8. }
  9. func Dump(cmd, param1 string) {
  10. switch cmd {
  11. case "user":
  12. mgr.dumpUser(param1)
  13. case "config":
  14. mgr.config.dump()
  15. case "updata":
  16. mgr.loadRedisConfig()
  17. default:
  18. log.Release("individual.Dump unhandled cmd %s", cmd)
  19. }
  20. }
  21. // 用户进入,创建用户信息
  22. func AddUser(userId int) {
  23. mgr.addUser(userId)
  24. }
  25. // 将用户标记为离线
  26. func RemoveUser(userId int) {
  27. mgr.removeUser(userId)
  28. }
  29. func GetUserPoolType(userId, gameId, gameType, baseScore, gold int, isMatch bool, param int) (int, int) {
  30. return mgr.getUserPoolType(userId, gameId, gameType, baseScore, gold, isMatch, param)
  31. }
  32. func GrantUserNewWaterPool(userId, value int, genType string) {
  33. mgr.grantNewWaterPool(userId, value, genType)
  34. }
  35. func UpdataUserWaterPool(userId, amount int, genType string, roomType, roomID int) {
  36. mgr.updataUserWaterPool(userId, amount, genType, roomType, roomID)
  37. }
  38. func GetUserWaterPool(userId int) int {
  39. return mgr.getUserWaterPool(userId)
  40. }
  41. func GetUserWaterPoolGrantRecords(userId, beginTime, endTime, pageIndex, pageSize int) pb.GrantRecords {
  42. return mgr.getUserWaterPoolGrantRecords(userId, beginTime, endTime, pageIndex, pageSize)
  43. }