You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
864 B

  1. --- 金币场相关PHP请求接口
  2. local ProtocolMatchPhp = class("ProtocolMatchPhp")
  3. local UserCmd = {
  4. PHP_MATCH_RECORD = "matchrecord.record", -- 比赛记录
  5. }
  6. --- ProtocolMatchPhp:ctor
  7. function ProtocolMatchPhp:ctor()
  8. self.phpUrl = getGlobalPhpUrl()
  9. self.matchRecrods = {}
  10. end
  11. -- 获取比赛记录
  12. function ProtocolMatchPhp:requestMatchRecrod()
  13. local params =
  14. {
  15. action = UserCmd.PHP_MATCH_RECORD,
  16. uid = app.user.loginInfo.uid,
  17. }
  18. print("ProtocolMatchPhp:requestMatchRecrod() ", table.tostring(params))
  19. httpPost(self.phpUrl, params, function (status, response)
  20. if status ~= "successed" then
  21. return
  22. end
  23. local data = json.decode(response)
  24. if not data then
  25. return
  26. end
  27. if data.code==200 then
  28. self.matchRecrods=data.result.data or {}
  29. app:dispatchEvent({name = "matchRecrod"});
  30. end
  31. end)
  32. end
  33. return ProtocolMatchPhp