|
@@ -237,27 +237,20 @@ namespace TEAMModelOS.Filter
|
|
|
if (!string.IsNullOrWhiteSpace(XAuthSchool))
|
|
|
{
|
|
|
//访问次数记录 开始
|
|
|
- long udate = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
- var respon = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
- if (respon.Status == 200)
|
|
|
- {
|
|
|
- BizVisitCnt bizVisit = JsonDocument.Parse(respon.Content).Deserialize<BizVisitCnt>();
|
|
|
- bizVisit.visit += 1;
|
|
|
- //var tempApi = bizVisit.apis.Find(f => f.name.Equals($"{path}"));
|
|
|
- //if (tempApi != null)
|
|
|
- //{
|
|
|
- // tempApi.visit += 1;
|
|
|
- // tempApi.upDate = udate;
|
|
|
- //}
|
|
|
- //else
|
|
|
- bizVisit.apis.Add(new APIInfo() { name = $"{path}", upDate = udate });//记录加一下
|
|
|
- var resBiz = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").ReplaceItemAsync<BizVisitCnt>(bizVisit, id, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- BizVisitCnt bizVisit = new() { id = id, visit = 1, apis = new List<APIInfo>() { new APIInfo() { name = $"{path}", upDate = udate } } };
|
|
|
- var resBiz = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").CreateItemAsync<BizVisitCnt>(bizVisit, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
- }
|
|
|
+ //long udate = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
+ //var respon = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
+ //if (respon.Status == 200)
|
|
|
+ //{
|
|
|
+ // BizVisitCnt bizVisit = JsonDocument.Parse(respon.Content).Deserialize<BizVisitCnt>();
|
|
|
+ // bizVisit.visit += 1;
|
|
|
+ // bizVisit.apis.Add(new APIInfo() { name = $"{path}", upDate = udate });
|
|
|
+ // var resBiz = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").ReplaceItemAsync<BizVisitCnt>(bizVisit, id, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // BizVisitCnt bizVisit = new() { id = id, visit = 1, apis = new List<APIInfo>() { new APIInfo() { name = $"{path}", upDate = udate } } };
|
|
|
+ // var resBiz = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").CreateItemAsync<BizVisitCnt>(bizVisit, new Azure.Cosmos.PartitionKey("BizVisit")).Result;
|
|
|
+ //}
|
|
|
//访问次数记录 结束
|
|
|
|
|
|
var response = _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Normal").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey("BizConfig")).Result;
|