AuctionHandler.lua 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. -------------------------------------------------
  2. -- 本文件由代码生成器自动生成,
  3. -- 千万不要修改本文件的任何代码,
  4. -- 修改的的任何代码都会被覆盖掉!
  5. ----------------------------------------------------
  6. local Socket = require "Xmds.Pomelo.LuaGameSocket"
  7. require "base64"
  8. require "auctionHandler_pb"
  9. --------------------------------Pomelo-------------------------------
  10. Pomelo = Pomelo or {}
  11. --------------------------------AuctionHandler-------------------------------
  12. Pomelo.AuctionHandler = {}
  13. local function syncAuctionInfoRequestEncoder(msg)
  14. local input = auctionHandler_pb.SyncAuctionInfoRequest()
  15. protobuf.FromMessage(input,msg)
  16. return (input:SerializeToString())
  17. end
  18. local function syncAuctionInfoRequestDecoder(stream)
  19. local res = auctionHandler_pb.SyncAuctionInfoResponse()
  20. res:ParseFromString(stream)
  21. return res
  22. end
  23. function Pomelo.AuctionHandler.syncAuctionInfoRequest(cb,option)
  24. local input = nil
  25. Socket.OnRequestStart("auction.auctionHandler.syncAuctionInfoRequest", option)
  26. Socket.Request("auction.auctionHandler.syncAuctionInfoRequest", input, function(res)
  27. if(res.s2c_code == 200) then
  28. Pomelo.AuctionHandler.lastSyncAuctionInfoResponse = res
  29. Socket.OnRequestEnd("auction.auctionHandler.syncAuctionInfoRequest", true)
  30. cb(nil,res)
  31. else
  32. local ex = {}
  33. if(res.s2c_code) then
  34. ex.Code = res.s2c_code
  35. ex.Message = res.s2c_msg
  36. else
  37. ex.Code = 501
  38. ex.Message = "[LuaXmdsNetClient] auction.auctionHandler.syncAuctionInfoRequest decode error!!"
  39. end
  40. Socket.OnRequestEnd("auction.auctionHandler.syncAuctionInfoRequest", false,ex.Code,ex.Message)
  41. cb(ex,nil)
  42. end
  43. end, syncAuctionInfoRequestEncoder, syncAuctionInfoRequestDecoder)
  44. end
  45. local function cancelSyncAuctionInfoRequestEncoder(msg)
  46. local input = auctionHandler_pb.CancelSyncAuctionInfoRequest()
  47. protobuf.FromMessage(input,msg)
  48. return (input:SerializeToString())
  49. end
  50. local function cancelSyncAuctionInfoRequestDecoder(stream)
  51. local res = auctionHandler_pb.CancelSyncAuctionInfoResponse()
  52. res:ParseFromString(stream)
  53. return res
  54. end
  55. function Pomelo.AuctionHandler.cancelSyncAuctionInfoRequest(cb,option)
  56. local input = nil
  57. Socket.OnRequestStart("auction.auctionHandler.cancelSyncAuctionInfoRequest", option)
  58. Socket.Request("auction.auctionHandler.cancelSyncAuctionInfoRequest", input, function(res)
  59. if(res.s2c_code == 200) then
  60. Pomelo.AuctionHandler.lastCancelSyncAuctionInfoResponse = res
  61. Socket.OnRequestEnd("auction.auctionHandler.cancelSyncAuctionInfoRequest", true)
  62. cb(nil,res)
  63. else
  64. local ex = {}
  65. if(res.s2c_code) then
  66. ex.Code = res.s2c_code
  67. ex.Message = res.s2c_msg
  68. else
  69. ex.Code = 501
  70. ex.Message = "[LuaXmdsNetClient] auction.auctionHandler.cancelSyncAuctionInfoRequest decode error!!"
  71. end
  72. Socket.OnRequestEnd("auction.auctionHandler.cancelSyncAuctionInfoRequest", false,ex.Code,ex.Message)
  73. cb(ex,nil)
  74. end
  75. end, cancelSyncAuctionInfoRequestEncoder, cancelSyncAuctionInfoRequestDecoder)
  76. end
  77. local function auctionListRequestEncoder(msg)
  78. local input = auctionHandler_pb.AuctionListRequest()
  79. protobuf.FromMessage(input,msg)
  80. return (input:SerializeToString())
  81. end
  82. local function auctionListRequestDecoder(stream)
  83. local res = auctionHandler_pb.AuctionListResponse()
  84. res:ParseFromString(stream)
  85. return res
  86. end
  87. function Pomelo.AuctionHandler.auctionListRequest(c2s_type,cb,option)
  88. local msg = {}
  89. msg.c2s_type = c2s_type
  90. Socket.OnRequestStart("auction.auctionHandler.auctionListRequest", option)
  91. Socket.Request("auction.auctionHandler.auctionListRequest", msg, function(res)
  92. if(res.s2c_code == 200) then
  93. Pomelo.AuctionHandler.lastAuctionListResponse = res
  94. Socket.OnRequestEnd("auction.auctionHandler.auctionListRequest", true)
  95. cb(nil,res)
  96. else
  97. local ex = {}
  98. if(res.s2c_code) then
  99. ex.Code = res.s2c_code
  100. ex.Message = res.s2c_msg
  101. else
  102. ex.Code = 501
  103. ex.Message = "[LuaXmdsNetClient] auction.auctionHandler.auctionListRequest decode error!!"
  104. end
  105. Socket.OnRequestEnd("auction.auctionHandler.auctionListRequest", false,ex.Code,ex.Message)
  106. cb(ex,nil)
  107. end
  108. end, auctionListRequestEncoder, auctionListRequestDecoder)
  109. end
  110. local function auctionRequestEncoder(msg)
  111. local input = auctionHandler_pb.AuctionRequest()
  112. protobuf.FromMessage(input,msg)
  113. return (input:SerializeToString())
  114. end
  115. local function auctionRequestDecoder(stream)
  116. local res = auctionHandler_pb.AuctionResponse()
  117. res:ParseFromString(stream)
  118. return res
  119. end
  120. function Pomelo.AuctionHandler.auctionRequest(itemId,price,cb,option)
  121. local msg = {}
  122. msg.itemId = itemId
  123. msg.price = price
  124. Socket.OnRequestStart("auction.auctionHandler.auctionRequest", option)
  125. Socket.Request("auction.auctionHandler.auctionRequest", msg, function(res)
  126. if(res.s2c_code == 200) then
  127. Pomelo.AuctionHandler.lastAuctionResponse = res
  128. Socket.OnRequestEnd("auction.auctionHandler.auctionRequest", true)
  129. cb(nil,res)
  130. else
  131. local ex = {}
  132. if(res.s2c_code) then
  133. ex.Code = res.s2c_code
  134. ex.Message = res.s2c_msg
  135. else
  136. ex.Code = 501
  137. ex.Message = "[LuaXmdsNetClient] auction.auctionHandler.auctionRequest decode error!!"
  138. end
  139. Socket.OnRequestEnd("auction.auctionHandler.auctionRequest", false,ex.Code,ex.Message)
  140. cb(ex,nil)
  141. end
  142. end, auctionRequestEncoder, auctionRequestDecoder)
  143. end
  144. local function auctionLogRequestEncoder(msg)
  145. local input = auctionHandler_pb.AuctionLogRequest()
  146. protobuf.FromMessage(input,msg)
  147. return (input:SerializeToString())
  148. end
  149. local function auctionLogRequestDecoder(stream)
  150. local res = auctionHandler_pb.AuctionLogResponse()
  151. res:ParseFromString(stream)
  152. return res
  153. end
  154. function Pomelo.AuctionHandler.auctionLogRequest(cb,option)
  155. local input = nil
  156. Socket.OnRequestStart("auction.auctionHandler.auctionLogRequest", option)
  157. Socket.Request("auction.auctionHandler.auctionLogRequest", input, function(res)
  158. if(res.s2c_code == 200) then
  159. Pomelo.AuctionHandler.lastAuctionLogResponse = res
  160. Socket.OnRequestEnd("auction.auctionHandler.auctionLogRequest", true)
  161. cb(nil,res)
  162. else
  163. local ex = {}
  164. if(res.s2c_code) then
  165. ex.Code = res.s2c_code
  166. ex.Message = res.s2c_msg
  167. else
  168. ex.Code = 501
  169. ex.Message = "[LuaXmdsNetClient] auction.auctionHandler.auctionLogRequest decode error!!"
  170. end
  171. Socket.OnRequestEnd("auction.auctionHandler.auctionLogRequest", false,ex.Code,ex.Message)
  172. cb(ex,nil)
  173. end
  174. end, auctionLogRequestEncoder, auctionLogRequestDecoder)
  175. end
  176. local function auctionItemPushDecoder(stream)
  177. local res = auctionHandler_pb.AuctionItemPush()
  178. res:ParseFromString(stream)
  179. return res
  180. end
  181. function Pomelo.AuctionHandler.auctionItemPush(cb)
  182. Socket.On("auction.auctionPush.auctionItemPush", function(res)
  183. Pomelo.AuctionHandler.lastAuctionItemPush = res
  184. cb(nil,res)
  185. end, auctionItemPushDecoder)
  186. end
  187. local function addAuctionItemPushDecoder(stream)
  188. local res = auctionHandler_pb.AddAuctionItemPush()
  189. res:ParseFromString(stream)
  190. return res
  191. end
  192. function Pomelo.AuctionHandler.addAuctionItemPush(cb)
  193. Socket.On("auction.auctionPush.addAuctionItemPush", function(res)
  194. Pomelo.AuctionHandler.lastAddAuctionItemPush = res
  195. cb(nil,res)
  196. end, addAuctionItemPushDecoder)
  197. end
  198. local function removeAuctionItemPushDecoder(stream)
  199. local res = auctionHandler_pb.RemoveAuctionItemPush()
  200. res:ParseFromString(stream)
  201. return res
  202. end
  203. function Pomelo.AuctionHandler.removeAuctionItemPush(cb)
  204. Socket.On("auction.auctionPush.removeAuctionItemPush", function(res)
  205. Pomelo.AuctionHandler.lastRemoveAuctionItemPush = res
  206. cb(nil,res)
  207. end, removeAuctionItemPushDecoder)
  208. end
  209. --------------------------------Pomelo-------------------------------
  210. return Pomelo