Commit 9b20dbfcce3bf997f0c0af2c2cb75f71585711d8
Merge branch 'cn/develop' into cn/publish/zhaolu
Showing
2 changed files
with
13 additions
and
14 deletions
Show diff stats
src/actions/StoreAction.lua
| @@ -366,7 +366,7 @@ function _M.shopBuyRpc(agent , data) | @@ -366,7 +366,7 @@ function _M.shopBuyRpc(agent , data) | ||
| 366 | local id = msg.id | 366 | local id = msg.id |
| 367 | local count = msg.count or 1 | 367 | local count = msg.count or 1 |
| 368 | 368 | ||
| 369 | - local dataSet = csvdb["shop_normalCsv"][id] | 369 | + local dataSet = csvdb["shop_normalCsv"][id] |
| 370 | if not dataSet then return end | 370 | if not dataSet then return end |
| 371 | 371 | ||
| 372 | if dataSet.unlock ~= "" then | 372 | if dataSet.unlock ~= "" then |
| @@ -383,20 +383,13 @@ function _M.shopBuyRpc(agent , data) | @@ -383,20 +383,13 @@ function _M.shopBuyRpc(agent , data) | ||
| 383 | if not role.activity:isOpenById(dataSet.activity_id, "ActShopGoods") then return 3 end | 383 | if not role.activity:isOpenById(dataSet.activity_id, "ActShopGoods") then return 3 end |
| 384 | end | 384 | end |
| 385 | 385 | ||
| 386 | - local buyRecord = role.storeData:getProperty("buyR") | ||
| 387 | - if math.illegalNum(count, 1, (dataSet.limit == 0 and 10000 or dataSet.limit - (buyRecord[id] or 0))) then | ||
| 388 | - skynet.error(string.format("shop buy over limit, user_id:%d, goods_id:%d", role:getProperty("id"), id)) | ||
| 389 | - return 6 | ||
| 390 | - end | ||
| 391 | - | ||
| 392 | - local cost | ||
| 393 | - if dataSet.disount == 0 then | 386 | + local cost |
| 387 | + if dataSet.disount == 0 then | ||
| 394 | cost = {[dataSet.icon] = math.ceil(dataSet.cost * count)} | 388 | cost = {[dataSet.icon] = math.ceil(dataSet.cost * count)} |
| 395 | else | 389 | else |
| 396 | cost = {[dataSet.icon] = math.ceil(dataSet.cost * count * ((dataSet.disount or 10) / 10))} | 390 | cost = {[dataSet.icon] = math.ceil(dataSet.cost * count * ((dataSet.disount or 10) / 10))} |
| 397 | end | 391 | end |
| 398 | 392 | ||
| 399 | - | ||
| 400 | local desc = "unknowShop" | 393 | local desc = "unknowShop" |
| 401 | if dataSet.shop == 1 then -- 普通商店 | 394 | if dataSet.shop == 1 then -- 普通商店 |
| 402 | desc = "dailyShop" | 395 | desc = "dailyShop" |
| @@ -407,14 +400,20 @@ function _M.shopBuyRpc(agent , data) | @@ -407,14 +400,20 @@ function _M.shopBuyRpc(agent , data) | ||
| 407 | end | 400 | end |
| 408 | 401 | ||
| 409 | if not role:checkItemEnough(cost) then return 4 end | 402 | if not role:checkItemEnough(cost) then return 4 end |
| 403 | + if not role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) then return 5 end | ||
| 410 | 404 | ||
| 411 | - local limitStr = "" | 405 | + local buyRecord = role.storeData:getProperty("buyR") |
| 406 | + if math.illegalNum(count, 1, (dataSet.limit == 0 and 10000 or dataSet.limit - (buyRecord[id] or 0))) then | ||
| 407 | + skynet.error(string.format("shop buy over limit, user_id:%d, goods_id:%d", role:getProperty("id"), id)) | ||
| 408 | + return 6 | ||
| 409 | + end | ||
| 410 | + | ||
| 411 | + local limitStr = "" | ||
| 412 | if dataSet.limit ~= 0 then | 412 | if dataSet.limit ~= 0 then |
| 413 | buyRecord[id] = (buyRecord[id] or 0) + count | 413 | buyRecord[id] = (buyRecord[id] or 0) + count |
| 414 | role.storeData:updateProperty({field = "buyR", value = buyRecord}) | 414 | role.storeData:updateProperty({field = "buyR", value = buyRecord}) |
| 415 | - limitStr = string.format("%s/%s", buyRecord[id], dataSet.limit) | 415 | + limitStr = string.format("%s/%s", buyRecord[id], dataSet.limit) |
| 416 | end | 416 | end |
| 417 | - if not role:costItems(cost, {log = {desc = desc, int1 = id, int2 = count, long1= dataSet.shop}}) then return 5 end | ||
| 418 | 417 | ||
| 419 | local gift = {} | 418 | local gift = {} |
| 420 | for _id, _count in pairs(dataSet.gift:toNumMap()) do | 419 | for _id, _count in pairs(dataSet.gift:toNumMap()) do |
src/models/RolePlugin.lua
| @@ -550,7 +550,7 @@ function RolePlugin.bind(Role) | @@ -550,7 +550,7 @@ function RolePlugin.bind(Role) | ||
| 550 | if isnan(count) then | 550 | if isnan(count) then |
| 551 | return false | 551 | return false |
| 552 | end | 552 | end |
| 553 | - if count <= 0 then | 553 | + if count < 0 then |
| 554 | return false | 554 | return false |
| 555 | end | 555 | end |
| 556 | local isIos = self:getProperty("sid") == IOS_SID | 556 | local isIos = self:getProperty("sid") == IOS_SID |