|
@@ -403,49 +403,46 @@ namespace TEAMModelOS.SDK.DI
|
|
|
/// <param name="msg"></param>
|
|
|
/// <param name="dingDing"></param>
|
|
|
/// <param name="scope"></param>
|
|
|
- /// <param name="bizId"></param>
|
|
|
/// <param name="option"></param>
|
|
|
/// <param name="httpContext"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static async Task SaveBILog(this AzureStorageFactory azureStorage, string type, string msg, DingDing dingDing, string scope = null, string bizId = null, Option option = null, HttpContext httpContext = null)
|
|
|
+ public static async Task SaveBILog(this AzureStorageFactory azureStorage, string type, string msg, DingDing dingDing, string scope = null, Option option = null, HttpContext httpContext = null)
|
|
|
{
|
|
|
- var table = azureStorage.GetCloudTableClient().GetTableReference("OptLog");
|
|
|
- OptLog log = new() { RowKey = Guid.NewGuid().ToString() };
|
|
|
+ var table = azureStorage.GetCloudTableClient().GetTableReference("BIOptLog");
|
|
|
+ BIOptLog biLog = new() { RowKey = Guid.NewGuid().ToString() };
|
|
|
try
|
|
|
{
|
|
|
- object id = null, school = null, name = null, website = null;
|
|
|
+ object id = null, name = null, ddid = null, ddname = null, school = null, website = null;
|
|
|
httpContext?.Items.TryGetValue("ID", out id);
|
|
|
- httpContext?.Items.TryGetValue("School", out school);
|
|
|
httpContext?.Items.TryGetValue("Name", out name);
|
|
|
+ httpContext?.Items.TryGetValue("DDId", out ddid);
|
|
|
+ httpContext?.Items.TryGetValue("DDName", out ddname);
|
|
|
+ httpContext?.Items.TryGetValue("School", out school);
|
|
|
httpContext?.Items.TryGetValue("Website", out website);
|
|
|
- log.tmdId = id != null ? $"{id}" : log.tmdId;
|
|
|
- log.name = name != null ? $"{name}" : log.name;
|
|
|
+ biLog.tmdId = id != null ? $"{id}" : biLog.tmdId;
|
|
|
+ biLog.name = name != null ? $"{name}" : biLog.name;
|
|
|
+ biLog.school = school != null ? $"{school}" : biLog.school;
|
|
|
+ biLog.PartitionKey = type != null ? $"{website}-Log-{type}" : $"{website}-Log-Default";
|
|
|
+ biLog.platform = website != null ? $"{website}" : "Default";
|
|
|
+ biLog.msg = msg;
|
|
|
+ biLog.type = type;
|
|
|
+ biLog.scope = scope;
|
|
|
string host = httpContext?.Request?.Host.Value;
|
|
|
- log.school = school != null ? $"{school}" : log.school;
|
|
|
- log.PartitionKey = type != null ? $"Log-{type}" : "Log-Default";
|
|
|
- log.RowKey = bizId != null ? bizId : log.RowKey;
|
|
|
- log.platform = website != null ? $"{website}" : "Default";
|
|
|
- log.msg = msg;
|
|
|
- log.type = type;
|
|
|
- log.scope = scope;
|
|
|
host = !string.IsNullOrWhiteSpace($"{host}") ? $"{host}" : option?.Location != null ? $"{host}" : "Default";
|
|
|
- log.url = $"{host}{httpContext?.Request.Path}";
|
|
|
+ biLog.url = $"{host}{httpContext?.Request.Path}";
|
|
|
if (!string.IsNullOrWhiteSpace(msg) && msg.Length > 255)
|
|
|
{
|
|
|
- log.saveMod = 1;
|
|
|
- log.jsonfile = $"/0-public/optlog/{log.RowKey}-{log.PartitionKey}.json";
|
|
|
- await azureStorage.UploadFileByContainer("0-public", log.ToJsonString(), "optlog", $"{log.RowKey}-{log.PartitionKey}.json");
|
|
|
- log.msg = null;
|
|
|
- await table.SaveOrUpdate<OptLog>(log);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- await table.SaveOrUpdate<OptLog>(log);
|
|
|
+ biLog.saveMod = 1;
|
|
|
+ biLog.jsonfile = $"/0-public/BIOptLog/{biLog.PartitionKey}-{biLog.RowKey}.json";
|
|
|
+ await azureStorage.UploadFileByContainer("0-public", biLog.ToJsonString(), "BIOptLog", $"{biLog.PartitionKey}-{biLog.RowKey}.json");
|
|
|
+ biLog.msg = null;
|
|
|
+ await table.SaveOrUpdate<BIOptLog>(biLog);
|
|
|
}
|
|
|
+ else await table.SaveOrUpdate<BIOptLog>(biLog);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
- _ = dingDing.SendBotMsg($"日志保存失败:{ex.Message},{ex.StackTrace},{log.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
+ _ = dingDing.SendBotMsg($"BI日志保存失败:{ex.Message},{ex.StackTrace},{biLog.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
}
|
|
|
}
|
|
|
}
|