user_rank.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. )
  9. // 获取排行榜列表
  10. func (this *user) getRankList(msg, data string) {
  11. retData := ""
  12. var req protocol.RankList_req
  13. if err := json.Unmarshal([]byte(data), &req); err != nil {
  14. retData = fmt.Sprintf("user.getRankList unmarshal fail %v", err)
  15. log.Error(retData)
  16. this.WriteMsg(msg, retData)
  17. return
  18. }
  19. resp := client.GetRankList(this.getUserId(), req.RankType, req.Num)
  20. if resp.RetCode != 1 {
  21. log.Debug("user.getRankList failed %v", resp)
  22. }
  23. this.WriteMsg(msg, resp.Data)
  24. return
  25. }
  26. // 榜单历史
  27. func (this *user) rankHistoryList(msg, data string) {
  28. retData := ""
  29. var req protocol.RankHistoryList_req
  30. if err := json.Unmarshal([]byte(data), &req); err != nil {
  31. retData = fmt.Sprintf("user.rankHistoryList unmarshal fail %v", err)
  32. log.Error(retData)
  33. this.WriteMsg(msg, retData)
  34. return
  35. }
  36. resp := client.RankHistoryList(this.getUserId(), req.DateFlag)
  37. if resp.RetCode != 1 {
  38. log.Debug("user.rankHistoryList failed %v", resp)
  39. }
  40. this.WriteMsg(msg, resp.Data)
  41. return
  42. }
  43. // 榜单奖励
  44. func (this *user) rankAward(msg, data string) {
  45. retData := ""
  46. var req protocol.RankAward_req
  47. if err := json.Unmarshal([]byte(data), &req); err != nil {
  48. retData = fmt.Sprintf("user.rankAward unmarshal fail %v", err)
  49. log.Error(retData)
  50. this.WriteMsg(msg, retData)
  51. return
  52. }
  53. resp := client.RankAward(this.getUserId(), req.RankType, req.DoubleFlag)
  54. if resp.RetCode != 1 {
  55. log.Debug("user.rankAward failed %v", resp)
  56. }
  57. this.WriteMsg(msg, resp.Data)
  58. return
  59. }
  60. // 榜单奖励列表
  61. func (this *user) getRankAwardList(msg, data string) {
  62. resp := client.GetRankAwardList()
  63. if resp.RetCode != 1 {
  64. log.Debug("user.getRankAwardList failed %v", resp)
  65. }
  66. this.WriteMsg(msg, resp.Data)
  67. return
  68. }