command_slotscore.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package client
  2. import (
  3. "encoding/json"
  4. )
  5. func AddSlotScore(userId, score int) int {
  6. msg := "AddSlotScore"
  7. var req SlotScore_req
  8. req.UserId = userId
  9. req.Param = score
  10. d, _ := json.Marshal(req)
  11. resp := DoRequest(msg, string(d))
  12. return resp.RetCode
  13. }
  14. func GetSlotScore(userId int) int {
  15. msg := "GetSlotScore"
  16. var req Request_base
  17. req.UserId = userId
  18. d, _ := json.Marshal(req)
  19. resp := DoRequest(msg, string(d))
  20. return resp.RetCode
  21. }
  22. func GetSlotScoreExchangeList() string {
  23. msg := "GetSlotScoreExchangeList"
  24. resp := DoRequest(msg, "")
  25. return resp.Data
  26. }
  27. func SlotScoreExchange(userId, productId int) bool {
  28. msg := "SlotScoreExchange"
  29. var req SlotScore_req
  30. req.UserId = userId
  31. req.Param = productId
  32. d, _ := json.Marshal(req)
  33. resp := DoRequest(msg, string(d))
  34. return resp.RetCode == 1
  35. }
  36. func GetSlotScoreExchangeHistory(userId int) string {
  37. msg := "GetSlotScoreExchangeHistory"
  38. var req Request_base
  39. req.UserId = userId
  40. d, _ := json.Marshal(req)
  41. resp := DoRequest(msg, string(d))
  42. return resp.Data
  43. }