Commit 344d2df3677f3e35cb5d7981fd7eb8d4b51c2bd8

Authored by liuzujun
1 parent d81f1a3d

微信支付宝下单接口

Showing 2 changed files with 29 additions and 4 deletions   Show diff stats
src/actions/StoreAction.lua
1 local _M = {} 1 local _M = {}
2 2
3 local md5 = require "md5" 3 local md5 = require "md5"
  4 +local httpc = require("http.httpc")
4 5
5 -- 入口在正式服关闭 -- mock 充值 6 -- 入口在正式服关闭 -- mock 充值
6 function _M.rechargeRpc(agent , data) 7 function _M.rechargeRpc(agent , data)
@@ -281,9 +282,33 @@ function _M.dyhxAndroidRechargeRpc(agent, data) @@ -281,9 +282,33 @@ function _M.dyhxAndroidRechargeRpc(agent, data)
281 end 282 end
282 283
283 local rechargeHandler = { 284 local rechargeHandler = {
284 - ali = function(cp_order_id, rechargeId, result) 285 + ali = function(cp_order_id, rechargeId, cfg, result)
  286 + local codeurl = skynet.getenv("codeurl")
  287 + local content = {
  288 + ["paytype"] = "alipay",
  289 + ["rechargeid"] = rechargeId,
  290 + ["order"] = cp_order_id,
  291 + ["title"] = cfg.title,
  292 + ["rmb"] = cfg.rmb,
  293 + }
  294 + local status, body = httpc.get(codeurl, "/payorder?" .. httpGetFormatData(content), {})
  295 + if status == 200 then
  296 + result["orderInfo"] = body
  297 + end
285 end, 298 end,
286 - wx = function(cp_order_id, rechargeId, result) 299 + wx = function(cp_order_id, rechargeId, cfg, result)
  300 + local codeurl = skynet.getenv("codeurl")
  301 + local content = {
  302 + ["paytype"] = "wxpay",
  303 + ["rechargeid"] = rechargeId,
  304 + ["order"] = cp_order_id,
  305 + ["title"] = cfg.title,
  306 + ["rmb"] = cfg.rmb,
  307 + }
  308 + local status, body = httpc.get(codeurl, "/payorder?" .. httpGetFormatData(content), {})
  309 + if status == 200 then
  310 + result["orderInfo"] = body
  311 + end
287 end, 312 end,
288 } 313 }
289 314
@@ -305,7 +330,7 @@ function _M.getCpOrderIdRpc(agent, data) @@ -305,7 +330,7 @@ function _M.getCpOrderIdRpc(agent, data)
305 result["order"] = partnerOrderId 330 result["order"] = partnerOrderId
306 local handler = rechargeHandler[type] 331 local handler = rechargeHandler[type]
307 if handler then 332 if handler then
308 - handler(partnerOrderId, id, result) 333 + handler(partnerOrderId, id, dataSet, result)
309 end 334 end
310 335
311 SendPacket(actionCodes.Store_getCpOrderIdRpc, MsgPack.pack(result)) 336 SendPacket(actionCodes.Store_getCpOrderIdRpc, MsgPack.pack(result))
src/services/dbseed.lua
@@ -33,7 +33,7 @@ local function initRedisDb( ... ) @@ -33,7 +33,7 @@ local function initRedisDb( ... )
33 return 33 return
34 end 34 end
35 local redisVal = tonum(redisproxy:hget(tbName, keyName)) 35 local redisVal = tonum(redisproxy:hget(tbName, keyName))
36 - if redisVal < mysqlVal then 36 + if redisVal < mysqlVal or redisVal == 0 then
37 redisproxy:hset(tbName, keyName, mysqlVal) 37 redisproxy:hset(tbName, keyName, mysqlVal)
38 end 38 end
39 end 39 end