充值接口修改,sdk和本地走同一套接口

gaoxin 2020-09-09 18:47:17 +08:00
parent f927da56e1
commit 64f382c54d
21 changed files with 164 additions and 266 deletions

View File

@ -28,12 +28,10 @@ end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function XianShiShangShi:AddListener() function XianShiShangShi:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
function XianShiShangShi:RemoveListener() function XianShiShangShi:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
local sortingOrder = 0 local sortingOrder = 0
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
@ -150,15 +148,9 @@ function this.SingleDataShow(pre,value)
PopupTipPanel.ShowTip(Language[10540]) PopupTipPanel.ShowTip(Language[10540])
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay(value.Id, function(id)
PayManager.Pay({ Id = value.Id }) this.RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(value.Id, function(msg)
FirstRechargeManager.RefreshAccumRechargeValue(value.Id)
-- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了
this.OnShowData()
end)
end
end end
end) end)
end end
@ -170,7 +162,6 @@ end
function this.RechargeSuccessFunc(id) function this.RechargeSuccessFunc(id)
FirstRechargeManager.RefreshAccumRechargeValue(id) FirstRechargeManager.RefreshAccumRechargeValue(id)
--OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GiftBuy, id)
this.OnShowData() this.OnShowData()
end end

View File

@ -28,12 +28,10 @@ end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function ZhenQiYiBaoPage:AddListener() function ZhenQiYiBaoPage:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
function ZhenQiYiBaoPage:RemoveListener() function ZhenQiYiBaoPage:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
local sortingOrder = 0 local sortingOrder = 0
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
@ -153,16 +151,9 @@ function this.SingleDataShow(pre,value)
PopupTipPanel.ShowTip(Language[10540]) PopupTipPanel.ShowTip(Language[10540])
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay(value.Id, function(id)
PayManager.Pay({ Id = value.Id }) this.RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(value.Id, function(msg)
FirstRechargeManager.RefreshAccumRechargeValue(value.Id)
-- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了
LogGreen("刷新?")
this.OnShowData()
end)
end
end end
end) end)
end end

View File

@ -118,16 +118,11 @@ function DiffMonsterBuy:DiffMonsterBuy()
end end
Util.AddOnceClick(this.diffMonsterBuyBtn, function() Util.AddOnceClick(this.diffMonsterBuyBtn, function()
if shopItemData.buyTimes <= 0 then if shopItemData.buyTimes <= 0 then
if AppConst.isSDKLogin then PayManager.Pay(rechargeCommodityConfig.Id, function(id)
PayManager.Pay({ Id = rechargeCommodityConfig.Id }) FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id)
else OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id)
Log(Language[10527]..rechargeCommodityConfig.Id) this:DiffMonsterBuy()
NetManager.RequestBuyGiftGoods(rechargeCommodityConfig.Id, function() end)
FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id)
this:DiffMonsterBuy()
end)
end
end end
end) end)
Util.AddOnceClick(this.diffMonsteNameBtn, function() Util.AddOnceClick(this.diffMonsteNameBtn, function()

View File

@ -32,12 +32,10 @@ end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function GiftBuy:AddListener() function GiftBuy:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
function GiftBuy:RemoveListener() function GiftBuy:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
local sortingOrder = 0 local sortingOrder = 0
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
@ -134,15 +132,9 @@ function this.SingleDataShow(go, data)
PopupTipPanel.ShowTip(Language[10540]) PopupTipPanel.ShowTip(Language[10540])
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay(data.Id, function(id)
PayManager.Pay({ Id = data.Id }) this:RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(data.Id, function(msg)
FirstRechargeManager.RefreshAccumRechargeValue(data.Id)
-- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) -- 改成后端推了
this.OnShowData()
end)
end
end end
end) end)
end end

View File

@ -49,46 +49,10 @@ function HeroStarFeedPage:BindEvent()
end) end)
Util.AddClick(self.btnBuy,function() Util.AddClick(self.btnBuy,function()
if AppConst.isSDKLogin then --直购商品
PayManager.Pay({ Id = curGiftId }) PayManager.Pay(curGiftId, function(id)
else this:RechargeSuccessFunc(id)
NetManager.RequestBuyGiftGoods(curGiftId, function() end)
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1
--判断可购买次数是否为零,是剔除礼包信息
-- for i = 1, #curGiftList do
if curGiftList[curIndex].dynamicBuyTimes == 0 then
OperatingManager.SetHadBuyGoodsId({curGiftId})
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
if curGiftList[curIndex-1] then
curIndex = curIndex -1
-- LogBlue("QWEQWEQWEWQ")
-- elseif curGiftList[curIndex+1] then
-- curIndex = curIndex +1
-- LogRed("ZXCZXCZX")
end
end
-- end
--判断是否有礼包
self:GetInfoList()
if #curGiftList == 0 then
self:OnClose()
else
if curIndex then
self:FreshRewardShow(curIndex)
-- LogGreen("没换界面")
else
if curGiftList[curIndex-1] then
self:FreshRewardShow(curIndex - 1)
elseif curGiftList[curIndex+1] then
self:FreshRewardShow(curIndex + 1)
-- LogRed("界面-1")
end
end
end
end)
end
end) end)
Util.AddClick(self.arrowsLeft,function() Util.AddClick(self.arrowsLeft,function()
@ -103,9 +67,40 @@ end
-- 充值成功回调 -- 充值成功回调
function HeroStarFeedPage:RechargeSuccessFunc(id) function HeroStarFeedPage:RechargeSuccessFunc(id)
FirstRechargeManager.RefreshAccumRechargeValue(id) FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
-- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id)--后端推了 CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
self:FreshRewardShow() curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1
--判断可购买次数是否为零,是剔除礼包信息
-- for i = 1, #curGiftList do
if curGiftList[curIndex].dynamicBuyTimes == 0 then
OperatingManager.SetHadBuyGoodsId({curGiftId})
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
if curGiftList[curIndex-1] then
curIndex = curIndex -1
-- LogBlue("QWEQWEQWEWQ")
-- elseif curGiftList[curIndex+1] then
-- curIndex = curIndex +1
-- LogRed("ZXCZXCZX")
end
end
-- end
--判断是否有礼包
self:GetInfoList()
if #curGiftList == 0 then
self:OnClose()
else
if curIndex then
self:FreshRewardShow(curIndex)
-- LogGreen("没换界面")
else
if curGiftList[curIndex-1] then
self:FreshRewardShow(curIndex - 1)
elseif curGiftList[curIndex+1] then
self:FreshRewardShow(curIndex + 1)
-- LogRed("界面-1")
end
end
end
end end

View File

@ -27,16 +27,13 @@ end
function WeekCard:BindEvent() function WeekCard:BindEvent()
Util.AddClick(self.weekCardBuyBtn, function() Util.AddClick(self.weekCardBuyBtn, function()
if AppConst.isSDKLogin then --直购商品
PayManager.Pay({ Id = 12 }) PayManager.Pay(12, function(id)
else PopupTipPanel.ShowTip(Language[10553])
NetManager.RequestBuyGiftGoods(12, function() FirstRechargeManager.RefreshAccumRechargeValue(12)
PopupTipPanel.ShowTip(Language[10553]) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12)
FirstRechargeManager.RefreshAccumRechargeValue(12) this:WeekCardShow()
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12) end)
this:WeekCardShow()
end)
end
end) end)
end end

View File

@ -31,11 +31,9 @@ function this:BindEvent()
end end
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:OnShow(_sortingOrder) function this:OnShow(_sortingOrder)
@ -88,15 +86,10 @@ function this.SetShow(root,data)
stateBtnText.text=Language[10638] stateBtnText.text=Language[10638]
end end
Util.AddOnceClick(stateBtn,function() Util.AddOnceClick(stateBtn,function()
if AppConst.isSDKLogin then --直购商品
PayManager.Pay({ Id = data.native.Id }) PayManager.Pay(data.native.Id, function(id)
else this.RechargeSuccessFunc(id)
NetManager.RequestBuyGiftGoods(data.native.Id, function() end)
FirstRechargeManager.RefreshAccumRechargeValue(data.native.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.native.Id)
this.OnShowPanelData()
end)
end
end) end)
if data.native.Limit-data.server.buyTimes==0 then if data.native.Limit-data.server.buyTimes==0 then

View File

@ -27,11 +27,9 @@ function this:BindEvent()
end end
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:OnShow(_sortingOrder) function this:OnShow(_sortingOrder)
@ -76,17 +74,9 @@ function this.OnShowPanelData()
itemRewardGrid[i]:OnOpen(false,conFigData.BaseReward[i],1.1,false,false,false,sortingOrder) itemRewardGrid[i]:OnOpen(false,conFigData.BaseReward[i],1.1,false,false,false,sortingOrder)
end end
Util.AddOnceClick(this.buyBtn, function() Util.AddOnceClick(this.buyBtn, function()
if shopItemData.buyTimes <= 0 then PayManager.Pay(conFigData.Id, function(id)
if AppConst.isSDKLogin then this.RechargeSuccessFunc(id)
PayManager.Pay({ Id = conFigData.Id }) end)
else
NetManager.RequestBuyGiftGoods(conFigData.Id, function()
FirstRechargeManager.RefreshAccumRechargeValue(conFigData.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, conFigData.Id)
this.OnShowPanelData()
end)
end
end
end) end)
this.RemainTimeDown(this.timeGo,this.time,shopItemData.endTime - GetTimeStamp()) this.RemainTimeDown(this.timeGo,this.time,shopItemData.endTime - GetTimeStamp())
end end

View File

@ -25,11 +25,9 @@ function this:BindEvent()
end end
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
end end
function this:OnShow(_sortingOrder) function this:OnShow(_sortingOrder)
@ -90,15 +88,9 @@ function this.OnShowPanelData(i)
Util.AddOnceClick(buyBtn, function() Util.AddOnceClick(buyBtn, function()
if shopItemData.buyTimes <= 0 then if shopItemData.buyTimes <= 0 then
if AppConst.isSDKLogin then PayManager.Pay(conFigData.Id, function(id)
PayManager.Pay({ Id = conFigData.Id }) this.RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(conFigData.Id, function()
FirstRechargeManager.RefreshAccumRechargeValue(conFigData.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, conFigData.Id)
this.OnShowPanel()
end)
end
end end
end) end)
end end

View File

@ -108,12 +108,10 @@ function this:BindEvent()
end end
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView) Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView)
end end
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.RechargeSuccessFunc)
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView) Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.InitView)
end end
@ -178,17 +176,9 @@ function this.SetInfo(id)
Util.AddOnceClick(this.sendBtn,function() Util.AddOnceClick(this.sendBtn,function()
if surplusNum<1 then return end if surplusNum<1 then return end
local recharge=ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,index[id]) local recharge=ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,index[id])
if AppConst.isSDKLogin then PayManager.Pay(recharge.Id, function(id)
PayManager.Pay({ Id = recharge.Id}) this.RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(recharge.Id, function()
FirstRechargeManager.RefreshAccumRechargeValue(recharge.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GuildRedPacket, recharge.Id)
this.SetInfo(curIndex)
PopupTipPanel.ShowTip(string.format( Language[11078],redpack.Name))
ChatManager.RequestSendRedPacket(curIndex)
end)
end
end) end)
end end

View File

@ -487,16 +487,12 @@ function GiftPackPage:RefreshShowData(item, data, type, DataTypeIndex)
self:BuyAction(costId, finalNum, SHOP_TYPE.FINDTREASURE_GIFT, data.id, type) self:BuyAction(costId, finalNum, SHOP_TYPE.FINDTREASURE_GIFT, data.id, type)
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay(data.goodsId, function(id)
PayManager.Pay({ Id = data.goodsId }) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
else OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId)
NetManager.RequestBuyGiftGoods(data.goodsId, function() self:RefreshGiftData(type)
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) CheckRedPointStatus(RedPointType.DailyGift)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) end)
self:RefreshGiftData(type)
CheckRedPointStatus(RedPointType.DailyGift)
end)
end
end end
end end
end) end)

View File

@ -251,16 +251,9 @@ function GrowthGiftPage:OnBtnInvestClicked()
end end
function GrowthGiftPage:RequestBuy() function GrowthGiftPage:RequestBuy()
local giftGoodsInfo = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, curGiftsId) local giftGoodsInfo = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, curGiftsId)
if AppConst.isSDKLogin then PayManager.Pay(giftGoodsInfo.goodsId, function(id)
PayManager.Pay({Id = giftGoodsInfo.goodsId}) self:RefreshStatus()
else end)
NetManager.RequestBuyGiftGoods(giftGoodsInfo.goodsId,function(respond)
-- PopupTipPanel.ShowTip("奖励已发送到邮件,请前往领取")
-- FirstRechargeManager.RefreshAccumRechargeValue( giftGoodsInfo.goodsId)
lastGiftId = curGiftsId
self:RefreshStatus()
end)
end
end end
function GrowthGiftPage:RefreshStatus() function GrowthGiftPage:RefreshStatus()

View File

@ -89,29 +89,18 @@ function UpperMonthCard:BindEvent()
JumpManager.GoJump(36004) JumpManager.GoJump(36004)
end, Language[10719], Language[10023],nil, false) end, Language[10719], Language[10023],nil, false)
else else
if AppConst.isSDKLogin then PayManager.Pay(self.baseType, function(id)
PayManager.Pay({ Id = self.baseType }) self:RechargeSuccessFunc(id)
else end)
Log(Language[11489] .. self.baseType)
NetManager.RequestBuyGiftGoods(self.baseType, function()
self:RechargeSuccessFunc(self.baseType)
Log(Language[10545])
end)
end
end end
end) end)
end end
function UpperMonthCard:AddEvent() function UpperMonthCard:AddEvent()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
end end
function UpperMonthCard:RemoveEvent() function UpperMonthCard:RemoveEvent()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
end end
function UpperMonthCard:OnShow(parentSorting, arg, pageIndex) function UpperMonthCard:OnShow(parentSorting, arg, pageIndex)

View File

@ -165,15 +165,11 @@ function WeekMonthGiftPackPage:RefreshShowData(item, data)
PopupTipPanel.ShowTip(Language[10540]) PopupTipPanel.ShowTip(Language[10540])
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay(data.goodsId, function(id)
PayManager.Pay({ Id = data.goodsId }) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
else self:RefreshGiftData()
NetManager.RequestBuyGiftGoods(data.goodsId, function() CheckRedPointStatus(RedPointType.DailyGift)
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) end)
self:RefreshGiftData()
CheckRedPointStatus(RedPointType.DailyGift)
end)
end
end end
end) end)

View File

@ -10,7 +10,7 @@ local this = PayManager
--初始化 --初始化
function this.Initialize() function this.Initialize()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.onSdkPayResult)
end end
----- 请求支付 ----- 请求支付
----- @param context ----- @param context
@ -18,7 +18,38 @@ end
---- Id, -- required, 商品ID ---- Id, -- required, 商品ID
---- BuyNum, -- optional, 购买个数(默认1 ---- BuyNum, -- optional, 购买个数(默认1
---- } ---- }
function this.Pay(context) ----
----
this.EventTrigger = {}
function this.onSdkPayResult(id)
if this.EventTrigger[id] then
this.EventTrigger[id](id)
this.EventTrigger[id] = nil
end
end
function this.Pay(id, func)
if not func then
func = function()end
end
if this.EventTrigger[id] then
PopupTipPanel.ShowTip("您有一个相同的订单正在处理,请稍后再试")
return
end
this.EventTrigger[id] = func
--直购商品
if AppConst.isSDKLogin then
PayManager.SdkPay({ Id = id })
else
NetManager.RequestBuyGiftGoods(value.Id, function(msg)
this.onSdkPayResult(id)
end)
end
end
function this.SdkPay(context)
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, context.Id) local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, context.Id)
local payData = table.clone(context) local payData = table.clone(context)
payData.Name = rechargeConfig.Name payData.Name = rechargeConfig.Name

View File

@ -33,13 +33,9 @@ function this:BindEvent()
parent:ClosePanel() parent:ClosePanel()
end) end)
Util.AddOnceClick(this.dealBtn,function() Util.AddOnceClick(this.dealBtn,function()
if AppConst.isSDKLogin then PayManager.Pay(type[curType].id, function(id)
PayManager.Pay({Id = type[curType].id}) this.RechargeSuccessFunc()
else end)
NetManager.RequestBuyGiftGoods(type[curType].id,function()
this.RechargeSuccessFunc()
end)
end
end) end)
end end

View File

@ -70,18 +70,14 @@ end
function GiftView:BindEvent() function GiftView:BindEvent()
Util.AddClick(self.buyAllBtn,function () Util.AddClick(self.buyAllBtn,function ()
if AppConst.isSDKLogin then PayManager.Pay(1004, function(id)
PayManager.Pay({ Id = 1004 }) FirstRechargeManager.RefreshAccumRechargeValue(1004)
else PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
NetManager.RequestBuyGiftGoods(1004, function() CheckRedPointStatus(RedPointType.DailyGift)
FirstRechargeManager.RefreshAccumRechargeValue(1004) CheckRedPointStatus(RedPointType.GrowthPackage)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) timerList={}
CheckRedPointStatus(RedPointType.DailyGift) self:RefreshGiftData()
CheckRedPointStatus(RedPointType.GrowthPackage) end)
timerList={}
self:RefreshGiftData()
end)
end
end) end)
end end
@ -544,18 +540,14 @@ function GiftView:RefreshShowData(item, data, buyType, DataTypeIndex)
CheckRedPointStatus(RedPointType.GrowthPackage) CheckRedPointStatus(RedPointType.GrowthPackage)
else else
--直购商品 --直购商品
if AppConst.isSDKLogin then PayManager.Pay( data.goodsId, function(id)
PayManager.Pay({ Id = data.goodsId }) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
else PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
NetManager.RequestBuyGiftGoods(data.goodsId, function() CheckRedPointStatus(RedPointType.DailyGift)
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) CheckRedPointStatus(RedPointType.GrowthPackage)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) timerList={}
CheckRedPointStatus(RedPointType.DailyGift) self:RefreshGiftData()
CheckRedPointStatus(RedPointType.GrowthPackage) end)
timerList={}
self:RefreshGiftData()
end)
end
end end
end end
end) end)

View File

@ -32,13 +32,9 @@ function HeavenUnlockExtraRewardPanel:BindEvent()
this:ClosePanel() this:ClosePanel()
end) end)
Util.AddOnceClick(this.dealBtn,function() Util.AddOnceClick(this.dealBtn,function()
if AppConst.isSDKLogin then PayManager.Pay(type[curType].id, function(id)
PayManager.Pay({Id = type[curType].id}) this.RechargeSuccessFunc()
else end)
NetManager.RequestBuyGiftGoods(type[curType].id,function()
this.RechargeSuccessFunc()
end)
end
end) end)
end end

View File

@ -24,7 +24,6 @@ end
function UnlockExtraRewardPanel:BindEvent() function UnlockExtraRewardPanel:BindEvent()
Util.AddClick(self.closeBtn, function() Util.AddClick(self.closeBtn, function()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
self:ClosePanel() self:ClosePanel()
end) end)
Util.AddClick(self.dealBtn, function() Util.AddClick(self.dealBtn, function()
@ -42,7 +41,6 @@ function UnlockExtraRewardPanel:OnOpen(goodsId,context)
end end
function UnlockExtraRewardPanel:OnShow() function UnlockExtraRewardPanel:OnShow()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
self:SetCostValues() self:SetCostValues()
end end
@ -66,13 +64,9 @@ function UnlockExtraRewardPanel:OnDealBtnClicked()
-- self:ClosePanel() -- self:ClosePanel()
-- end) -- end)
-- end) -- end)
if AppConst.isSDKLogin then PayManager.Pay(self.goodsId, function(id)
PayManager.Pay({ Id = self.goodsId }) self:RechargeSuccessFunc(id)
else end)
NetManager.RequestBuyGiftGoods(self.goodsId, function()
self:RechargeSuccessFunc(self.goodsId)
end)
end
end end
--充值成功的回调 --充值成功的回调

View File

@ -40,24 +40,19 @@ function this:BindEvent()
end) end)
Util.AddClick(this.btnBuy,function() Util.AddClick(this.btnBuy,function()
if AppConst.isSDKLogin then PayManager.Pay(curGiftId, function(id)
PayManager.Pay({ Id = curGiftId }) FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
else CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
LogBlue("curGiftId:"..curGiftId) rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1
NetManager.RequestBuyGiftGoods(curGiftId, function() --判断可购买次数是否为零,是剔除礼包信息
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) -- for i = 1, #curGiftList do
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 if rechargeData.dynamicBuyTimes < 1 then
rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1 OperatingManager.SetHadBuyGoodsId({curGiftId})
--判断可购买次数是否为零,是剔除礼包信息 OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
-- for i = 1, #curGiftList do
if rechargeData.dynamicBuyTimes < 1 then
OperatingManager.SetHadBuyGoodsId({curGiftId})
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, curGiftId)
end
-- end
this:Refresh()
end)
end end
-- end
this:Refresh()
end)
end) end)
Util.AddClick(this.arrowsLeft,function() Util.AddClick(this.arrowsLeft,function()

View File

@ -121,12 +121,10 @@ end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function this:AddListener() function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) Game.GlobalEvent:AddEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self)
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
function this:RemoveListener() function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self) Game.GlobalEvent:RemoveEvent(GameEvent.Shop.OnShopInfoChange, self.RefreshShopInfo, self)
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.RechargeSuccessFunc, self)
end end
--界面打开时调用(用于子类重写) --界面打开时调用(用于子类重写)
function this:OnOpen(...) function this:OnOpen(...)
@ -548,15 +546,9 @@ function this:RechargeShopItemAdapter(shopItem, itemData)
-- 购买事件 -- 购买事件
Util.AddOnceClick(shopItem, function() Util.AddOnceClick(shopItem, function()
if AppConst.isSDKLogin then PayManager.Pay(itemData.goodsId, function(id)
PayManager.Pay({ Id = itemData.goodsId }) self:RechargeSuccessFunc(itemData.goodsId)
else end)
NetManager.RequestBuyGiftGoods(itemData.goodsId, function()
self:RechargeSuccessFunc(itemData.goodsId)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测
end)
end
end) end)
@ -568,6 +560,8 @@ function this:RechargeSuccessFunc(id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id)
self:RefreshShopInfo(false, false) self:RefreshShopInfo(false, false)
--PopupTipPanel.ShowTip("购买成功,请到邮箱中领取!") --PopupTipPanel.ShowTip("购买成功,请到邮箱中领取!")
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测
end end
---=====================================对外接口=============================---- ---=====================================对外接口=============================----