|
|
@@ -16,12 +16,13 @@ public class LogServer : Singleton<LogServer>
|
|
|
public string version;
|
|
|
private string deviceModel;
|
|
|
private string operatingSystem;
|
|
|
+ private Dictionary<string, float> _hashDic = new Dictionary<string, float>();
|
|
|
|
|
|
public void Init(string gameName)
|
|
|
{
|
|
|
this.gameName = gameName;
|
|
|
version = Application.version;
|
|
|
- deviceModel = SystemInfo.deviceName + " " + SystemInfo.deviceModel+" "+SystemInfo.deviceUniqueIdentifier;
|
|
|
+ deviceModel = SystemInfo.deviceName + " " + SystemInfo.deviceModel + " " + SystemInfo.deviceUniqueIdentifier;
|
|
|
operatingSystem = SystemInfo.operatingSystem;
|
|
|
}
|
|
|
|
|
|
@@ -71,6 +72,26 @@ public class LogServer : Singleton<LogServer>
|
|
|
|
|
|
private async Task UpdatToServer(LogServeData logServeData)
|
|
|
{
|
|
|
+ float ct = Time.time;
|
|
|
+ if (_hashDic.Count > 200)
|
|
|
+ {
|
|
|
+ _hashDic.Clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_hashDic.TryGetValue(logServeData.hash, out float t))
|
|
|
+ {
|
|
|
+ if ((ct - t) < 10)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ _hashDic[logServeData.hash] = ct;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _hashDic.Add(logServeData.hash, t);
|
|
|
+ }
|
|
|
+
|
|
|
string json = LitJson.JsonMapper.ToJson(logServeData);
|
|
|
byte[] logData = Encoding.UTF8.GetBytes(json);
|
|
|
using var httpClient = new HttpClient();
|