From dfd4b633b7d45518760058056e29be4dab16f648 Mon Sep 17 00:00:00 2001 From: huyfei Date: Tue, 30 Jan 2024 14:24:11 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=20DeviceID=20?= =?UTF-8?q?=E7=9A=84=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F,=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BC=93=E5=AD=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/IPM/Scripts/DeviceUtil.cs | 1 - .../GuruCore/Runtime/IPM/Scripts/IPMConfig.cs | 24 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/DeviceUtil.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/DeviceUtil.cs index cf29501..96d4b8f 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/DeviceUtil.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/DeviceUtil.cs @@ -88,7 +88,6 @@ namespace Guru if(!string.IsNullOrEmpty(content)) { string[] infos = content.Split('$'); - IPMConfig.IPM_DEVICE_ID = SystemInfo.deviceUniqueIdentifier; IPMConfig.IPM_BRAND = infos[0]; IPMConfig.IPM_LANGUAGE = infos[1]; IPMConfig.IPM_MODEL = infos[2]; diff --git a/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs b/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs index ca47d8d..0eab7c4 100644 --- a/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs +++ b/Runtime/GuruCore/Runtime/IPM/Scripts/IPMConfig.cs @@ -28,7 +28,6 @@ namespace Guru public static readonly string POST_Param_TokenSecret = "tokenSecret"; public static string IPM_APP_PACKAGE_NAME = Application.identifier; - public static string IPM_DEVICE_ID = SystemInfo.deviceUniqueIdentifier; public static string IPM_APP_VERSION = Application.version; public static string IPM_IOS_APP_GROUP = "group." + Application.identifier; public static string IPM_BRAND = ""; @@ -39,6 +38,29 @@ namespace Guru public static string IPM_COUNTRY_CODE = RegionInfo.CurrentRegion.TwoLetterISORegionName; public static bool IPM_NEWUSER = true; + /// + /// 中台设备 ID + /// + public static string IPM_DEVICE_ID + { + get + { + if (string.IsNullOrEmpty(SavedDeviceId)) + { + SavedDeviceId = SystemInfo.deviceUniqueIdentifier; // 目前使用 UNITY 接口来生成对应的 DeviceID + } + return SavedDeviceId; // 优先使用缓存的 DeviceID + } + } + /// + /// 缓存设备 ID + /// + private static string SavedDeviceId + { + get => PlayerPrefs.GetString(nameof(SavedDeviceId), ""); + set => PlayerPrefs.SetString(nameof(SavedDeviceId), value); + } + #if DEBUG public static readonly string IPM_URL = "https://dev.saas.castbox.fm/"; #else