parent
							
								
									3649c24d26
								
							
						
					
					
						commit
						e8884f325a
					
				|  | @ -171,17 +171,27 @@ namespace Guru | |||
|         { | ||||
|             if (adInfo == null) return; | ||||
|              | ||||
|             // #1. ad_impression  | ||||
|             try | ||||
|             { | ||||
|                 Log.I( $"[ADRevenue] - adUnitId:{adUnitId}, Revenue:{adInfo?.Revenue : 0}"); | ||||
|                  | ||||
|                 // #1 ad_impression | ||||
|                 OnAdImpression(adInfo); | ||||
|              | ||||
|             // #2. tch_ad_rev_roas calculation | ||||
|                 // #2 tch_001 | ||||
|                 double revenue = adInfo.Revenue; | ||||
|                 CalcTaichi001Value(revenue); | ||||
|                 CalcTaichi02Value(revenue); | ||||
|                  | ||||
|             // #3. Adjust ad_revenue | ||||
|                 // #3 adjust_ad_revenue | ||||
|                 AdjustService.TrackADRevenue(adInfo); | ||||
|                  | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 Analytics.LogCrashlytics(ex); | ||||
|             } | ||||
|          | ||||
|         } | ||||
| 
 | ||||
|         /// <summary> | ||||
|  |  | |||
|  | @ -11,6 +11,7 @@ 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 | ||||
|  | @ -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,6 +41,7 @@ namespace Guru | |||
| 			{ | ||||
| 				IPMConfig.IPM_UUID = IDHelper.GenUUID(IPMConfig.IPM_UID); | ||||
| 			} | ||||
| 			pushNotificationEnable = true; | ||||
| 			 | ||||
| 			deviceId = IPMConfig.IPM_DEVICE_ID; | ||||
| 			uid = IPMConfig.IPM_UID; | ||||
|  | @ -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; | ||||
|  |  | |||
|  | @ -12,11 +12,13 @@ namespace Guru | |||
| 	/// </summary> | ||||
| 	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; | ||||
| 		} | ||||
| 
 | ||||
| 		/// <summary> | ||||
| 		/// 设置是否打开推送 | ||||
| 		/// </summary> | ||||
| 		/// <param name="value"></param> | ||||
| 		/// <returns></returns> | ||||
| 		public DeviceInfoUploadRequest SetPushEnabled(bool value = true) | ||||
| 		{ | ||||
| 			_isPushEnabled = value; | ||||
| 			return this; | ||||
| 		} | ||||
| 
 | ||||
| 
 | ||||
| 	} | ||||
| } | ||||
		Loading…
	
		Reference in New Issue