Commit 814c57b15c08e683af780359de8fd856f44f9095
Merge branch 'develop' of 120.26.43.151:wasteland/server into develop
Showing
3 changed files
with
22 additions
and
8 deletions
Show diff stats
src/actions/HeroAction.lua
@@ -994,8 +994,9 @@ function _M.drawHeroRpc(agent, data) | @@ -994,8 +994,9 @@ function _M.drawHeroRpc(agent, data) | ||
994 | --end | 994 | --end |
995 | SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | 995 | SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) |
996 | elseif drawCardReward and drawCardReward ~= "" then | 996 | elseif drawCardReward and drawCardReward ~= "" then |
997 | - role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
998 | - SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack({reward = drawCardReward:toNumMap()})) | 997 | + local r,change = {} |
998 | + r, change = role:award(drawCardReward, {log = {desc = "drawHeroExtraReward", int1 = oldVal, int2 = newVal}}) | ||
999 | + SendPacket(actionCodes.Hero_drawHeroExtraRewardNtf, MsgPack.pack(role:packReward(r, change))) | ||
999 | end | 1000 | end |
1000 | role:updateProperty({field = "repayHero", value = val}) | 1001 | role:updateProperty({field = "repayHero", value = val}) |
1001 | end | 1002 | end |
src/actions/StoreAction.lua
@@ -3,7 +3,20 @@ local _M = {} | @@ -3,7 +3,20 @@ local _M = {} | ||
3 | local serverId = tonumber(skynet.getenv("servId")) | 3 | local serverId = tonumber(skynet.getenv("servId")) |
4 | local md5 = require "md5" | 4 | local md5 = require "md5" |
5 | 5 | ||
6 | -local function makeOrder(roleId, rechargeId) | 6 | +local function makeOrder(role, rechargeId) |
7 | + local roleId = role:getProperty("id") | ||
8 | + local rechargeData = csvdb["shop_rechargeCsv"][rechargeId] | ||
9 | + if not rechargeData then | ||
10 | + skynet.error("recharge id not exist", rechargeId) | ||
11 | + return "" | ||
12 | + end | ||
13 | + local limit = rechargeData.limit | ||
14 | + local rechargeRecord = role:getProperty("payR") or {} | ||
15 | + if limit ~= 0 and limit <= (rechargeRecord[rechargeId] or 0) then | ||
16 | + skynet.error(string.format("recharge id:%d count over limit, user id:%d", rechargeId, roleId)) | ||
17 | + return "" | ||
18 | + end | ||
19 | + | ||
7 | local orderId = redisproxy:hincrby("autoincrement_set", "order", 1) | 20 | local orderId = redisproxy:hincrby("autoincrement_set", "order", 1) |
8 | local partnerOrderId = string.format("%d_%d_%d", serverId, roleId, orderId) | 21 | local partnerOrderId = string.format("%d_%d_%d", serverId, roleId, orderId) |
9 | local orderKey = string.format("order:%d:%d", roleId, orderId) | 22 | local orderKey = string.format("order:%d:%d", roleId, orderId) |
@@ -28,7 +41,7 @@ function _M.rechargeRpc(agent , data) | @@ -28,7 +41,7 @@ function _M.rechargeRpc(agent , data) | ||
28 | local roleId = role:getProperty("id") | 41 | local roleId = role:getProperty("id") |
29 | 42 | ||
30 | --创建订单号 | 43 | --创建订单号 |
31 | - local partnerOrderId = makeOrder(roleId, id) | 44 | + local partnerOrderId = makeOrder(role, id) |
32 | SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) | 45 | SendPacket(actionCodes.Store_rechargeRpc, MsgPack.pack({ order = partnerOrderId })) |
33 | 46 | ||
34 | 47 | ||
@@ -77,7 +90,7 @@ function _M.googleRechargeRpc(agent, data) | @@ -77,7 +90,7 @@ function _M.googleRechargeRpc(agent, data) | ||
77 | 90 | ||
78 | role.ignoreHeartbeat = true | 91 | role.ignoreHeartbeat = true |
79 | --创建订单号 | 92 | --创建订单号 |
80 | - local partnerOrderId = makeOrder(roleId, id) | 93 | + local partnerOrderId = makeOrder(role, id) |
81 | -- 签名 | 94 | -- 签名 |
82 | local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" | 95 | local secret_key = "b7657fa7ccd44c16a35e3f454ac7a075" |
83 | local need = { | 96 | local need = { |
@@ -104,7 +117,7 @@ function _M.myCardRechargeRpc(agent, data) | @@ -104,7 +117,7 @@ function _M.myCardRechargeRpc(agent, data) | ||
104 | 117 | ||
105 | role.ignoreHeartbeat = true | 118 | role.ignoreHeartbeat = true |
106 | --创建订单号 | 119 | --创建订单号 |
107 | - local partnerOrderId = makeOrder(roleId, id) | 120 | + local partnerOrderId = makeOrder(role, id) |
108 | -- 签名 | 121 | -- 签名 |
109 | local secret_key = "48759e07540f46d9af17ec82669b4272" | 122 | local secret_key = "48759e07540f46d9af17ec82669b4272" |
110 | local need = { | 123 | local need = { |
@@ -130,7 +143,7 @@ function _M.iosRechargeRpc(agent, data) | @@ -130,7 +143,7 @@ function _M.iosRechargeRpc(agent, data) | ||
130 | 143 | ||
131 | role.ignoreHeartbeat = true | 144 | role.ignoreHeartbeat = true |
132 | --创建订单号 | 145 | --创建订单号 |
133 | - local partnerOrderId = makeOrder(roleId, id) | 146 | + local partnerOrderId = makeOrder(role, id) |
134 | -- 签名 | 147 | -- 签名 |
135 | local secret_key = "9647d2efe1074c73b9ac19af4337a70e" | 148 | local secret_key = "9647d2efe1074c73b9ac19af4337a70e" |
136 | local need = { | 149 | local need = { |
src/models/Store.lua
@@ -224,7 +224,7 @@ end | @@ -224,7 +224,7 @@ end | ||
224 | 224 | ||
225 | --检测购买是否超过限制数量 | 225 | --检测购买是否超过限制数量 |
226 | function Store:checkRechargeRecord(limit, id) | 226 | function Store:checkRechargeRecord(limit, id) |
227 | - local rechargeRecord = self:getProperty("payR") | 227 | + local rechargeRecord = self:getProperty("payR") or {} |
228 | if limit ~= 0 and limit <= (rechargeRecord[id] or 0) then | 228 | if limit ~= 0 and limit <= (rechargeRecord[id] or 0) then |
229 | skynet.error(string.format("recharge id:%d count over limit, user id:%d", id, self.owner:getProperty("id"))) | 229 | skynet.error(string.format("recharge id:%d count over limit, user id:%d", id, self.owner:getProperty("id"))) |
230 | return false | 230 | return false |