From 99f84aa14be7e7708f8224887e35a3d9ab5e4496 Mon Sep 17 00:00:00 2001 From: zqj <582132116@qq.com> Date: Mon, 12 Jul 2021 14:31:37 +0800 Subject: [PATCH] fix: 特刊解锁机制修改,删除openFlag字段 --- src/models/Store.lua | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/models/Store.lua b/src/models/Store.lua index 1605b06..dd3a1ae 100644 --- a/src/models/Store.lua +++ b/src/models/Store.lua @@ -33,7 +33,7 @@ Store.schema = { firstMonthCard = {"number", 1}, -- 首次订阅月卡 monthCardReceive = {"number", 0}, -- 月卡奖励领取记录 当天 0-未领取, 1-已经领取 - smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0, ["openFlag"]= 1}} buyCount: 购买次数,periods: 剩余期数,openFlag: 是否开放标识 + smonthCards = {"table", {}}, --特刊信息 {[id]={["buyCount"]=0, ["periods"]=0}} buyCount: 购买次数,periods: 剩余期数, smonthCardReceive = {"number", 0}, -- 特刊奖励领取记录 当天 0-未领取, 1-已经领取 battleCard = {"number", 0}, -- 赛季卡 @@ -105,9 +105,6 @@ SuperMonthCard["buy"] = function(self, id) local smonthCard = smonthCards[id] or {} if next(smonthCard) then - local rechargeData = csvdb["shop_rechargeCsv"][id] or {} - local buyCount = smonthCard["buyCount"] or 0 - if buyCount >= (rechargeData["limit"] or 3) then return false end smonthCard["buyCount"] = (smonthCard["buyCount"] or 0) + 1 @@ -120,21 +117,16 @@ SuperMonthCard["buy"] = function(self, id) end end BuyMonthCard["order"] = function() - --增刊条件 + 标识 - for _, val in pairs(smonthCards) do - val["openFlag"] = 0 - end - + --增刊条件 local card = csvdb["shop_cardCsv"][id] or {} - if (card["cardPlusFlag"] or 0) ~= 1 then return false end - --判断是否购买过增刊条件里的特刊 + local cardId = card["cardPlusCondition"] or 0 + if self:isMonthCardExpire() or smonthCards[cardId] == nil then return false end - local cardPlusCondition = card["cardPlusCondition"] or 0 - if self:isMonthCardExpire() or smonthCards[cardPlusCondition] == nil then return false end + --如果上期特刊奖励没有领取玩,则不能购买这期特刊。 + if SuperMonthCard["isExpired"](self, cardId) == false and cardId ~= 101 then return false end - local smonthCard = {["periods"] = (card["cardPlusPeriods"] or 30), ["buyCount"] = 1, ["openFlag"] = 1 } - smonthCards[id] = smonthCard + smonthCards[id] = {["periods"] = (card["cardPlusPeriods"] or 30), ["buyCount"] = 1} self:updateProperty({filed = "smonthCards", value = smonthCards}) return true -- libgit2 0.21.2