From 735b7177bae2a023af7f5e41f413acc468fc0c7e Mon Sep 17 00:00:00 2001 From: hjhan Date: Wed, 29 Apr 2026 16:54:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(monitor):=20=E6=B7=BB=E5=8A=A0=E7=A5=9E?= =?UTF-8?q?=E7=AD=96=E6=95=B0=E6=8D=AE=E8=AF=8A=E6=96=AD=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E6=8E=92=E6=9F=A5=20platform=5Ftype=20=E5=92=8C=20uid?= =?UTF-8?q?=20=E4=B8=BA=E6=9C=AA=E7=9F=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YLErpWeb/Controllers/CommonController.cs | 15 +++++++++++++++ YLErpWeb/Views/Shared/_MainLayout.cshtml | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/YLErpWeb/Controllers/CommonController.cs b/YLErpWeb/Controllers/CommonController.cs index 67bbce1c..05983174 100644 --- a/YLErpWeb/Controllers/CommonController.cs +++ b/YLErpWeb/Controllers/CommonController.cs @@ -60,5 +60,20 @@ } } + [HttpPost] + public IActionResult LogSensors([FromBody] SensorsLogModel model) + { + var logger = LogFactory.GetLogger("SensorsDiag"); + logger.Info($"[SensorsLog] uid={model?.Uid ?? "NULL"} platform={model?.Platform ?? "NULL"} ua={model?.Ua ?? "NULL"} url={model?.Url ?? "NULL"}"); + return Ok(); + } + } + + public class SensorsLogModel + { + public string Uid { get; set; } + public string Platform { get; set; } + public string Ua { get; set; } + public string Url { get; set; } } } diff --git a/YLErpWeb/Views/Shared/_MainLayout.cshtml b/YLErpWeb/Views/Shared/_MainLayout.cshtml index 7c694e14..4a9d6388 100644 --- a/YLErpWeb/Views/Shared/_MainLayout.cshtml +++ b/YLErpWeb/Views/Shared/_MainLayout.cshtml @@ -121,6 +121,25 @@ sensors.setOnceProfile({ userId: '@CurUser.OaAccount', name: '@CurUser.UserName' }); } + // 神策诊断日志(精简版) + (function () { + try { + var diag = { + uid: '@CurUser?.UserId' || 'NULL', + platform: sensorsConfig._platformType || 'onederiv', + ua: (navigator.userAgent || '').substring(0, 50) || 'NULL', + url: location.href + }; + $.ajax({ + url: '/common/LogSensors', + type: 'POST', + contentType: 'application/json', + data: JSON.stringify(diag), + async: true + }); + } catch (e) { } + })(); + window.saTrack = function (eventName, props) { try { if (!window.sensors || !sensors.track) { return; }