From e8884f325a2acc91b825e08333b203ab246161c0 Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 24 May 2024 14:35:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=85=B3=E9=97=AD=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huyufei --- Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs | 30 ++++++++++++------- .../IPM/Scripts/RequestData/DeviceData.cs | 8 ++--- .../Requests/DeviceInfoUploadRequest.cs | 15 ++++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs b/Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs index ec606b5..e8fae02 100644 --- a/Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs +++ b/Runtime/GuruCore/Runtime/Ads/ADServiceBase.cs @@ -171,16 +171,26 @@ namespace Guru { if (adInfo == null) return; - // #1. ad_impression - OnAdImpression(adInfo); - - // #2. tch_ad_rev_roas calculation - double revenue = adInfo.Revenue; - CalcTaichi001Value(revenue); - CalcTaichi02Value(revenue); - - // #3. Adjust ad_revenue - AdjustService.TrackADRevenue(adInfo); + try + { + Log.I( $"[ADRevenue] - adUnitId:{adUnitId}, Revenue:{adInfo?.Revenue : 0}"); + + // #1 ad_impression + OnAdImpression(adInfo); + + // #2 tch_001 + double revenue = adInfo.Revenue; + CalcTaichi001Value(revenue); + CalcTaichi02Value(revenue); + + // #3 adjust_ad_revenue + AdjustService.TrackADRevenue(adInfo); + + } + catch (Exception ex) + { + Analytics.LogCrashlytics(ex); + } } diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs index f200c90..7d4727c 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/RequestData/DeviceData.cs @@ -11,7 +11,8 @@ namespace Guru public class DeviceData { private const string PUSH_TYPE_FCM = "FCM"; - + public bool pushNotificationEnable; //必填,默认true,发送消息的总开关 + public string deviceId; //必填,设备唯一ID public string uid; //必填,用户唯一ID,授权结果返回的uid public string androidId; //android设备有效 @@ -27,7 +28,6 @@ namespace Guru public string brand; //手机品牌 public string model; //手机品牌下的手机型号 public string timezone; //必填,时区,用于按照当地时间发推送消息,如America/Chicago - public bool pushNotificationEnable; //必填,默认true,发送消息的总开关 public string firebaseAppInstanceId; // 可选, firebase应用实例id public string idfa; // 可选, ios广告id public string adid; // 可选, adjust id @@ -41,7 +41,8 @@ namespace Guru { IPMConfig.IPM_UUID = IDHelper.GenUUID(IPMConfig.IPM_UID); } - + pushNotificationEnable = true; + deviceId = IPMConfig.IPM_DEVICE_ID; uid = IPMConfig.IPM_UID; androidId = SystemInfo.deviceUniqueIdentifier; // Unity get AndroidID @@ -57,7 +58,6 @@ namespace Guru brand = IPMConfig.IPM_BRAND; model = IPMConfig.IPM_MODEL; timezone = IPMConfig.IPM_TIMEZONE; - pushNotificationEnable = true; firebaseAppInstanceId = IPMConfig.FIREBASE_ID; idfa = IPMConfig.ADJUST_IDFA; adid = IPMConfig.ADJUST_ADID; diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs index 7644f74..7b7a56b 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/Requests/DeviceInfoUploadRequest.cs @@ -12,11 +12,13 @@ namespace Guru /// public class DeviceInfoUploadRequest : RequestBase { + private bool _isPushEnabled = true; protected override string RequestURL => IPMConfig.IPM_URL + "device/api/v1/devices"; protected override UnityWebRequest CreateRequest() { DeviceData deviceData = new DeviceData(); + deviceData.pushNotificationEnable = _isPushEnabled; this.Log($"send deviceData:{deviceData}"); var request = new UnityWebRequest(RequestURL, "POST"); request.uploadHandler = new UploadHandlerRaw(Encoding.UTF8.GetBytes(JsonUtility.ToJson(deviceData))); @@ -32,5 +34,18 @@ namespace Guru this.Log("@@@ Send OK!"); IPMConfig.IS_UPLOAD_DEVICE_SUCCESS = true; } + + /// + /// 设置是否打开推送 + /// + /// + /// + public DeviceInfoUploadRequest SetPushEnabled(bool value = true) + { + _isPushEnabled = value; + return this; + } + + } } \ No newline at end of file