CrazyIter_Bin 1 year ago
parent
commit
3d19a249df

+ 2 - 2
TEAMModelBI/Controllers/BIBlob/AnalyseFileController.cs

@@ -206,7 +206,7 @@ namespace TEAMModelBI.Controllers.BIBlob
             RecCnt saveCnts = new();
             //var ipGroup = aGInfos.GroupBy(g => g.properties.clientIp).ToDictionary(k => k.Key, k => k.Count()).ToList();
 
-            List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.clientIp, api = s.properties.requestUri.Split("?").ToList().Count() > 1 ? s.properties.requestUri.Split("?").ToList()[0] : s.properties.requestUri, hostName = s.properties.hostname }).ToList();
+            List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.CIp, api = s.properties.CsUriStem.Split("?").ToList().Count() > 1 ? s.properties.CsUriStem.Split("?").ToList()[0] : s.properties.CsUriStem, hostName = s.properties.CsHost }).ToList();
 
             List<RecApiCnt> apiCnt = recInfo.GroupBy(a => a.api).Select(g => new RecApiCnt { api = g.Key, count = g.Count(), hour = cHour, hostName = g.Select(h => h.hostName).Distinct().ToList(), ip = g.Select(i => i.ip).Distinct().ToList() }).ToList();
             saveCnts.apiCnt= apiCnt;
@@ -296,7 +296,7 @@ namespace TEAMModelBI.Controllers.BIBlob
 
                 RecCnt saveCnts = new();
 
-                List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.clientIp, api = s.properties.requestUri.Split("?").ToList().Count() > 1 ? s.properties.requestUri.Split("?").ToList()[0] : s.properties.requestUri, hostName = s.properties.hostname }).ToList();
+                List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.CIp, api = s.properties.CsUriStem.Split("?").ToList().Count() > 1 ? s.properties.CsUriStem.Split("?").ToList()[0] : s.properties.CsUriStem, hostName = s.properties.CsHost }).ToList();
 
                 List<RecApiCnt> apiCnt = recInfo.GroupBy(a => a.api).Select(g => new RecApiCnt { api = g.Key, count = g.Count(), hour = cHour, hostName = g.Select(h => h.hostName).Distinct().ToList(), ip = g.Select(i => i.ip).Distinct().ToList() }).ToList();
                 saveCnts.apiCnt = apiCnt;

+ 20 - 16
TEAMModelOS.FunctionV4/TimeTrigger/IESTimerTrigger.cs

@@ -62,7 +62,7 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
         /// <param name="req"></param>
         /// <param name="log"></param>
         /// <returns></returns>
-      //  [Function("FireWallFileLog")]
+        [Function("FireWallFileLog")]
         //https://docs.azure.cn/zh-cn/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp
         //0 1 * * * * 一天中每小时的第 1 分钟
         //0 */10 * * * *  每五分钟一次
@@ -83,29 +83,33 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
 #endif
 
                 {
-                    string path = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/OSFIREWARE/y={y}/m={m}/d={d}/h={h}/m=00/PT1H.json";
-                    var retn = await BILogAnalyseService.GetPathAnalyse(_azureStorage,_ipSearcher,_dingDing, path, "LogStorage");
+                    //string path = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/OSFIREWARE/y={y}/m={m}/d={d}/h={h}/m=00/PT1H.json";
+                    string path = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.WEB/SITES/TEAMMODELOS/y={y}/m={m}/d={d}/h={h}/m=00/PT1H.json";
+                    var retn = await BILogAnalyseService.GetPathAnalyse(_azureStorage, _ipSearcher, _dingDing, path, "LogStorage");
                     if (retn.recCnts.IsNotEmpty())
                     {
                         //https://teammodelos.blob.core.chinacloudapi.cn/0-public/pie-borderRadius.html
-                        string publishUrl = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={HttpUtility.UrlEncode(retn.saveUrls.First(),Encoding.UTF8)}&time={HttpUtility.UrlEncode(datetime.AddHours(8).ToString("yyyy年MM月dd日 HH时"),Encoding.UTF8)}";
+                        string publishUrl = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={HttpUtility.UrlEncode(retn.saveUrls.First(), Encoding.UTF8)}&time={HttpUtility.UrlEncode(datetime.AddHours(8).ToString("yyyy年MM月dd日 HH时"), Encoding.UTF8)}";
                         string ulrs = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={retn.saveUrls.First()}&time={datetime.AddHours(8).ToString("yyyy年MM月dd日 HH时")}";
-                        string ulr = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(ulrs,Encoding.UTF8)}&delay=5000";
+                        string ulr = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(ulrs, Encoding.UTF8)}&delay=5000";
                         string image = "";
                         try
                         {
                             string strs = await _httpClient.CreateClient().GetStringAsync(ulr);
-                            if (!string.IsNullOrWhiteSpace(strs)) {
+                            if (!string.IsNullOrWhiteSpace(strs))
+                            {
                                 JsonElement json = strs.ToObject<JsonElement>();
                                 json.TryGetProperty("url", out JsonElement base64);
-                                using (MemoryStream ms = new MemoryStream(Convert.FromBase64String($"{base64}"))) {
-                                    image = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer( ms, $"visitCnt/{y}{m}{d}", $"{y}{m}{d}{h}.png",false);
+                                using (MemoryStream ms = new MemoryStream(Convert.FromBase64String($"{base64}")))
+                                {
+                                    image = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(ms, $"visitCnt/{y}{m}{d}", $"{y}{m}{d}{h}.png", false);
                                 }
-                                   
+
                             }
                         }
-                        catch (Exception ex) { 
-                          
+                        catch (Exception ex)
+                        {
+
                         }
                         await _dingDing.SendBotMarkdown("防火墙日志记录", $"#### 防火墙日志记录(小时)\n> 记录时间:{datetime.AddHours(8).ToString("yyyy-MM-dd HH")}\n> ![screenshot]({image})\n> ###### 发布时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}" +
                             $" [发布地址]({publishUrl}) \n", GroupNames.醍摩豆服務運維群組);
@@ -119,10 +123,10 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
                         var ptM = pastTime.Month >= 10 ? $"{pastTime.Month}" : $"0{pastTime.Month}";
                         var ptD = pastTime.Day >= 10 ? $"{pastTime.Day}" : $"0{pastTime.Day}";
 
-                        string dayPath = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/OSFIREWARE/y={ptY}/m={ptM}/d={ptD}";
-                        var retnDay = await BILogAnalyseService.GetPathAnalyse(_azureStorage, _ipSearcher, _dingDing, dayPath, "LogStorage",timeType:"Day");
+                        string dayPath = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.WEB/SITES/TEAMMODELOS/y={ptY}/m={ptM}/d={ptD}";
+                        var retnDay = await BILogAnalyseService.GetPathAnalyse(_azureStorage, _ipSearcher, _dingDing, dayPath, "LogStorage", timeType: "Day");
 
-                        if (retn.recCnts.IsNotEmpty()) 
+                        if (retn.recCnts.IsNotEmpty())
                         {
                             //一天的统计
                             string dayPublishUrl = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={HttpUtility.UrlEncode(retnDay.saveUrls.First(), Encoding.UTF8)}&time={HttpUtility.UrlEncode(pastTime.ToString("yyyy年MM月dd日"), Encoding.UTF8)}";
@@ -133,11 +137,11 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
                             try
                             {
                                 string dayStr = await _httpClient.CreateClient().GetStringAsync(dayUrl);
-                                if (!string.IsNullOrWhiteSpace(dayStr)) 
+                                if (!string.IsNullOrWhiteSpace(dayStr))
                                 {
                                     JsonElement dayJson = dayStr.ToObject<JsonElement>();
                                     dayJson.TryGetProperty("url", out JsonElement dayBase64);
-                                    using (MemoryStream dayMs = new(Convert.FromBase64String($"{dayBase64}"))) 
+                                    using (MemoryStream dayMs = new(Convert.FromBase64String($"{dayBase64}")))
                                     {
                                         dayImage = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(dayMs, $"visitCnt/{ptY}{ptM}{ptD}", "days.png", false);
                                     }

+ 68 - 1
TEAMModelOS.SDK/Models/Cosmos/BI/RecAppGWInfo.cs

@@ -79,7 +79,8 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI
         public string operationName { get; set; }
         public string time { get; set; }
         public string category { get; set; }
-        public Properties properties { get; set; }
+        public PropertiesWeb properties { get; set; }
+        public string resourceId { get; set; }
     }
 
     /// <summary>
@@ -102,4 +103,70 @@ namespace TEAMModelOS.SDK.Models.Cosmos.BI
         public string hostname { get; set; }
         public string transactionId { get; set; }
     }
+    public record PropertiesWeb
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CsMethod { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CsUriStem { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string SPort { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CIp { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string UserAgent { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CsHost { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ScStatus { get; set; }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ScBytes { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int CsBytes { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public int TimeTaken { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Result { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Cookie { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        public string CsUriQuery { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Referer { get; set; }
+        /// <summary>
+        /// 
+        /// </summary>
+    }
 }

+ 11 - 8
TEAMModelOS.SDK/Models/Service/BI/BILogAnalyseService.cs

@@ -72,7 +72,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
 
                 RecCnt saveCnts = new();
 
-                List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.clientIp, api = s.properties.requestUri.Split("?").ToList().Count() > 1 ? s.properties.requestUri.Split("?").ToList()[0] : s.properties.requestUri, hostName = s.properties.hostname }).ToList();
+                List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.CIp, api = s.properties.CsUriStem.Split("?").ToList().Count() > 1 ? s.properties.CsUriStem.Split("?").ToList()[0] : s.properties.CsUriStem, hostName = s.properties.CsHost }).ToList();
 
                 List<RecApiCnt> apiCnt = recInfo.GroupBy(a => a.api).Select(g => new RecApiCnt { api = g.Key, count = g.Count(), hour = cHour, hostName = g.Select(h => h.hostName).Distinct().ToList(), ip = g.Select(i => i.ip).Distinct().ToList() }).ToList();
                 saveCnts.apiCnt = apiCnt;
@@ -115,7 +115,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
 
             try 
             {
-                var blobClient = _azureStorage.GetBlobContainerClient($"insights-logs-applicationgatewayfirewalllog", name: connectName);
+                var blobClient = _azureStorage.GetBlobContainerClient($"insights-logs-appservicehttplogs", name: connectName);
                 await foreach (BlobItem blobItem in blobClient.GetBlobsAsync(BlobTraits.None, BlobStates.None, path))
                 {
                     StringBuilder visits = new("[");
@@ -145,12 +145,15 @@ namespace TEAMModelOS.SDK.Models.Service.BI
                     List<AGInfo> tempsert = new List<AGInfo>();
                     List<AGInfo> aGInfos = new List<AGInfo>();
 
-                    tempAinfos.ForEach(item =>
+                    tempAinfos.FindAll(x=>x.properties.CsMethod.Equals("POST"))?.ForEach(item =>
                     {
-                        string requestUri = item.properties.requestUri;
-                        var isType = StaticValue.suffixName.Where(k => requestUri.Contains(k)).ToList();
-                        if (isType.Count == 0)
-                            aGInfos.Add(item);
+                        string requestUri = item.properties.CsUriStem;
+                        if (!string.IsNullOrWhiteSpace(requestUri)) {
+                            var isType = StaticValue.suffixName.Where(k => requestUri.Contains(k)).ToList();
+                            if (isType.Count == 0)
+                                aGInfos.Add(item);
+                        }
+                        
                     });
 
                     //foreach (var item in tempAinfos)
@@ -172,7 +175,7 @@ namespace TEAMModelOS.SDK.Models.Service.BI
 
                     RecCnt saveCnts = new();
 
-                    List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.clientIp, api = s.properties.requestUri.Split("?").ToList().Count() > 1 ? s.properties.requestUri.Split("?").ToList()[0] : s.properties.requestUri, hostName = s.properties.hostname,minute = DateTimeOffset.Parse(s.time).ToString("mm")}).ToList();
+                    List<RecAppGWInfo> recInfo = aGInfos.Select(s => new RecAppGWInfo { hour = cHour, ip = s.properties.CIp, api = s.properties.CsUriStem.Split("?").ToList().Count() > 1 ? s.properties.CsUriStem.Split("?").ToList()[0] : s.properties.CsUriStem, hostName = s.properties.CsHost,minute = DateTimeOffset.Parse(s.time).ToString("mm")}).ToList();
 
                     if (timeType.Equals("Hour"))
                     {

+ 111 - 2
TEAMModelOS/Controllers/XTest/BillController.cs

@@ -24,6 +24,7 @@ using System.Text;
 using System.Text.Json;
 using System.Text.RegularExpressions;
 using System.Threading.Tasks;
+using System.Web;
 using TEAMModelOS.Filter;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
@@ -32,6 +33,7 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Helper.Security.ShaHash;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.School;
+using TEAMModelOS.SDK.Models.Service.BI;
 
 namespace TEAMModelOS.Controllers.XTest
 {
@@ -42,16 +44,123 @@ namespace TEAMModelOS.Controllers.XTest
     [ApiController]
     public class BillController : ControllerBase
     {
-
+        private readonly DingDing _dingDing;
         private readonly IHttpClientFactory _httpClient;
         private readonly IConfiguration _configuration;
         private readonly AzureStorageFactory _azureStorage;
-        public BillController(IHttpClientFactory httpClient, IConfiguration configuration, AzureStorageFactory azureStorage) 
+        private readonly IPSearcher _ipSearcher;
+        private readonly Option _option;
+        public BillController(IHttpClientFactory httpClient, IConfiguration configuration, AzureStorageFactory azureStorage,    IPSearcher searcher, DingDing  dingDing, IOptionsSnapshot<Option> option) 
         {
             _httpClient = httpClient;
             _configuration = configuration;
             _azureStorage = azureStorage;
+            _ipSearcher = searcher;
+            _dingDing = dingDing;
+            _option = option.Value;
+        }
+        [HttpGet("data")]
+        [RequestSizeLimit(102_400_000_00)] //最大10000m左右
+        public async Task<IActionResult> data(JsonElement j1son) {
+            try
+            {
+                string location = _option.Location;
+                var datetime = DateTimeOffset.UtcNow.AddHours(-1);
+                var y = datetime.Year;
+                var m = datetime.Month >= 10 ? $"{datetime.Month}" : $"0{datetime.Month}";
+                var d = datetime.Day >= 10 ? $"{datetime.Day}" : $"0{datetime.Day}";
+                var h = datetime.Hour >= 10 ? $"{datetime.Hour}" : $"0{datetime.Hour}";
+#if DEBUG
+                if (location.Equals("China-Dep"))
+#else
+                if (location.Equals("China"))
+#endif
+
+                {
+                    //string path = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.NETWORK/APPLICATIONGATEWAYS/OSFIREWARE/y={y}/m={m}/d={d}/h={h}/m=00/PT1H.json";
+                    string path = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.WEB/SITES/TEAMMODELOS/y={y}/m={m}/d={d}/h={h}/m=00/PT1H.json";
+                    var retn = await BILogAnalyseService.GetPathAnalyse(_azureStorage, _ipSearcher, _dingDing, path, "LogStorage");
+                    if (retn.recCnts.IsNotEmpty())
+                    {
+                        //https://teammodelos.blob.core.chinacloudapi.cn/0-public/pie-borderRadius.html
+                        string publishUrl = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={HttpUtility.UrlEncode(retn.saveUrls.First(), Encoding.UTF8)}&time={HttpUtility.UrlEncode(datetime.AddHours(8).ToString("yyyy年MM月dd日 HH时"), Encoding.UTF8)}";
+                        string ulrs = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={retn.saveUrls.First()}&time={datetime.AddHours(8).ToString("yyyy年MM月dd日 HH时")}";
+                        string ulr = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(ulrs, Encoding.UTF8)}&delay=5000";
+                        string image = "";
+                        try
+                        {
+                            string strs = await _httpClient.CreateClient().GetStringAsync(ulr);
+                            if (!string.IsNullOrWhiteSpace(strs))
+                            {
+                                JsonElement json = strs.ToObject<JsonElement>();
+                                json.TryGetProperty("url", out JsonElement base64);
+                                using (MemoryStream ms = new MemoryStream(Convert.FromBase64String($"{base64}")))
+                                {
+                                    image = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(ms, $"visitCnt/{y}{m}{d}", $"{y}{m}{d}{h}.png", false);
+                                }
+
+                            }
+                        }
+                        catch (Exception ex)
+                        {
+
+                        }
+                        await _dingDing.SendBotMarkdown("防火墙日志记录", $"#### 防火墙日志记录(小时)\n> 记录时间:{datetime.AddHours(8).ToString("yyyy-MM-dd HH")}\n> ![screenshot]({image})\n> ###### 发布时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}" +
+                            $" [发布地址]({publishUrl}) \n", GroupNames.醍摩豆服務運維群組);
+                    }
+
+                    //处理昨天的防火墙日志
+                    if (h.Equals("00"))
+                    {
+                        var pastTime = datetime.AddHours(-1);
+                        var ptY = pastTime.Year;
+                        var ptM = pastTime.Month >= 10 ? $"{pastTime.Month}" : $"0{pastTime.Month}";
+                        var ptD = pastTime.Day >= 10 ? $"{pastTime.Day}" : $"0{pastTime.Day}";
+
+                        string dayPath = $"resourceId=/SUBSCRIPTIONS/73B7F9EF-D8B7-4444-9E8D-D80B43BF3CD4/RESOURCEGROUPS/TEAMMODELCHENGDU/PROVIDERS/MICROSOFT.WEB/SITES/TEAMMODELOS/y={ptY}/m={ptM}/d={ptD}";
+                        var retnDay = await BILogAnalyseService.GetPathAnalyse(_azureStorage, _ipSearcher, _dingDing, dayPath, "LogStorage", timeType: "Day");
+
+                        if (retn.recCnts.IsNotEmpty())
+                        {
+                            //一天的统计
+                            string dayPublishUrl = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={HttpUtility.UrlEncode(retnDay.saveUrls.First(), Encoding.UTF8)}&time={HttpUtility.UrlEncode(pastTime.ToString("yyyy年MM月dd日"), Encoding.UTF8)}";
+                            string dayUrls = $"https://teammodelos.blob.core.chinacloudapi.cn/0-public/api-count.html?url={retnDay.saveUrls.First()}&time={pastTime.ToString("yyyy年MM月dd日")}";
+                            string dayUrl = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(dayUrls, Encoding.UTF8)}&delay=6000";
+                            string dayImage = "";
+
+                            try
+                            {
+                                string dayStr = await _httpClient.CreateClient().GetStringAsync(dayUrl);
+                                if (!string.IsNullOrWhiteSpace(dayStr))
+                                {
+                                    JsonElement dayJson = dayStr.ToObject<JsonElement>();
+                                    dayJson.TryGetProperty("url", out JsonElement dayBase64);
+                                    using (MemoryStream dayMs = new(Convert.FromBase64String($"{dayBase64}")))
+                                    {
+                                        dayImage = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(dayMs, $"visitCnt/{ptY}{ptM}{ptD}", "days.png", false);
+                                    }
+                                }
+                            }
+                            catch (Exception ex) { }
+                            await _dingDing.SendBotMarkdown("防火墙日志记录", $"#### 防火墙日志记录(天)\n> 记录时间:{pastTime.AddHours(8).ToString("yyyy-MM-dd")}\n> ![screenshot]({dayImage})\n> ###### 发布时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}" +
+                            $" [发布地址]({dayPublishUrl}) \n", GroupNames.醍摩豆服務運維群組);
+                        }
+                    }
+                }
+                else if (location.Contains("Global"))
+                {
+
+                }
+            }
+            catch (Exception ex)
+            {
+                // await _dingDing.SendBotMsg($"FireWallFileLog 防火墙日志记录: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}\n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
+            }
+
+            return Ok();
         }
+
+
         [HttpPost("report")]
         [RequestSizeLimit(102_400_000_00)] //最大10000m左右
         public async Task<IActionResult> Report(JsonElement json)

+ 1 - 0
TEAMModelOS/Startup.cs

@@ -128,6 +128,7 @@ namespace TEAMModelOS
             services.AddAzureServiceBus(Configuration.GetValue<string>("Azure:ServiceBus:ConnectionString"));
             services.AddAzureSignalR(Configuration.GetValue<string>("Azure:SignalR:ConnectionString"));
             services.AddSnowflakeId(Convert.ToInt64(Configuration.GetValue<string>("Option:LocationNum")), 1);
+            services.AddAzureStorage("DefaultEndpointsProtocol=https;AccountName=teammodellog;AccountKey=lxVDrgs+6rKtmASL3k1WrarrEd5Rk42wS1Mu5+sqQlPya1JLSlFDtnZUvMPeHHe7zlESfn/1NY7CZdGviy2UCw==;EndpointSuffix=core.chinacloudapi.cn", "LogStorage");
             services.AddWeChatPay();
 
             services.AddHttpClient();