user_prizewheel.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package gatesink
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "bet24.com/log"
  6. "bet24.com/servers/coreservice/client"
  7. "bet24.com/servers/fishhall/protocol"
  8. "bet24.com/servers/insecureframe/gate"
  9. )
  10. func (this *user) getPrizeWheelConfig(msg string) {
  11. resp := client.GetWheelPrizes()
  12. if resp.RetCode != 1 {
  13. log.Debug("user.getPrizeWheelConfig failed %v", resp)
  14. }
  15. this.WriteMsg(msg, resp.Data)
  16. }
  17. func (this *user) doWheel(msg, data string) {
  18. retData := ""
  19. var req protocol.PrizeWheel_req
  20. if err := json.Unmarshal([]byte(data), &req); err != nil {
  21. retData = fmt.Sprintf("doWheel Unmarshal data failed %v", data)
  22. log.Error(retData)
  23. this.WriteMsg(msg, retData)
  24. return
  25. }
  26. u := gate.GetUserInfo(this.UserIndex)
  27. resp := client.DoWheel(u.GetUserId(), req.Times, u.GetUserNickName(), this.GetIP())
  28. if resp.RetCode != 1 {
  29. log.Debug("user.doWheel failed %v", resp)
  30. }
  31. this.WriteMsg(msg, resp.Data)
  32. }
  33. func (this *user) getWheelTimes(msg, data string) {
  34. resp := client.GetWheelTimes(this.getUserId())
  35. if resp.RetCode != 1 {
  36. log.Debug("user.getWheelTimes userId=%d failed %v", this.getUserId(), resp)
  37. }
  38. this.WriteMsg(msg, resp.Data)
  39. }
  40. func (this *user) getPrizeRecord(msg, data string) {
  41. resp := client.GetPrizeRecord()
  42. this.WriteMsg(msg, resp.Data)
  43. }
  44. func (this *user) getJackpotAmount(msg string) {
  45. Amount := client.GetJackpotAmount(0, Sink.IsChipRoom())
  46. d, _ := json.Marshal(Amount)
  47. this.WriteMsg(msg, string(d))
  48. }