Commit 2bf99d62421094cf88530e308fd8ba2bf7e5e512
1 parent
1d724b8b
充值mycard
Showing
3 changed files
with
48 additions
and
1 deletions
Show diff stats
src/actions/GmAction.lua
... | ... | @@ -559,6 +559,12 @@ function _M.ayncPurchase(role, params) |
559 | 559 | return role:handlePurchase(params) or "" |
560 | 560 | end |
561 | 561 | |
562 | +-- 获取订单号 | |
563 | +function _M.getPurchaseOrder(role, params) | |
564 | + return role:getPurchaseOrderByPlatform(params) or "" | |
565 | +end | |
566 | + | |
567 | + | |
562 | 568 | function _M.cz(role, pms) |
563 | 569 | local id = tonum(pms.pm1) |
564 | 570 | local csvData = csvdb["shop_rechargeCsv"][id] | ... | ... |
src/actions/HttpAction.lua
... | ... | @@ -147,6 +147,15 @@ function _M.gm_action(query) |
147 | 147 | return status |
148 | 148 | end |
149 | 149 | |
150 | +function _M.query_role(query) | |
151 | + if not query.uid then return "not found" end | |
152 | + local user = redisproxy:get(string.format("uid:%s", query.uid)) | |
153 | + if not user then return "not found" end | |
154 | + local roleId = redisproxy:get(string_format("user:%s", string.upper(user))) | |
155 | + if not roleId then return "not found" end | |
156 | + return json.encode({roleId, user}) | |
157 | +end | |
158 | + | |
150 | 159 | function _M.broadcast(query) |
151 | 160 | local msg = {} |
152 | 161 | local handle = { | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -1667,8 +1667,34 @@ function RolePlugin.bind(Role) |
1667 | 1667 | self:updateProperty({field = "redp", value = redp}) |
1668 | 1668 | end |
1669 | 1669 | |
1670 | + -- 网页支付获取订单号 | |
1671 | + function Role:getPurchaseOrderByPlatform(params) | |
1672 | + local checkPlatform = { | |
1673 | + ["mycard"] = "mycard_product_id", | |
1674 | + } | |
1675 | + local pidField = checkPlatform[params.payMode or ""] | |
1676 | + if not pidField or not params.product_id or params.product_id == "" then | |
1677 | + return "no product" | |
1678 | + end | |
1679 | + | |
1680 | + for k , v in pairs(csvdb["shop_rechargeCsv"]) do | |
1681 | + if not v[pidField] then return "no product" end | |
1682 | + if v[pidField] == params.product_id then | |
1683 | + if v.rmb ~= params.money then | |
1684 | + return "error money" | |
1685 | + end | |
1686 | + -- 发现需要的id | |
1687 | + local partnerOrderId = self:getPurchaseOrder(k, params.transactionId) | |
1688 | + if partnerOrderId == "" then | |
1689 | + return "no product" | |
1690 | + end | |
1691 | + return json.encode({order = partnerOrderId}) | |
1692 | + end | |
1693 | + end | |
1694 | + end | |
1695 | + | |
1670 | 1696 | -- 获取充值订单号 |
1671 | - function Role:getPurchaseOrder(rechargeId) | |
1697 | + function Role:getPurchaseOrder(rechargeId, transactionId) | |
1672 | 1698 | local roleId = self:getProperty("id") |
1673 | 1699 | local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] |
1674 | 1700 | if not rechargeData then |
... | ... | @@ -1705,6 +1731,7 @@ function RolePlugin.bind(Role) |
1705 | 1731 | order = partnerOrderId, |
1706 | 1732 | rechargeId = rechargeId, |
1707 | 1733 | createTime = skynet.timex(), |
1734 | + transactionId = transactionId, | |
1708 | 1735 | }) |
1709 | 1736 | order:create() |
1710 | 1737 | -- 正在进行中的订单 缓存 |
... | ... | @@ -1783,6 +1810,7 @@ function RolePlugin.bind(Role) |
1783 | 1810 | request.product_id = data.product_id |
1784 | 1811 | request.pay_time = data.pay_time |
1785 | 1812 | request.transactionId = data.order_no |
1813 | + request.extension_info = data.extension_info | |
1786 | 1814 | ]] |
1787 | 1815 | function Role:handlePurchase(params) |
1788 | 1816 | local roleId = self:getProperty("id") |
... | ... | @@ -1813,6 +1841,10 @@ function RolePlugin.bind(Role) |
1813 | 1841 | }) |
1814 | 1842 | |
1815 | 1843 | if not status then |
1844 | + if params.extension_info == "mycard_web" then | |
1845 | + -- todo 发邮件 | |
1846 | + skynet.error("mycard_web " .. params.order) | |
1847 | + end | |
1816 | 1848 | SendPacket(actionCodes.Store_ayncPurchaseRpc, MsgPack.pack({ order = partnerOrderStr, |
1817 | 1849 | result = "success", reward = reward})) |
1818 | 1850 | end | ... | ... |