CrazyIter_Bin 4 lat temu
rodzic
commit
75cc4128bb

+ 17 - 8
TEAMModelFunction/MonitorServicesBus.cs

@@ -6,6 +6,7 @@ using Azure.Cosmos;
 using Microsoft.Azure.WebJobs;
 using Microsoft.Azure.WebJobs;
 using Microsoft.Azure.WebJobs.Host;
 using Microsoft.Azure.WebJobs.Host;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
+using StackExchange.Redis;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models;
@@ -146,14 +147,22 @@ namespace TEAMModelFunction
         }
         }
         [FunctionName("Blob")]
         [FunctionName("Blob")]
         public async Task Blob([ServiceBusTrigger("active-task", "blob", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
         public async Task Blob([ServiceBusTrigger("active-task", "blob", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
-            await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{msg}更新大小:",
-                                    GroupNames.醍摩豆服務運維群組);
-            var jsonMsg = JsonDocument.Parse(msg);
-            jsonMsg.RootElement.TryGetProperty("code", out JsonElement name);
-            var client = _azureStorage.GetBlobContainerClient($"{name}");
-            var size = await client.GetBlobsSize();
-            await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name.GetString(), size);
-            await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{name}更新大小:{size}", GroupNames.醍摩豆服務運維群組);
+            try
+            {
+                await _dingDing.SendBotMsg($"ServiceBus,Blob(){msg}", GroupNames.醍摩豆服務運維群組);
+                var jsonMsg = JsonDocument.Parse(msg);
+                jsonMsg.RootElement.TryGetProperty("code", out JsonElement name);
+                var client = _azureStorage.GetBlobContainerClient($"{name}");
+                var size = await client.GetBlobsSize();
+                await _dingDing.SendBotMsg($"ServiceBus,Blob() 容器:{name}更新大小:{size}",
+                         GroupNames.醍摩豆服務運維群組);
+                await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record",new RedisValue($"{name}"),new RedisValue($"{long.Parse($"{size}")}"));
+
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"ServiceBus,Blob()\n{ex.Message}{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
+            }
         }
         }
     }
     }
 }
 }

+ 1 - 1
TEAMModelFunction/local.settings.json

@@ -5,7 +5,7 @@
     "Azure:Starage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn",
     "Azure:Starage:ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelstorage;AccountKey=Yq7D4dE6cFuer2d2UZIccTA/i0c3sJ/6ITc8tNOyW+K5f+/lWw9GCos3Mxhj47PyWQgDL8YbVD63B9XcGtrMxQ==;EndpointSuffix=core.chinacloudapi.cn",
     "Azure:ServiceBus:ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
     "Azure:ServiceBus:ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
     "Azure:Cosmos:ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
     "Azure:Cosmos:ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;",
-    "Azure:Redis:ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False",
+    "Azure:Redis:ConnectionString": "teammodel.redis.cache.chinacloudapi.cn:6380,password=9wcTVDiAWiAf0IF5NOjZBvYrZe9JlbEw1E3F1QFcNbo=,ssl=True,abortConnect=False",
     "FUNCTIONS_WORKER_RUNTIME": "dotnet",
     "FUNCTIONS_WORKER_RUNTIME": "dotnet",
     "ScanModel": "TEAMModelOS",
     "ScanModel": "TEAMModelOS",
     "Database": "TEAMModelOS"
     "Database": "TEAMModelOS"

+ 1 - 0
TEAMModelOS/TEAMModelOS.csproj

@@ -51,6 +51,7 @@
   <ItemGroup>
   <ItemGroup>
     <Folder Include="JwtRsaFile\" />
     <Folder Include="JwtRsaFile\" />
     <Folder Include="Services\Evaluation\" />
     <Folder Include="Services\Evaluation\" />
+    <Folder Include="wwwroot\" />
   </ItemGroup>
   </ItemGroup>
   
   
   <ItemGroup>
   <ItemGroup>

+ 1 - 1
TEAMModelOS/appsettings.Development.json

@@ -31,7 +31,7 @@
       "ScanModel": [ "TEAMModelOS" ]
       "ScanModel": [ "TEAMModelOS" ]
     },
     },
     "Redis": {
     "Redis": {
-      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True"
+      "ConnectionString": "teammodel.redis.cache.chinacloudapi.cn:6380,password=9wcTVDiAWiAf0IF5NOjZBvYrZe9JlbEw1E3F1QFcNbo=,ssl=True,abortConnect=False"
       //"ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False,defaultDatabase=8,writeBuffer=10240,poolsize=50"
       //"ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False,defaultDatabase=8,writeBuffer=10240,poolsize=50"
     },
     },
     "ServiceBus": {
     "ServiceBus": {

+ 1 - 1
TEAMModelOS/appsettings.json

@@ -30,7 +30,7 @@
       "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"     
       "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"     
     },
     },
     "Redis": {
     "Redis": {
-      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
+      "ConnectionString": "teammodel.redis.cache.chinacloudapi.cn:6380,password=9wcTVDiAWiAf0IF5NOjZBvYrZe9JlbEw1E3F1QFcNbo=,ssl=True,abortConnect=False"
     },
     },
     "ServiceBus": {
     "ServiceBus": {
       "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
       "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",