|
- --- 金币场相关PHP请求接口
- local ProtocolMatchPhp = class("ProtocolMatchPhp")
-
- local UserCmd = {
- PHP_MATCH_RECORD = "matchrecord.record", -- 比赛记录
- }
-
- --- ProtocolMatchPhp:ctor
- function ProtocolMatchPhp:ctor()
- self.phpUrl = getGlobalPhpUrl()
- self.matchRecrods = {}
- end
-
- -- 获取比赛记录
- function ProtocolMatchPhp:requestMatchRecrod()
- local params =
- {
- action = UserCmd.PHP_MATCH_RECORD,
- uid = app.user.loginInfo.uid,
- }
- print("ProtocolMatchPhp:requestMatchRecrod() ", table.tostring(params))
- httpPost(self.phpUrl, params, function (status, response)
- if status ~= "successed" then
- return
- end
- local data = json.decode(response)
- if not data then
- return
- end
-
- if data.code==200 then
- self.matchRecrods=data.result.data or {}
- app:dispatchEvent({name = "matchRecrod"});
- end
- end)
- end
-
- return ProtocolMatchPhp
|