sngmatch.pb.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package proto
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/common"
  5. "context"
  6. )
  7. type SngMatch_req struct {
  8. Request
  9. MatchId int
  10. }
  11. type EnrollSngMatch_req struct {
  12. SngMatch_req
  13. NickName string
  14. FaceId int
  15. FaceUrl string
  16. FeeIndex int
  17. }
  18. func EnrollSngMatch(userId int, matchId int, nickname string, faceId int, faceUrl string, feeIndex int) (int, string) {
  19. var req EnrollSngMatch_req
  20. req.UserId = userId
  21. req.MatchId = matchId
  22. req.NickName = nickname
  23. req.FaceId = faceId
  24. req.FaceUrl = faceUrl
  25. req.FeeIndex = feeIndex
  26. reply := &Response{}
  27. err := getClient().Call(context.Background(), "EnrollSngMatch", &req, reply)
  28. if err != nil {
  29. log.Debug("matches.EnrollSngMatch failed to call: %v", err)
  30. common.GetClientPool().RemoveClient(ServiceName)
  31. return 0, "server error"
  32. }
  33. return reply.RetCode, reply.Data
  34. }
  35. func QuitSngMatch(userId int, matchId int) bool {
  36. var req SngMatch_req
  37. req.UserId = userId
  38. req.MatchId = matchId
  39. reply := &Response{}
  40. err := getClient().Call(context.Background(), "QuitSngMatch", &req, reply)
  41. if err != nil {
  42. log.Debug("matches.QuitSngMatch failed to call: %v", err)
  43. common.GetClientPool().RemoveClient(ServiceName)
  44. return false
  45. }
  46. return reply.BoolValue
  47. }
  48. func GetSngMatchList(userId int) string {
  49. var req Request
  50. req.UserId = userId
  51. reply := &Response{}
  52. err := getClient().Call(context.Background(), "GetSngMatchList", &req, reply)
  53. if err != nil {
  54. log.Debug("matches.GetSngMatchList failed to call: %v", err)
  55. common.GetClientPool().RemoveClient(ServiceName)
  56. return ""
  57. }
  58. return reply.Data
  59. }
  60. func GetSngMatchHistory(userId int) string {
  61. var req Request
  62. req.UserId = userId
  63. reply := &Response{}
  64. err := getClient().Call(context.Background(), "GetSngMatchHistory", &req, reply)
  65. if err != nil {
  66. log.Debug("matches.GetSngMatchHistory failed to call: %v", err)
  67. common.GetClientPool().RemoveClient(ServiceName)
  68. return ""
  69. }
  70. return reply.Data
  71. }
  72. func GetUserSngMatchId(userId int) int {
  73. var req Request
  74. req.UserId = userId
  75. reply := &Response{}
  76. err := getClient().Call(context.Background(), "GetUserSngMatchId", &req, reply)
  77. if err != nil {
  78. log.Debug("matches.GetUserSngMatchId failed to call: %v", err)
  79. common.GetClientPool().RemoveClient(ServiceName)
  80. return 0
  81. }
  82. return reply.RetCode
  83. }