|
@@ -1,5 +1,6 @@
|
|
|
using Azure.Storage.Blobs;
|
|
|
using Azure.Storage.Blobs.Models;
|
|
|
+using Azure.Storage.Blobs.Specialized;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.IO;
|
|
@@ -126,7 +127,27 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
}
|
|
|
|
|
|
string input = visits.ToString();
|
|
|
- List<AGInfo> aGInfos = input.ToObject<List<AGInfo>>();
|
|
|
+ List<AGInfo> tempAinfos = input.ToObject<List<AGInfo>>();
|
|
|
+
|
|
|
+ List<AGInfo> tempsert = new List<AGInfo>();
|
|
|
+ List<AGInfo> aGInfos = new List<AGInfo>();
|
|
|
+
|
|
|
+ tempAinfos.ForEach(item =>
|
|
|
+ {
|
|
|
+ string requestUri = item.properties.requestUri;
|
|
|
+ var isType = StaticValue.suffixName.Where(k => requestUri.Contains(k)).ToList();
|
|
|
+ if (isType.Count == 0)
|
|
|
+ aGInfos.Add(item);
|
|
|
+ });
|
|
|
+
|
|
|
+ //foreach (var item in tempAinfos)
|
|
|
+ //{
|
|
|
+ // string requestUri = item.properties.requestUri;
|
|
|
+ // var isType = type.Where(k => requestUri.Contains(k)).ToList();
|
|
|
+ // if (isType.Count == 0)
|
|
|
+ // aGInfos.Add(item);
|
|
|
+ //}
|
|
|
+
|
|
|
DateTimeOffset dtime = DateTimeOffset.UtcNow;
|
|
|
string cHour = dtime.ToString("yyyyMMddHH");
|
|
|
string cDay = dtime.ToString("yyyyMMdd");
|
|
@@ -147,16 +168,31 @@ namespace TEAMModelOS.SDK.Models.Service.BI
|
|
|
saveCnts.ipCnt = ipCnt;
|
|
|
recCnts.Add(saveCnts);
|
|
|
|
|
|
- ////保存存至Blob文件
|
|
|
+ //保存存至Blob文件
|
|
|
var url = await _azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(saveCnts.ToJsonString(), $"visitCnt/{cDay}", $"{cHour}.json");
|
|
|
|
|
|
urls.Add(url);
|
|
|
}
|
|
|
- } catch (Exception ex) {
|
|
|
|
|
|
- }
|
|
|
+ var azureClient = _azureStorage.GetBlobContainerClient("0-public");//获取容器连接地址
|
|
|
+ int expireTime = int.Parse(DateTimeOffset.UtcNow.AddDays(-180).ToString("yyyyMMdd"));
|
|
|
+ await foreach (var blobItem in azureClient.GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix: "visitCnt"))
|
|
|
+ {
|
|
|
+ string[] sub_name = blobItem.Name.Split('/');
|
|
|
+ if (sub_name.Length > 2)
|
|
|
+ {
|
|
|
+ if (int.Parse(sub_name[1]) <= expireTime)
|
|
|
+ {
|
|
|
+ await azureClient.GetBlobBaseClient(blobItem.Name).DeleteIfExistsAsync();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception ex) { }
|
|
|
|
|
|
return (recCnts, urls);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|