update: 更新IAP日志

feature/Inventory
胡宇飞 2024-01-18 16:44:52 +08:00
parent ad5b1d3149
commit 664f574e53
1 changed files with 11 additions and 3 deletions

View File

@ -480,6 +480,7 @@ namespace Guru
}
PurchaseCount++; // 记录支付次数
Debug.Log($"############ ProcessPurchase: PurchaseCount:{PurchaseCount}");
ReportPurchaseResult(purchaseEvent); // 支付结果上报
string productName = info?.Name ?? "NULL";
@ -488,7 +489,7 @@ namespace Guru
OnPurchaseOver(success, productName); // 支付成功处理逻辑
OnBuyEnd?.Invoke(productName, success);
return PurchaseProcessingResult.Complete;
return PurchaseProcessingResult.Complete; // 直接Consume 掉当前的商品
}
/// <summary>
@ -582,8 +583,12 @@ namespace Guru
int blevel = GetBLevel();
int orderType = args.purchasedProduct.definition.type == ProductType.Subscription ? 1 : 0;
Debug.Log($"############ ReportPurchaseResult: _validator:{_validator }");
if (_validator == null)
{
Debug.Log($"############ --- Validator is null");
LogE($"{Tag} --- Validator is null. Report Order failed.");
Crashlytics.LogException(new Exception($"IAPService can not report order because Validator is null!"));
return;
@ -592,7 +597,8 @@ namespace Guru
try
{
// ----- 支付后的b_level上报逻辑
LogI($"--- Report level:[{blevel}] in id:{args.purchasedProduct.definition.id} ");
LogI($"--- Report b_level:[{blevel}] with product id:{args.purchasedProduct.definition.id} ");
#if UNITY_EDITOR
// Editor 不做上报逻辑
#elif UNITY_ANDROID
@ -603,6 +609,8 @@ namespace Guru
LogI($"{Tag} --- Report Android IAP Order -> orderType:{orderType} productID:{productID} blevel:{blevel}");
Debug.Log($"############ --- result.Count: {result.Length}");
foreach (var productReceipt in result)
{
if (productReceipt is GooglePlayReceipt google)
@ -627,7 +635,7 @@ namespace Guru
}
catch (Exception e)
{
LogE($"【IAPManager.RevenueUpload】De Exception:{e.Message}");
LogE($" [IAPManager.RevenueUpload] got Exception: {e.Message}");
Crashlytics.LogException(new Exception($"[IAP] Unity report purchase data with b_level={blevel} got error: {e.Message}"));
}
}