Compare View
Commits (3)
Showing
3 changed files
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) |
| @@ -282,9 +283,33 @@ function _M.dyhxAndroidRechargeRpc(agent, data) | @@ -282,9 +283,33 @@ function _M.dyhxAndroidRechargeRpc(agent, data) | ||
| 282 | end | 283 | end |
| 283 | 284 | ||
| 284 | local rechargeHandler = { | 285 | local rechargeHandler = { |
| 285 | - ali = function(cp_order_id, rechargeId, result) | 286 | + ali = function(cp_order_id, rechargeId, cfg, result) |
| 287 | + local codeurl = skynet.getenv("codeurl") | ||
| 288 | + local content = { | ||
| 289 | + ["paytype"] = "alipay", | ||
| 290 | + ["rechargeid"] = rechargeId, | ||
| 291 | + ["order"] = cp_order_id, | ||
| 292 | + ["title"] = cfg.title, | ||
| 293 | + ["rmb"] = cfg.rmb, | ||
| 294 | + } | ||
| 295 | + local status, body = httpc.get(codeurl, "/payorder?" .. httpGetFormatData(content), {}) | ||
| 296 | + if status == 200 then | ||
| 297 | + result["orderInfo"] = body | ||
| 298 | + end | ||
| 286 | end, | 299 | end, |
| 287 | - wx = function(cp_order_id, rechargeId, result) | 300 | + wx = function(cp_order_id, rechargeId, cfg, result) |
| 301 | + local codeurl = skynet.getenv("codeurl") | ||
| 302 | + local content = { | ||
| 303 | + ["paytype"] = "wxpay", | ||
| 304 | + ["rechargeid"] = rechargeId, | ||
| 305 | + ["order"] = cp_order_id, | ||
| 306 | + ["title"] = cfg.title, | ||
| 307 | + ["rmb"] = cfg.rmb, | ||
| 308 | + } | ||
| 309 | + local status, body = httpc.get(codeurl, "/payorder?" .. httpGetFormatData(content), {}) | ||
| 310 | + if status == 200 then | ||
| 311 | + result["orderInfo"] = body | ||
| 312 | + end | ||
| 288 | end, | 313 | end, |
| 289 | } | 314 | } |
| 290 | 315 | ||
| @@ -306,10 +331,11 @@ function _M.getCpOrderIdRpc(agent, data) | @@ -306,10 +331,11 @@ function _M.getCpOrderIdRpc(agent, data) | ||
| 306 | result["order"] = partnerOrderId | 331 | result["order"] = partnerOrderId |
| 307 | local handler = rechargeHandler[type] | 332 | local handler = rechargeHandler[type] |
| 308 | if handler then | 333 | if handler then |
| 309 | - handler(partnerOrderId, id, result) | 334 | + handler(partnerOrderId, id, dataSet, result) |
| 310 | end | 335 | end |
| 311 | 336 | ||
| 312 | SendPacket(actionCodes.Store_getCpOrderIdRpc, MsgPack.pack(result)) | 337 | SendPacket(actionCodes.Store_getCpOrderIdRpc, MsgPack.pack(result)) |
| 338 | + return true | ||
| 313 | end | 339 | end |
| 314 | 340 | ||
| 315 | 341 |
src/models/RolePlugin.lua
| @@ -2429,7 +2429,7 @@ function RolePlugin.bind(Role) | @@ -2429,7 +2429,7 @@ function RolePlugin.bind(Role) | ||
| 2429 | end | 2429 | end |
| 2430 | local rechargeId = back | 2430 | local rechargeId = back |
| 2431 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | 2431 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
| 2432 | - if params.amount == 0 then | 2432 | + if tonumber(params.amount) == 0 then |
| 2433 | if params.product_id ~= rechargeData.iap_product_id then | 2433 | if params.product_id ~= rechargeData.iap_product_id then |
| 2434 | skynet.error(string.format("[recharge] fake order: %s, roleId: %d, order: %s, rmb %s, get %s", | 2434 | skynet.error(string.format("[recharge] fake order: %s, roleId: %d, order: %s, rmb %s, get %s", |
| 2435 | params.transactionId, roleId, partnerOrderStr, rechargeData.iap_product_id, params.product_id | 2435 | params.transactionId, roleId, partnerOrderStr, rechargeData.iap_product_id, params.product_id |
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 |