Pārlūkot izejas kodu

Merge branch 'master' of http://10.108.64.190:3000/gfg/client

guodong 1 gadu atpakaļ
vecāks
revīzija
1162a27b83

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Controller/LogServerHelper.cs

@@ -18,7 +18,7 @@ namespace GFGGame
             logData.PlatFormId = LauncherConfig.platformId;
             logData.ServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
             logData.ChannelId = LauncherConfig.ChannelId;
-            logData.Account = SystemInfo.deviceUniqueIdentifier;
+            logData.Account = DeviceUniqueIdHelper.GetDeviceUniqueId();
             logData.EventType = node;
             var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
             //HttpTool.Instance.Post(GameConfig.logApiReportUrl, logStr);

+ 25 - 0
GameClient/Assets/Game/Launcher/Log/DeviceUniqueIdHelper.cs

@@ -0,0 +1,25 @@
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class DeviceUniqueIdHelper
+    {
+        private const string UniqueIdentifierKey = "UniqueIdentifier";
+
+        public static string GetDeviceUniqueId()
+        {
+            // 尝试从本地存储中获取唯一标识符
+            string uniqueIdentifier = PlayerPrefs.GetString(UniqueIdentifierKey);
+
+            // 如果本地存储中不存在唯一标识符,生成一个新的唯一标识符
+            if (string.IsNullOrEmpty(uniqueIdentifier))
+            {
+                uniqueIdentifier = SystemInfo.deviceUniqueIdentifier;
+                // 将唯一标识符存储到本地存储中
+                PlayerPrefs.SetString(UniqueIdentifierKey, uniqueIdentifier);
+            }
+            
+            return PlayerPrefs.GetString(UniqueIdentifierKey);
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/Launcher/Log/DeviceUniqueIdHelper.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 6e34e6a494c29c04885cca446b9ababe
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
GameClient/Assets/Game/Launcher/Log/LogServerHelperHttp.cs

@@ -12,7 +12,7 @@ namespace GFGGame
         /// <param name="node"></param>
         public static void SendNodeLog(int node)
         {
-            var body = $"?logStr={LauncherConfig.platformId}|{SystemInfo.deviceUniqueIdentifier}|{node}|{LauncherConfig.ChannelId}";
+            var body = $"?logStr={LauncherConfig.platformId}|{DeviceUniqueIdHelper.GetDeviceUniqueId()}|{node}|{LauncherConfig.ChannelId}";
             HttpTool.Instance.Get(LauncherConfig.logApiReportLauncherUrl + body, null,false);
         }
     }