Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev
This commit is contained in:
commit
326cde1c4b
@ -133,18 +133,20 @@ function PayManager:purchasePackage(id, purchaseType)
|
||||
self:checkAndPay(productId, id, purchaseType, rechargeId)
|
||||
end
|
||||
|
||||
function PayManager:requestRewards(purchaseToken, orderId, originOrderId, giftType, id, rechargeId)
|
||||
function PayManager:requestRewards(purchaseToken, orderId, originOrderId, notShowRewardsBox)
|
||||
self:sendMsgToServer(purchaseToken, orderId, function(binder, msgData)
|
||||
if msgData.status == 0 then
|
||||
if msgData.rewards and table.nums(msgData.rewards) > 0 then
|
||||
GFunc.showRewardBox(msgData.rewards)
|
||||
end
|
||||
BIReport:postPayGet(giftType, id, rechargeId, orderId, originOrderId, 1, msgData.rewards or {})
|
||||
local rechargeCfg = ConfigManager:getConfig("recharge")[rechargeId]
|
||||
if rechargeCfg then
|
||||
BIReport:postPurchase(rechargeCfg.price, rechargeCfg.payId, originOrderId, orderId)
|
||||
local showRewards = not notShowRewardsBox
|
||||
if DataManager.TutorialData and DataManager.TutorialData:getIsInTutorial() then -- 引导时不弹
|
||||
showRewards = false
|
||||
end
|
||||
if showRewards then
|
||||
GFunc.showRewardBox(msgData.rewards)
|
||||
end
|
||||
end
|
||||
|
||||
local biPayGetInfo = {}
|
||||
table.foreach(msgData.gift, function(i, gift)
|
||||
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type]
|
||||
local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id]
|
||||
@ -152,8 +154,21 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, giftTy
|
||||
DataManager.PlayerData:addPayment(rechargeId)
|
||||
DataManager.ShopData:addPayment(rechargeId) -- 降档版本
|
||||
DataManager.ShopData:updateGiftInfo(gift)
|
||||
table.insert(biPayGetInfo, {
|
||||
giftType = gift.act_type,
|
||||
giftId = gift.id,
|
||||
rechargeId = cfgInfo.recharge_id
|
||||
})
|
||||
end)
|
||||
|
||||
for _, info in ipairs(biPayGetInfo) do
|
||||
BIReport:postPayGet(info.giftType, info.giftId, info.rechargeId, orderId, originOrderId, 1, msgData.rewards or {})
|
||||
local rechargeCfg = ConfigManager:getConfig("recharge")[info.rechargeId]
|
||||
if rechargeCfg then
|
||||
BIReport:postPurchase(rechargeCfg.price, rechargeCfg.payId, originOrderId, orderId)
|
||||
end
|
||||
end
|
||||
|
||||
-- 支付验证成功后消耗此订单
|
||||
if purchaseToken then
|
||||
SDKManager:consumePurchase(purchaseToken)
|
||||
@ -186,7 +201,7 @@ function PayManager:checkAndPay(productId, id, purchaseType, rechargeId)
|
||||
BIReport:postPayTurn(giftType, id, rechargeId)
|
||||
SDKManager:pay(productId, msgData.uuid, rechargeId, giftType, function(purchaseToken, orderId, originOrderId)
|
||||
if purchaseToken and orderId then
|
||||
self:requestRewards(purchaseToken, orderId, originOrderId, giftType, id, rechargeId)
|
||||
self:requestRewards(purchaseToken, orderId, originOrderId)
|
||||
end
|
||||
end)
|
||||
else -- 没有支付信息,直接发奖
|
||||
|
||||
@ -28,7 +28,7 @@ function SDKPayGoogleManager.onGooglePayDelayCallback(code, msg)
|
||||
return
|
||||
end
|
||||
if result.obfuscatedAccountId then
|
||||
PayManager:requestRewards(purchaseToken, result.obfuscatedAccountId)
|
||||
PayManager:requestRewards(purchaseToken, result.obfuscatedAccountId, result.orderId)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -125,7 +125,7 @@ function SDKPayGoogleManager:reqPayReward(uncompleteList, productId, callback)
|
||||
elseif uncompleteOrder.purchaseToken then
|
||||
-- 去服务器验证
|
||||
if uncompleteOrder.obfuscatedAccountId then
|
||||
PayManager:requestRewards(uncompleteOrder.purchaseToken, uncompleteOrder.obfuscatedAccountId)
|
||||
PayManager:requestRewards(uncompleteOrder.purchaseToken, uncompleteOrder.obfuscatedAccountId, uncompleteOrder.orderId, true)
|
||||
else
|
||||
SDKManager:consumePurchase(uncompleteOrder.purchaseToken, function()
|
||||
index = index + 1
|
||||
|
||||
@ -766,14 +766,12 @@ function ShopData:getHasGotFirstRechargeReward()
|
||||
return boughtNum > 0
|
||||
end
|
||||
|
||||
-- 侧边栏是否展示 要求功能开启 等级不低于2 未领取该奖励
|
||||
-- 侧边栏是否展示 要求功能开启 未领取该奖励
|
||||
function ShopData:getShowFirstRechargeSideBar()
|
||||
if not self:getIsFirstRechargeOpen() then
|
||||
return false
|
||||
end
|
||||
|
||||
local lv = DataManager.PlayerData:getLv()
|
||||
if lv > 1 and not self:getHasGotFirstRechargeReward() then
|
||||
if not self:getHasGotFirstRechargeReward() then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user