simplematch.pb.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. package proto
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/common"
  5. "context"
  6. )
  7. type CreateSimpleMatch_req struct {
  8. Request
  9. GameId int
  10. GameRule string
  11. TotalUser int
  12. TableUser int
  13. Target int
  14. EnrollFee int
  15. Prize int
  16. PlayTime int
  17. ElimiantedByScore bool
  18. WinnerCount int
  19. }
  20. type SimpleMatch_req struct {
  21. Request
  22. MatchNo int
  23. }
  24. type EnrollSimpleMatch_req struct {
  25. SimpleMatch_req
  26. NickName string
  27. FaceId int
  28. FaceUrl string
  29. }
  30. func CreateSimpleMatch(userId int, gameId int, gameRule string, totalUserCount int,
  31. target int, tableUserCount int, enrollFee int, prize int, playTime int) (int, string) {
  32. var req CreateSimpleMatch_req
  33. req.UserId = userId
  34. req.GameId = gameId
  35. req.GameRule = gameRule
  36. req.TotalUser = totalUserCount
  37. req.TableUser = tableUserCount
  38. req.Target = target
  39. req.EnrollFee = enrollFee
  40. req.Prize = prize
  41. req.PlayTime = playTime
  42. reply := &Response{}
  43. err := getClient().Call(context.Background(), "CreateSimpleMatch", &req, reply)
  44. if err != nil {
  45. log.Debug("matches.CreateSimpleMatch failed to call: %v", err)
  46. common.GetClientPool().RemoveClient(ServiceName)
  47. return 0, "server error"
  48. }
  49. return reply.RetCode, reply.Data
  50. }
  51. func CloseSimpleMatch(userId int, matchNo int) (int, string) {
  52. var req SimpleMatch_req
  53. req.UserId = userId
  54. req.MatchNo = matchNo
  55. reply := &Response{}
  56. err := getClient().Call(context.Background(), "CloseSimpleMatch", &req, reply)
  57. if err != nil {
  58. log.Debug("matches.CloseSimpleMatch failed to call: %v", err)
  59. common.GetClientPool().RemoveClient(ServiceName)
  60. return 0, "server error"
  61. }
  62. return reply.RetCode, reply.Data
  63. }
  64. func EnrollSimpleMatch(userId int, matchNo int, nickname string, faceId int, faceUrl string) (int, string) {
  65. var req EnrollSimpleMatch_req
  66. req.UserId = userId
  67. req.MatchNo = matchNo
  68. req.NickName = nickname
  69. req.FaceId = faceId
  70. req.FaceUrl = faceUrl
  71. reply := &Response{}
  72. err := getClient().Call(context.Background(), "EnrollSimpleMatch", &req, reply)
  73. if err != nil {
  74. log.Debug("matches.EnrollSimpleMatch failed to call: %v", err)
  75. common.GetClientPool().RemoveClient(ServiceName)
  76. return 0, "server error"
  77. }
  78. return reply.RetCode, reply.Data
  79. }
  80. func QuitSimpleMatch(userId int, matchNo int) bool {
  81. var req SimpleMatch_req
  82. req.UserId = userId
  83. req.MatchNo = matchNo
  84. reply := &Response{}
  85. err := getClient().Call(context.Background(), "QuitSimpleMatch", &req, reply)
  86. if err != nil {
  87. log.Debug("matches.QuitSimpleMatch failed to call: %v", err)
  88. common.GetClientPool().RemoveClient(ServiceName)
  89. return false
  90. }
  91. return reply.BoolValue
  92. }
  93. func GetSimpleMatchInfo(matchNo int) string {
  94. log.Debug("GetSimpleMatchInfo %d", matchNo)
  95. var req SimpleMatch_req
  96. req.MatchNo = matchNo
  97. reply := &Response{}
  98. err := getClient().Call(context.Background(), "GetSimpleMatchInfo", &req, reply)
  99. if err != nil {
  100. log.Debug("matches.GetSimpleMatchInfo failed to call: %v", err)
  101. common.GetClientPool().RemoveClient(ServiceName)
  102. return ""
  103. }
  104. return reply.Data
  105. }
  106. func GetUserSimpleMatches(userId int) string {
  107. log.Debug("GetUserSimpleMatches %d", userId)
  108. var req Request
  109. req.UserId = userId
  110. reply := &Response{}
  111. err := getClient().Call(context.Background(), "GetUserSimpleMatches", &req, reply)
  112. if err != nil {
  113. log.Debug("matches.GetUserSimpleMatches failed to call: %v", err)
  114. common.GetClientPool().RemoveClient(ServiceName)
  115. return ""
  116. }
  117. return reply.Data
  118. }
  119. func GetSimpleMatchConfigs() string {
  120. reply := &Response{}
  121. err := getClient().Call(context.Background(), "GetSimpleMatchConfigs", nil, reply)
  122. if err != nil {
  123. log.Debug("matches.GetSimpleMatchConfigs failed to call: %v", err)
  124. common.GetClientPool().RemoveClient(ServiceName)
  125. return ""
  126. }
  127. return reply.Data
  128. }
  129. func GetEnrolledSimpleMatch(userId int) string {
  130. var req Request
  131. req.UserId = userId
  132. reply := &Response{}
  133. err := getClient().Call(context.Background(), "GetEnrolledSimpleMatch", req, reply)
  134. if err != nil {
  135. log.Debug("matches.GetEnrolledSimpleMatch failed to call: %v", err)
  136. common.GetClientPool().RemoveClient(ServiceName)
  137. return ""
  138. }
  139. return reply.Data
  140. }
  141. func GetSimpleMatchHistory(userId int) string {
  142. var req Request
  143. req.UserId = userId
  144. reply := &Response{}
  145. err := getClient().Call(context.Background(), "GetSimpleMatchHistory", req, reply)
  146. if err != nil {
  147. log.Debug("matches.GetSimpleMatchHistory failed to call: %v", err)
  148. common.GetClientPool().RemoveClient(ServiceName)
  149. return ""
  150. }
  151. return reply.Data
  152. }