充值接口修改,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,16 +148,10 @@ 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
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 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,17 +151,10 @@ 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
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 end

View File

@ -118,17 +118,12 @@ 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 })
else
Log(Language[10527]..rechargeCommodityConfig.Id)
NetManager.RequestBuyGiftGoods(rechargeCommodityConfig.Id, function()
FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id) FirstRechargeManager.RefreshAccumRechargeValue(rechargeCommodityConfig.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, rechargeCommodityConfig.Id)
this:DiffMonsterBuy() this:DiffMonsterBuy()
end) end)
end end
end
end) end)
Util.AddOnceClick(this.diffMonsteNameBtn, function() Util.AddOnceClick(this.diffMonsteNameBtn, function()
UIManager.OpenPanel(UIName.PatFaceDiffMonsterInfoPanel,diffMonsterBuyData.Values) UIManager.OpenPanel(UIName.PatFaceDiffMonsterInfoPanel,diffMonsterBuyData.Values)

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,16 +132,10 @@ 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
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 end
function this.RechargeSuccessFunc(id) function this.RechargeSuccessFunc(id)

View File

@ -49,10 +49,24 @@ 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)
end)
Util.AddClick(self.arrowsLeft,function()
self:FreshRewardShow(curIndex-1)
end)
Util.AddClick(self.arrowsRight,function()
self:FreshRewardShow(curIndex+1)
end)
end
-- 充值成功回调
function HeroStarFeedPage:RechargeSuccessFunc(id)
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1 curGiftList[curIndex].dynamicBuyTimes = curGiftList[curIndex].dynamicBuyTimes - 1
@ -87,25 +101,6 @@ function HeroStarFeedPage:BindEvent()
end end
end end
end end
end)
end
end)
Util.AddClick(self.arrowsLeft,function()
self:FreshRewardShow(curIndex-1)
end)
Util.AddClick(self.arrowsRight,function()
self:FreshRewardShow(curIndex+1)
end)
end
-- 充值成功回调
function HeroStarFeedPage:RechargeSuccessFunc(id)
FirstRechargeManager.RefreshAccumRechargeValue(id)
-- OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DemonCrystal, id)--后端推了
self:FreshRewardShow()
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
NetManager.RequestBuyGiftGoods(12, function()
PopupTipPanel.ShowTip(Language[10553]) PopupTipPanel.ShowTip(Language[10553])
FirstRechargeManager.RefreshAccumRechargeValue(12) FirstRechargeManager.RefreshAccumRechargeValue(12)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.WeekCard, 12)
this:WeekCardShow() this:WeekCardShow()
end) 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()
FirstRechargeManager.RefreshAccumRechargeValue(data.native.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.native.Id)
this.OnShowPanelData()
end) 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 })
else
NetManager.RequestBuyGiftGoods(conFigData.Id, function()
FirstRechargeManager.RefreshAccumRechargeValue(conFigData.Id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, conFigData.Id)
this.OnShowPanelData()
end) 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,16 +88,10 @@ 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
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 end
this.timer = Timer.New() this.timer = Timer.New()

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
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 end

View File

@ -487,10 +487,7 @@ 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 })
else
NetManager.RequestBuyGiftGoods(data.goodsId, function()
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId) OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, data.goodsId)
self:RefreshGiftData(type) self:RefreshGiftData(type)
@ -498,7 +495,6 @@ function GiftPackPage:RefreshShowData(item, data, type, DataTypeIndex)
end) end)
end end
end end
end
end) end)
end end

View File

@ -251,17 +251,10 @@ 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})
else
NetManager.RequestBuyGiftGoods(giftGoodsInfo.goodsId,function(respond)
-- PopupTipPanel.ShowTip("奖励已发送到邮件,请前往领取")
-- FirstRechargeManager.RefreshAccumRechargeValue( giftGoodsInfo.goodsId)
lastGiftId = curGiftsId
self:RefreshStatus() self:RefreshStatus()
end) end)
end end
end
function GrowthGiftPage:RefreshStatus() function GrowthGiftPage:RefreshStatus()
local giftGoodsInfo = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, curGiftsId) local giftGoodsInfo = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.GrowthReward, curGiftsId)

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
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 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,16 +165,12 @@ 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 })
else
NetManager.RequestBuyGiftGoods(data.goodsId, function()
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
self:RefreshGiftData() self:RefreshGiftData()
CheckRedPointStatus(RedPointType.DailyGift) CheckRedPointStatus(RedPointType.DailyGift)
end) end)
end 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})
else
NetManager.RequestBuyGiftGoods(type[curType].id,function()
this.RechargeSuccessFunc() this.RechargeSuccessFunc()
end) end)
end
end) end)
end end

View File

@ -70,10 +70,7 @@ 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 })
else
NetManager.RequestBuyGiftGoods(1004, function()
FirstRechargeManager.RefreshAccumRechargeValue(1004) FirstRechargeManager.RefreshAccumRechargeValue(1004)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
CheckRedPointStatus(RedPointType.DailyGift) CheckRedPointStatus(RedPointType.DailyGift)
@ -81,7 +78,6 @@ function GiftView:BindEvent()
timerList={} timerList={}
self:RefreshGiftData() self:RefreshGiftData()
end) end)
end
end) end)
end end
@ -544,10 +540,7 @@ 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 })
else
NetManager.RequestBuyGiftGoods(data.goodsId, function()
FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId) FirstRechargeManager.RefreshAccumRechargeValue(data.goodsId)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0) PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
CheckRedPointStatus(RedPointType.DailyGift) CheckRedPointStatus(RedPointType.DailyGift)
@ -557,7 +550,6 @@ function GiftView:RefreshShowData(item, data, buyType, DataTypeIndex)
end) end)
end 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})
else
NetManager.RequestBuyGiftGoods(type[curType].id,function()
this.RechargeSuccessFunc() this.RechargeSuccessFunc()
end) 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,14 +64,10 @@ 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
NetManager.RequestBuyGiftGoods(self.goodsId, function()
self:RechargeSuccessFunc(self.goodsId)
end) end)
end end
end
--充值成功的回调 --充值成功的回调
function UnlockExtraRewardPanel:RechargeSuccessFunc(id) function UnlockExtraRewardPanel:RechargeSuccessFunc(id)

View File

@ -40,11 +40,7 @@ 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 })
else
LogBlue("curGiftId:"..curGiftId)
NetManager.RequestBuyGiftGoods(curGiftId, function()
FirstRechargeManager.RefreshAccumRechargeValue(curGiftId) FirstRechargeManager.RefreshAccumRechargeValue(curGiftId)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测 CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包的红点检测
rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1 rechargeData.dynamicBuyTimes = rechargeData.dynamicBuyTimes - 1
@ -57,7 +53,6 @@ function this:BindEvent()
-- end -- end
this:Refresh() this:Refresh()
end) end)
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 })
else
NetManager.RequestBuyGiftGoods(itemData.goodsId, function()
self:RechargeSuccessFunc(itemData.goodsId) self:RechargeSuccessFunc(itemData.goodsId)
PlayerPrefs.SetInt(PlayerManager.uid.."czlb", 0)
CheckRedPointStatus(RedPointType.GrowthPackage)--成长礼包红点检测
end) 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
---=====================================对外接口=============================---- ---=====================================对外接口=============================----