improve:Dlass遥测

This commit is contained in:
2026-02-13 00:09:38 +08:00
parent 2d65224389
commit ed239929f3
3 changed files with 51 additions and 8 deletions
+15
View File
@@ -749,6 +749,21 @@ namespace Ink_Canvas
await Task.Delay(500);
}
DeviceIdentifier.RecordAppLaunch();
try
{
var systemVersion = DeviceIdentifier.GetSystemVersion();
if (!string.IsNullOrWhiteSpace(systemVersion))
{
SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("system_version", systemVersion);
});
}
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"App | 初始化系统版本遥测标签失败: {ex.Message}", LogHelper.LogType.Warning);
}
LogHelper.WriteLogToFile($"App | 设备ID: {DeviceIdentifier.GetDeviceId()}");
LogHelper.WriteLogToFile($"App | 使用频率: {DeviceIdentifier.GetUsageFrequency()}");
LogHelper.WriteLogToFile($"App | 更新优先级: {DeviceIdentifier.GetUpdatePriority()}");
+32 -4
View File
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using OSVersionExtension;
using System;
using System.Collections.Generic;
using System.IO;
@@ -405,7 +406,9 @@ namespace Ink_Canvas.Helpers
[JsonProperty("launchCount")]
public int LaunchCount { get; set; }
// 新的秒级精度字段
[JsonProperty("systemVersion")]
public string SystemVersion { get; set; }
[JsonProperty("totalUsageSeconds")]
public long TotalUsageSeconds { get; set; }
@@ -567,6 +570,20 @@ namespace Ink_Canvas.Helpers
// 记录每周启动次数
stats.RecordWeeklyLaunch();
try
{
var osName = OSVersion.GetOperatingSystem();
var osVersion = OSVersion.GetOSVersion();
string versionText = osVersion != null
? $"{osName} {osVersion.Version}"
: osName.ToString();
stats.SystemVersion = versionText;
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"DeviceIdentifier | 刷新系统版本信息失败: {ex.Message}", LogHelper.LogType.Warning);
}
// 计算使用频率
CalculateUsageFrequency(stats);
@@ -602,8 +619,6 @@ namespace Ink_Canvas.Helpers
// 更新秒级精度数据
stats.TotalUsageSeconds += sessionSeconds;
// 记录每周使用时长(秒级精度)
stats.RecordWeeklyUsage(sessionSeconds);
@@ -611,7 +626,6 @@ namespace Ink_Canvas.Helpers
if (stats.LaunchCount > 0)
{
stats.AverageSessionSeconds = (double)stats.TotalUsageSeconds / stats.LaunchCount;
}
}
@@ -631,6 +645,20 @@ namespace Ink_Canvas.Helpers
}
}
public static string GetSystemVersion()
{
try
{
var stats = LoadUsageStats();
return stats.SystemVersion;
}
catch (Exception ex)
{
LogHelper.WriteLogToFile($"DeviceIdentifier | 获取系统版本失败: {ex.Message}", LogHelper.LogType.Error);
return null;
}
}
/// <summary>
/// 计算使用频率和更新优先级(基于真实的每周统计数据)
/// 通过多维度评分系统确定用户类型:高频(≥80分)、中频(40-79分)、低频(<40分)
@@ -78,14 +78,14 @@ namespace Ink_Canvas.Windows.SettingsViews
}
else
{
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
AboutCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有";
AboutBottomCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有";
}
}
catch (Exception ex)
{
AboutCopyright.Text = "© Copyright 2024 Dubi906w 所有";
AboutBottomCopyright.Text = "© Copyright 2024 Dubi906w(Doubx690i/kriastans) 所有";
AboutCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有";
AboutBottomCopyright.Text = "© Copyright 2025-2026 CJK_mkp 所有";
System.Diagnostics.Debug.WriteLine($"获取版权信息失败: {ex.Message}");
}