user_setsmatch.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package gatesink
  2. import (
  3. "bet24.com/log"
  4. setsmatch "bet24.com/servers/micros/matches/proto"
  5. "strconv"
  6. )
  7. func (this *user) onSetsMatchMsg(msg, data string) {
  8. switch msg {
  9. case "quitSetsMatch":
  10. this.quitSetsMatch(msg, data)
  11. case "getSetsMatchInfo":
  12. this.getSetsMatchInfo(msg, data)
  13. case "getMySetsMatches":
  14. this.getMySetsMatches(msg)
  15. case "getSetsMatchConfigs":
  16. this.getSetsMatchConfigs(msg)
  17. case "getEnrolledSetsMatch":
  18. this.getEnrolledSetsMatch(msg)
  19. case "getSetsMatchHistory":
  20. this.getSetsMatchHistory(msg)
  21. }
  22. }
  23. func (this *user) quitSetsMatch(msg, data string) {
  24. matchNo, err := strconv.Atoi(data)
  25. if err != nil {
  26. log.Release("gatesink.quitSetsMatch %v", err)
  27. this.WriteMsg(msg, "invalid argument")
  28. return
  29. }
  30. ok := setsmatch.QuitSetsMatch(this.getUserId(), matchNo)
  31. retData := "success"
  32. if !ok {
  33. retData = "failed"
  34. }
  35. this.WriteMsg(msg, retData)
  36. }
  37. func (this *user) getSetsMatchInfo(msg, data string) {
  38. matchNo, err := strconv.Atoi(data)
  39. if err != nil {
  40. log.Release("gatesink.getSetsMatchInfo %v", err)
  41. this.WriteMsg(msg, "invalid argument")
  42. return
  43. }
  44. this.WriteMsg(msg, setsmatch.GetSetsMatchInfo(matchNo))
  45. }
  46. func (this *user) onSetsMatchNotification(data string) {
  47. //log.Release("onSetsMatchNotification [%d],%s", this.getUserId(), data)
  48. this.WriteMsg("onSetsMatchNotification", data)
  49. }
  50. func (this *user) getMySetsMatches(msg string) {
  51. this.WriteMsg(msg, setsmatch.GetUserSetsMatches(this.getUserId()))
  52. }
  53. func (this *user) getSetsMatchConfigs(msg string) {
  54. this.WriteMsg(msg, setsmatch.GetSetsMatchConfigs())
  55. }
  56. func (this *user) getEnrolledSetsMatch(msg string) {
  57. this.WriteMsg(msg, setsmatch.GetEnrolledSetsMatch(this.getUserId()))
  58. }
  59. func (this *user) getSetsMatchHistory(msg string) {
  60. this.WriteMsg(msg, setsmatch.GetSetsMatchHistory(this.getUserId()))
  61. }