代码调整

This commit is contained in:
Fang 2023-09-01 15:58:52 +08:00
parent 89eeac3f2d
commit 6eea9de2e5
3 changed files with 10 additions and 5 deletions

View File

@ -471,11 +471,7 @@ function LocalData:getTodayFourteenDayExchangeWatched()
end end
function LocalData:recordTodayFourteenDayExchangeWatched() function LocalData:recordTodayFourteenDayExchangeWatched()
if self:getTodayFourteenDayExchangeWatched() then
return
end
self:setInt(LOCAL_DATA_KEY.FOURTEEN_DAY_TODAY_EXCHANGE .. Time:getBeginningOfServerToday(), 1) self:setInt(LOCAL_DATA_KEY.FOURTEEN_DAY_TODAY_EXCHANGE .. Time:getBeginningOfServerToday(), 1)
DataManager.FourteenDayData:setDirty()
end end
return LocalData return LocalData

View File

@ -58,7 +58,7 @@ function FourteenDayExchangeUI:onLoadRootComplete()
end end
function FourteenDayExchangeUI:onRefresh() function FourteenDayExchangeUI:onRefresh()
LocalData:recordTodayFourteenDayExchangeWatched() DataManager.FourteenDayData:onShowExchangeView()
self.txNum:setText(DataManager.FourteenDayData:getExchangeItemNum()) self.txNum:setText(DataManager.FourteenDayData:getExchangeItemNum())
self.scrollrectComp:updateAllCell() self.scrollrectComp:updateAllCell()

View File

@ -504,6 +504,15 @@ function FourteenDayData:getExchangeReward(id)
return self:getExchangeCfg()[id].reward return self:getExchangeCfg()[id].reward
end end
-- 查看兑换界面
function FourteenDayData:onShowExchangeView()
if LocalData:getTodayFourteenDayExchangeWatched() then
return
end
LocalData:recordTodayFourteenDayExchangeWatched()
self:setDirty()
end
-- 兑换奖励领取成功 -- 兑换奖励领取成功
function FourteenDayData:onReceivedExchangeReward(id) function FourteenDayData:onReceivedExchangeReward(id)
if self.exchangeStatus[id] == nil then if self.exchangeStatus[id] == nil then