feat(monitor): 添加神策数据诊断日志,排查 platform_type 和 uid 为未知的问题
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user