update: Json 解析添加 TryCatch

deeplink
胡宇飞 2024-03-18 15:19:44 +08:00
parent a056a5c23d
commit 7bd9413a83
2 changed files with 49 additions and 33 deletions

View File

@ -1,5 +1,7 @@
using System;
namespace Guru
{
using System.Text;
@ -49,24 +51,31 @@ namespace Guru
protected override void RequestSuccessCallBack(string response)
{
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
if (responseData != null && responseData.data != null)
try
{
double usdPrice = responseData.data.usdPrice;
Analytics.Tch001IAPRev(usdPrice);
Analytics.Tch02IAPRev(usdPrice);
if (orderType == 0)
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
if (responseData != null && responseData.data != null)
{
AdjustService.TrackIAPPurchase(usdPrice, productId);
Analytics.IAPPurchase(usdPrice, productId);
double usdPrice = responseData.data.usdPrice;
Analytics.Tch001IAPRev(usdPrice);
Analytics.Tch02IAPRev(usdPrice);
if (orderType == 0)
{
AdjustService.TrackIAPPurchase(usdPrice, productId);
Analytics.IAPPurchase(usdPrice, productId);
}
else if (orderType == 1)
{
AdjustService.TrackSubPurchase(usdPrice, productId);
Analytics.SubPurchase(usdPrice, productId);
}
}
else if (orderType == 1)
{
AdjustService.TrackSubPurchase(usdPrice, productId);
Analytics.SubPurchase(usdPrice, productId);
}
}
catch (Exception ex)
{
Analytics.LogCrashlytics(ex);
}
}
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Text;
using Guru.LitJson;
using UnityEngine;
@ -48,31 +49,37 @@ namespace Guru
protected override void RequestSuccessCallBack(string response)
{
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
if (responseData != null && responseData.data != null)
try
{
// Analytics.Tch001IAPRev(responseData.data.usdPrice);
double usdPrice = responseData.data.usdPrice;
Analytics.Tch001IAPRev(usdPrice);
Analytics.Tch02IAPRev(usdPrice);
ResponseData<OrderResponse> responseData = JsonUtility.FromJson<ResponseData<OrderResponse>>(response);
if (responseData != null && responseData.data != null)
{
// Analytics.Tch001IAPRev(responseData.data.usdPrice);
double usdPrice = responseData.data.usdPrice;
Analytics.Tch001IAPRev(usdPrice);
Analytics.Tch02IAPRev(usdPrice);
string pid = "";
string pid = "";
if (!string.IsNullOrEmpty(productId))
{
pid = productId;
AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件
Analytics.IAPPurchase(usdPrice, pid);
}
if (!string.IsNullOrEmpty(productId))
{
pid = productId;
AdjustService.TrackIAPPurchase(usdPrice, productId); // 上报 IAP 支付事件
Analytics.IAPPurchase(usdPrice, pid);
}
if (!string.IsNullOrEmpty(subscriptionId))
{
pid = subscriptionId;
AdjustService.TrackSubPurchase(usdPrice, productId); // 上报 订阅 支付事件
Analytics.SubPurchase(usdPrice, productId);
if (!string.IsNullOrEmpty(subscriptionId))
{
pid = subscriptionId;
AdjustService.TrackSubPurchase(usdPrice, productId); // 上报 订阅 支付事件
Analytics.SubPurchase(usdPrice, productId);
}
}
}
catch (Exception ex)
{
Analytics.LogCrashlytics(ex);
}
}