setsmatch.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package setsmatch
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/matches/handler/matchbase"
  5. )
  6. func Run() {
  7. log.Release("setsmatch.Run")
  8. getMatchManager().run()
  9. getHistoryManager().run()
  10. }
  11. func Dump(param1, param2 string) {
  12. if param1 == "history" {
  13. getHistoryManager().dump(param2)
  14. return
  15. }
  16. getMatchManager().dump(param1, param2)
  17. }
  18. // 接口
  19. // 创建比赛,返回比赛ID
  20. func CreateMatch(userId int, gameId int, gameRule string, totalUserCount int, tableUserCount int,
  21. enrollFee int, prize int, playTimeout int, winnerCount int) (int, string) {
  22. return getMatchManager().createMatch(userId, gameId, gameRule, totalUserCount, tableUserCount, enrollFee, prize, playTimeout,
  23. winnerCount)
  24. }
  25. func EnrollMatch(userId int, nickname string, faceId int, faceUrl string, matchNo int) (int, string) {
  26. ok, errMsg := getMatchManager().enrollMatch(userId, nickname, faceId, faceUrl, matchNo)
  27. if ok {
  28. return 1, errMsg
  29. }
  30. return 0, errMsg
  31. }
  32. func CloseMatch(userId int, matchNo int) (int, string) {
  33. ok, errMsg := getMatchManager().closeMatchByOwner(userId, matchNo)
  34. if ok {
  35. return 1, errMsg
  36. }
  37. return 0, errMsg
  38. }
  39. func QuitMatch(userId int, matchNo int) bool {
  40. return getMatchManager().quitMatch(userId, matchNo)
  41. }
  42. func GetMatchInfo(matchNo int) string {
  43. return getMatchManager().getMatchInfo(matchNo)
  44. }
  45. func GetUserMatches(userId int) string {
  46. return getMatchManager().getUserMatches(userId)
  47. }
  48. func GetMatchConfigs() string {
  49. return getMatchManager().getMatchConfigs()
  50. }
  51. func Flush() {
  52. getHistoryManager().forceFlush()
  53. }
  54. func GetEnrolledMatch(userId int) string {
  55. return getMatchManager().getEnrolledMatch(userId)
  56. }
  57. func GetMatchHistory(userId int) string {
  58. return getHistoryManager().getHistory(userId)
  59. }
  60. func GetMatchInstance(matchNo int) matchbase.MatchInstance {
  61. return getMatchManager().getMatchInstance(matchNo)
  62. }
  63. func DismissMatch(matchNo int) {
  64. getMatchManager().dismissMatch(matchNo)
  65. }