google支付问题

This commit is contained in:
xiekaidong 2023-07-03 14:24:57 +08:00
parent 1cd1d31d98
commit ecddb99390

View File

@ -66,6 +66,7 @@ function SDKPayGoogleManager:queryProducts(callback)
if #subsList > 0 then if #subsList > 0 then
self:queryProductInfo(PAY_TYPE_SUBS, json.encode(subsList), function(code, msg) self:queryProductInfo(PAY_TYPE_SUBS, json.encode(subsList), function(code, msg)
if code == 0 then if code == 0 then
self.queryProductsOver = true
if msg and msg ~= "" then -- 更新products if msg and msg ~= "" then -- 更新products
local jData = json.decode(msg) local jData = json.decode(msg)
if jData and #jData > 0 then if jData and #jData > 0 then
@ -80,6 +81,7 @@ function SDKPayGoogleManager:queryProducts(callback)
end end
end) end)
else else
self.queryProductsOver = true
if callback then if callback then
callback() callback()
end end
@ -262,6 +264,7 @@ end
-- 检查是否可以支付 -- 检查是否可以支付
function SDKPayGoogleManager:checkPay(productId, callback) function SDKPayGoogleManager:checkPay(productId, callback)
if self:_getIsGoogleStoreConnected() then -- google商店是否初始化 if self:_getIsGoogleStoreConnected() then -- google商店是否初始化
self:queryProducts(function()
self:doUncompleteOrder(function(code) -- 先处理未完成的订单 self:doUncompleteOrder(function(code) -- 先处理未完成的订单
if code == 0 then if code == 0 then
callback(0) callback(0)
@ -283,9 +286,11 @@ function SDKPayGoogleManager:checkPay(productId, callback)
callback(0) callback(0)
end end
end, productId) end, productId)
end)
else else
self:connectGoogleStore(function(code) self:connectGoogleStore(function(code)
if code == 0 then if code == 0 then
self:queryProducts(function()
self:doUncompleteOrder(function(consumeSucc) self:doUncompleteOrder(function(consumeSucc)
if code == 0 then if code == 0 then
callback(0) callback(0)
@ -307,6 +312,7 @@ function SDKPayGoogleManager:checkPay(productId, callback)
callback(0) callback(0)
end end
end, productId) end, productId)
end)
else else
local params = { local params = {
content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_22), content = I18N:getGlobalText(I18N.GlobalConst.SETTING_DESC_22),