GateHandler.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGateSocket"
  7. require "base64"
  8. require "gateHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------GateHandler-------------------------------
  12. Pomelo.GateHandler = {}
  13. local function queryEntryRequestEncoder(msg)
  14. local input = gateHandler_pb.QueryEntryRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function queryEntryRequestDecoder(stream)
  19. local res = gateHandler_pb.QueryEntryResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.GateHandler.queryEntryRequest(c2s_uid,c2s_sign,c2s_time,c2s_logicServerId,cb,option)
  24. local msg = {}
  25. msg.c2s_uid = c2s_uid
  26. msg.c2s_sign = c2s_sign
  27. msg.c2s_time = c2s_time
  28. msg.c2s_logicServerId = c2s_logicServerId
  29. Socket.OnRequestStart("gate.gateHandler.queryEntryRequest", option)
  30. Socket.Request("gate.gateHandler.queryEntryRequest", msg, function(res)
  31. if(res.s2c_code == 200) then
  32. Pomelo.GateHandler.lastQueryEntryResponse = res
  33. Socket.OnRequestEnd("gate.gateHandler.queryEntryRequest", true)
  34. cb(nil,res)
  35. else
  36. local ex = {}
  37. if(res.s2c_code) then
  38. ex.Code = res.s2c_code
  39. ex.Message = res.s2c_msg
  40. else
  41. ex.Code = 501
  42. ex.Message = "[LuaXmdsNetClient] gate.gateHandler.queryEntryRequest decode error!!"
  43. end
  44. Socket.OnRequestEnd("gate.gateHandler.queryEntryRequest", false,ex.Code,ex.Message)
  45. cb(ex,nil)
  46. end
  47. end, queryEntryRequestEncoder, queryEntryRequestDecoder)
  48. end
  49. --------------------------------Pomelo-------------------------------
  50. return Pomelo