CrazyIter_Bin 3 years ago
parent
commit
0c186d7d80

+ 2 - 2
TEAMModeBI/TEAMModeBI.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <RootNamespace>TEAMModeBI</RootNamespace>
   </PropertyGroup>
 
@@ -12,7 +12,7 @@
 
   <ItemGroup>
    
-    <PackageReference Include="VueCliMiddleware" Version="5.0.0" />
+    <PackageReference Include="VueCliMiddleware" Version="6.0.0" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
TEAMModelAPI/TEAMModelAPI.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>

+ 0 - 16
TEAMModelFunction/AServiceBus.cs

@@ -1,16 +0,0 @@
-using System;
-using Microsoft.Azure.WebJobs;
-using Microsoft.Azure.WebJobs.Host;
-using Microsoft.Extensions.Logging;
-
-namespace TEAMModelFunction
-{
-    public static class AServiceBus
-    {
-        [FunctionName("AServiceBus")]
-        public static void Run([ServiceBusTrigger("mytopic", "mysubscription", Connection = "")]string mySbMsg, ILogger log)
-        {
-            log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
-        }
-    }
-}

+ 1 - 1
TEAMModelFunction/ActivityHttpTrigger.cs

@@ -46,7 +46,7 @@ namespace TEAMModelFunction
         /// <param name="log"></param>
         /// <returns></returns>
         [FunctionName("fix-stu-course")]
-        public async Task<IActionResult> StuCourse([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
+        public  async Task<IActionResult> StuCourse([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req, ILogger log)
         {
             log.LogInformation("fix-stu-course...");
             string originCode = await new StreamReader(req.Body).ReadToEndAsync();

+ 26 - 13
TEAMModelFunction/MonitorCosmosDB.cs

@@ -35,15 +35,28 @@ namespace TEAMModelFunction
             _azureRedis = azureRedis;
             _configuration = configuration;
         }
+        //[FunctionName("Common")]
+        //public async Task Common([Microsoft.Azure.Functions.Worker.CosmosDBTriggerAttribute(
+        //    databaseName: "TEAMModelOS",
+        //    containerName: "Common",
+        //    Connection =    "Azure:Cosmos:ConnectionString",
+        //    LeaseContainerName = "leases",
+        //    LeaseContainerPrefix = "TEAMModelOS",
+        //    CreateLeaseContainerIfNotExists =true)]string josn, ILogger log)
+        //{
+        //    IReadOnlyList<Document> inputs = new List<Document>();
+
 
         [FunctionName("Common")]
-        public async Task Common([CosmosDBTrigger(
-            databaseName: "TEAMModelOS",
-            collectionName: "Common",
-            ConnectionStringSetting = "Azure:Cosmos:ConnectionString",
-            LeaseCollectionName = "leases",
-            LeaseCollectionPrefix = "TEAMModelOS")]IReadOnlyList<Document> inputs, ILogger log)
+        public async Task Common([Microsoft.Azure.WebJobs.CosmosDBTriggerAttribute(
+                databaseName: "TEAMModelOS",
+                collectionName: "Common",
+                ConnectionStringSetting  =    "Azure:Cosmos:ConnectionString",
+                LeaseCollectionName = "leases",
+                LeaseCollectionPrefix = "TEAMModelOS",
+                CreateLeaseCollectionIfNotExists  =true)]IReadOnlyList<Document> inputs, ILogger log)
         {
+
             if (inputs != null && inputs.Count > 0)
             {
                 log.LogInformation("Documents modified " + inputs.Count);
@@ -95,25 +108,25 @@ namespace TEAMModelFunction
                             switch (pk)
                             {
                                 case "Exam":
-                                    TriggerExam.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school);
+                                  await  TriggerExam.Trigger(_azureCosmos, _serviceBus, _azureStorage, _dingDing, client, input, code, stime, etime, school);
                                     break;
                                 case "Vote":
-                                    TriggerVote.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
+                                    await TriggerVote.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
                                     break;
                                 case "Survey":
-                                    TriggerSurvey.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
+                                    await TriggerSurvey.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
                                     break;
                                 case "Correct":
-                                    TriggerCorrect.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
+                                    await TriggerCorrect.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis);
                                     break;
                                 case "ExamLite":
-                                    TriggerExamLite.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
+                                    await TriggerExamLite.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
                                     break;
                                 case "Study":
-                                    TriggerStudy.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
+                                    await TriggerStudy.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
                                     break;
                                 case "Homework":
-                                    TriggerHomework.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
+                                    await TriggerHomework.Trigger(_serviceBus, _azureStorage, _dingDing, client, input, data, _azureRedis, _configuration);
                                     break;
 
                             }

+ 7 - 0
TEAMModelFunction/ScsApisHttpTrigger.cs

@@ -42,6 +42,13 @@ namespace TEAMModelFunction
             _azureRedis = azureRedis;
             _thirdApisService = thirdApisService;
         }
+        [FunctionName("HttpExample")]
+        public static async Task<IActionResult> Run(
+     [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req,
+     ILogger log)
+        {
+            return new OkObjectResult(new { data="1"});
+        }
         /// <summary>
         /// 数据推送接口
         /// </summary>

+ 6 - 2
TEAMModelFunction/Startup.cs

@@ -1,6 +1,7 @@
 using Microsoft.Azure.Functions.Extensions.DependencyInjection;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
 using System;
 using System.Collections.Generic;
 using System.Configuration;
@@ -15,9 +16,10 @@ using TEAMModelOS.SDK.Models.Service;
 namespace TEAMModelFunction
 {
     public class Startup : FunctionsStartup
-    { 
+    {
         public override void Configure(IFunctionsHostBuilder builder)
-        { 
+        {
+            var s = Environment.GetEnvironmentVariable("Azure:ServiceBus:ConnectionString");
             builder.Services.AddHttpClient();
             builder.Services.AddHttpClient<DingDing>();
             builder.Services.AddHttpClient<ThirdApisService>();
@@ -27,5 +29,7 @@ namespace TEAMModelFunction
             builder.Services.AddAzureCosmos(Environment.GetEnvironmentVariable("Azure:Cosmos:ConnectionString"));
             builder.Services.AddAzureRedis(Environment.GetEnvironmentVariable("Azure:Redis:ConnectionString"));
         }
+
+        
     }
 }

+ 41 - 29
TEAMModelFunction/TEAMModelFunction.csproj

@@ -1,31 +1,43 @@
 <Project Sdk="Microsoft.NET.Sdk">
-  <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
-    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
-    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
-    <Version>5.2112.21</Version>
-    <AssemblyVersion>5.2107.29.2</AssemblyVersion>
-    <FileVersion>5.2107.29.2</FileVersion>
-  </PropertyGroup>
-  <ItemGroup>
-    <Compile Remove="AServiceBus.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
-    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.9" />
-    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="4.2.1" />
-    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Update="host.json">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </None>
-    <None Update="local.settings.json">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
-    </None>
-  </ItemGroup>
+	<PropertyGroup>
+		<TargetFramework>net6.0</TargetFramework>
+		<AzureFunctionsVersion>v4</AzureFunctionsVersion>
+		<!--<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>-->
+		<Version>5.2112.21</Version>
+		<AssemblyVersion>5.2107.29.2</AssemblyVersion>
+		<FileVersion>5.2107.29.2</FileVersion>
+		<OutputType>Exe</OutputType>
+		<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
+		<SignAssembly>true</SignAssembly>
+	</PropertyGroup>
+	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+		<DefineConstants>DEBUG;TRACE</DefineConstants>
+	</PropertyGroup>
+	<ItemGroup>
+		<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
+		<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
+		<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.10" />
+		<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="5.2.0" />
+		<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.12" />
+		<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="5.0.0" />
+		<!--<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />-->
+		<!--<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" />-->
+		<!--<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
+		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.0" />
+		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.0.0-beta.6" />
+		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.0.0-preview2" />
+		<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="5.0.0" />-->
+	</ItemGroup>
+	<ItemGroup>
+		<ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+	</ItemGroup>
+	<ItemGroup>
+		<None Update="host.json">
+			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+		</None>
+		<None Update="local.settings.json">
+			<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+			<CopyToPublishDirectory>Never</CopyToPublishDirectory>
+		</None>
+	</ItemGroup>
 </Project>

+ 1 - 1
TEAMModelFunction/TriggerCorrect.cs

@@ -19,7 +19,7 @@ namespace TEAMModelFunction
 {
     public static class TriggerCorrect
     {
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
            CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis)
         {
             if ((tdata.status != null && tdata.status.Value == 404) || tdata.ttl > 0)

+ 1 - 1
TEAMModelFunction/TriggerExam.cs

@@ -20,7 +20,7 @@ namespace TEAMModelFunction
 {
     public class TriggerExam
     {
-        public static async void Trigger(AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureCosmosFactory _azureCosmos, AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
             CosmosClient client, Document input, string code, long stime, long etime, string school)
         {
 

+ 1 - 1
TEAMModelFunction/TriggerExamLite.cs

@@ -18,7 +18,7 @@ namespace TEAMModelFunction
 {
     public static class TriggerExamLite
     {
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
                     CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
         {
             try

+ 1 - 1
TEAMModelFunction/TriggerHomework.cs

@@ -19,7 +19,7 @@ namespace TEAMModelFunction
 {
     public static class TriggerHomework
     {
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
                     CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
         {
             try

+ 1 - 1
TEAMModelFunction/TriggerStudy.cs

@@ -18,7 +18,7 @@ namespace TEAMModelFunction
 {
     public static class TriggerStudy
     {
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
                     CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
         {
             try

+ 1 - 1
TEAMModelFunction/TriggerSurvey.cs

@@ -26,7 +26,7 @@ namespace TEAMModelFunction
 {
     public class TriggerSurvey
     {
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
                CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
         {
             try

+ 1 - 1
TEAMModelFunction/TriggerVote.cs

@@ -23,7 +23,7 @@ namespace TEAMModelFunction
     public static class TriggerVote
     {
 
-        public static async void Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
+        public static async Task Trigger(AzureServiceBusFactory _serviceBus, AzureStorageFactory _azureStorage, DingDing _dingDing,
             CosmosClient client, Document input, TriggerData tdata, AzureRedisFactory _azureRedis, IConfiguration _configuration)
         {
             try

+ 1 - 0
TEAMModelFunction/host.json

@@ -9,6 +9,7 @@
       "isEnabled": "true"
     },
     "applicationInsights": {
+      "samplingExcludedTypes": "Request",
       "samplingSettings": {
         "isEnabled": true,
         "ExcludedTypes": "Request"

+ 1 - 2
TEAMModelFunction/local.settings.json

@@ -18,6 +18,5 @@
     "HaBookAuth:CoreService:sendnotification": "https://api2.teammodel.net/service/sendnotification",
     "HaBookAuth:CoreService:clientID": "c7317f88-7cea-4e48-ac57-a16071f7b884",
     "HaBookAuth:CoreService:clientSecret": "kguxh:V.PLmxBdaI@jnrTrDSth]A3346"
-
-  }  
+  }
 }

+ 6 - 6
TEAMModelGrpc/TEAMModelGrpc.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <UserSecretsId>eb0da4a0-e9b5-417f-944d-d7a30dbd2cf5</UserSecretsId>
     <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
   </PropertyGroup>
@@ -29,14 +29,14 @@
   </ItemGroup>
 
   <ItemGroup>
-    <PackageReference Include="Grpc.AspNetCore" Version="2.35.0" />
-    <PackageReference Include="Grpc.HealthCheck" Version="2.36.1" />
-    <PackageReference Include="Grpc.Tools" Version="2.36.1">
+    <PackageReference Include="Grpc.AspNetCore" Version="2.41.0" />
+    <PackageReference Include="Grpc.HealthCheck" Version="2.43.0" />
+    <PackageReference Include="Grpc.Tools" Version="2.43.0">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-    <PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
-    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.8" />
+    <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
+    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.14.0" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />

+ 18 - 18
TEAMModelOS.SDK/TEAMModelOS.SDK.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
     <Version>3.0.1223</Version>
     <AssemblyVersion>3.0.1223.0</AssemblyVersion>
     <FileVersion>3.0.1223.0</FileVersion>
@@ -15,29 +15,29 @@
     <PackageReference Include="HTEXLib" Version="5.2111.41" />
     <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.2.0" />
     <PackageReference Include="Azure.Cosmos" Version="4.0.0-preview3" />
-    <PackageReference Include="Azure.Identity" Version="1.4.0" />
-    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.1.1" />
-    <PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.1.0" />
-    <PackageReference Include="Azure.Storage.Blobs.Batch" Version="12.6.0" />
-    <PackageReference Include="Azure.Storage.Queues" Version="12.6.1" />
+    <PackageReference Include="Azure.Identity" Version="1.5.0" />
+    <PackageReference Include="Azure.Messaging.ServiceBus" Version="7.5.1" />
+    <PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.2.0" />
+    <PackageReference Include="Azure.Storage.Blobs.Batch" Version="12.7.0" />
+    <PackageReference Include="Azure.Storage.Queues" Version="12.8.0" />
     <PackageReference Include="ClouDASLibx" Version="1.2.7" />
-    <PackageReference Include="DocumentFormat.OpenXml" Version="2.13.1" />
-    <PackageReference Include="HtmlAgilityPack" Version="1.11.32" />
-    <PackageReference Include="Lib.AspNetCore.ServerSentEvents" Version="6.0.0" />
-    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.10" />
+    <PackageReference Include="DocumentFormat.OpenXml" Version="2.15.0" />
+    <PackageReference Include="HtmlAgilityPack" Version="1.11.39" />
+    <PackageReference Include="Lib.AspNetCore.ServerSentEvents" Version="7.0.0" />
+    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.1" />
     <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
-    <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.4" />
-    <PackageReference Include="Microsoft.Identity.Client" Version="4.32.1" />
-    <PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
+    <PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="6.0.1" />
+    <PackageReference Include="Microsoft.Identity.Client" Version="4.39.0" />
+    <PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
     <PackageReference Include="NUnit" Version="3.13.2" />
     <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
-    <PackageReference Include="StackExchange.Redis" Version="2.2.4" />
-    <PackageReference Include="SvgNet" Version="2.1.1" />
-    <PackageReference Include="System.Drawing.Common" Version="5.0.2" />
+    <PackageReference Include="StackExchange.Redis" Version="2.2.88" />
+    <PackageReference Include="SvgNet" Version="2.2.2" />
+    <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
     <PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="2.0.0-preview" />
-    <PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
+    <PackageReference Include="System.Net.Http.Json" Version="6.0.0" />
     <PackageReference Include="NPinyin.Core" Version="3.0.0" />
-    <PackageReference Include="VueCliMiddleware" Version="5.0.0" />
+    <PackageReference Include="VueCliMiddleware" Version="6.0.0" />
 
   </ItemGroup>
 </Project>

+ 6 - 0
TEAMModelOS.sln

@@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModelAPI", "TEAMModelAP
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TEAMModeBI", "TEAMModeBI\TEAMModeBI.csproj", "{13572BD5-5F97-419A-A3A3-12E0358192E4}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TEAMModelOSFunction", "TEAMModelOSFunction\TEAMModelOSFunction.csproj", "{A8BDFC58-A484-42F4-A7C8-F51BEDC08C20}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -45,6 +47,10 @@ Global
 		{13572BD5-5F97-419A-A3A3-12E0358192E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{13572BD5-5F97-419A-A3A3-12E0358192E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{13572BD5-5F97-419A-A3A3-12E0358192E4}.Release|Any CPU.Build.0 = Release|Any CPU
+		{A8BDFC58-A484-42F4-A7C8-F51BEDC08C20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{A8BDFC58-A484-42F4-A7C8-F51BEDC08C20}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{A8BDFC58-A484-42F4-A7C8-F51BEDC08C20}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{A8BDFC58-A484-42F4-A7C8-F51BEDC08C20}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 113 - 0
TEAMModelOS/Properties/ServiceDependencies/teammodelos6 - Web Deploy/profile.arm.json

@@ -0,0 +1,113 @@
+{
+  "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
+  "contentVersion": "1.0.0.0",
+  "metadata": {
+    "_dependencyType": "compute.appService.windows"
+  },
+  "parameters": {
+    "resourceGroupName": {
+      "type": "string",
+      "defaultValue": "TEAMModelChengdu",
+      "metadata": {
+        "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
+      }
+    },
+    "resourceGroupLocation": {
+      "type": "string",
+      "defaultValue": "",
+      "metadata": {
+        "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
+      }
+    },
+    "resourceName": {
+      "type": "string",
+      "defaultValue": "teammodelos6",
+      "metadata": {
+        "description": "Name of the main resource to be created by this template."
+      }
+    },
+    "resourceLocation": {
+      "type": "string",
+      "defaultValue": "[parameters('resourceGroupLocation')]",
+      "metadata": {
+        "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
+      }
+    }
+  },
+  "variables": {
+    "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+    "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]"
+  },
+  "resources": [
+    {
+      "type": "Microsoft.Resources/resourceGroups",
+      "name": "[parameters('resourceGroupName')]",
+      "location": "[parameters('resourceGroupLocation')]",
+      "apiVersion": "2019-10-01"
+    },
+    {
+      "type": "Microsoft.Resources/deployments",
+      "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+      "resourceGroup": "[parameters('resourceGroupName')]",
+      "apiVersion": "2019-10-01",
+      "dependsOn": [
+        "[parameters('resourceGroupName')]"
+      ],
+      "properties": {
+        "mode": "Incremental",
+        "template": {
+          "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+          "contentVersion": "1.0.0.0",
+          "resources": [
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[parameters('resourceName')]",
+              "type": "Microsoft.Web/sites",
+              "apiVersion": "2015-08-01",
+              "tags": {
+                "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
+              },
+              "dependsOn": [
+                "[variables('appServicePlan_ResourceId')]"
+              ],
+              "kind": "app",
+              "properties": {
+                "name": "[parameters('resourceName')]",
+                "kind": "app",
+                "httpsOnly": true,
+                "reserved": false,
+                "serverFarmId": "[variables('appServicePlan_ResourceId')]",
+                "siteConfig": {
+                  "metadata": [
+                    {
+                      "name": "CURRENT_STACK",
+                      "value": "dotnetcore"
+                    }
+                  ]
+                }
+              },
+              "identity": {
+                "type": "SystemAssigned"
+              }
+            },
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[variables('appServicePlan_name')]",
+              "type": "Microsoft.Web/serverFarms",
+              "apiVersion": "2015-08-01",
+              "sku": {
+                "name": "S1",
+                "tier": "Standard",
+                "family": "S",
+                "size": "S1"
+              },
+              "properties": {
+                "name": "[variables('appServicePlan_name')]"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ]
+}

+ 5 - 6
TEAMModelOS/TEAMModelOS.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>net5.0</TargetFramework>
+    <TargetFramework>net6.0</TargetFramework>
   </PropertyGroup>
 
   <ItemGroup>
@@ -11,13 +11,12 @@
     <None Remove="Services\Evaluation\**" />
   </ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Caching.CSRedis" Version="3.6.50" />
+    <PackageReference Include="Caching.CSRedis" Version="3.6.80" />
     <PackageReference Include="CHTCHSConv" Version="1.0.0" />
-    <PackageReference Include="CSRedisCore" Version="3.6.5" />
-    <PackageReference Include="DotNetZip" Version="1.15.0" />
+    <PackageReference Include="CSRedisCore" Version="3.6.8" />
+    <PackageReference Include="DotNetZip" Version="1.16.0" />
     <PackageReference Include="HTEXLib" Version="5.2111.41" />
-   
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
 	  <PackageReference Include="PinYinConverterCore" Version="1.0.2" />
   </ItemGroup>
   <ItemGroup>

+ 264 - 0
TEAMModelOSFunction/.gitignore

@@ -0,0 +1,264 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# Azure Functions localsettings file
+local.settings.json
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc

+ 28 - 0
TEAMModelOSFunction/Function1.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Documents;
+using Microsoft.Azure.WebJobs;
+using Microsoft.Azure.WebJobs.Host;
+using Microsoft.Extensions.Logging;
+
+namespace TEAMModelOSFunction
+{
+    public static class Function1
+    {
+        [FunctionName("Function1")]
+        public static void Run([CosmosDBTrigger(
+            databaseName: "TEAMModelOS",
+            collectionName: "Teacher",
+            ConnectionStringSetting = "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;",
+            LeaseCollectionName = "leases")]
+            IReadOnlyList<Document> input,
+            ILogger log)
+        {
+            if (input != null && input.Count > 0)
+            {
+                log.LogInformation("Documents modified " + input.Count);
+                log.LogInformation("First document Id " + input[0].Id);
+            }
+        }
+    }
+}

+ 51 - 0
TEAMModelOSFunction/Program.cs

@@ -0,0 +1,51 @@
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TEAMModelOS.SDK;
+using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Models.Service;
+
+namespace TEAMModelFunction
+{
+    public class Program
+    {
+        static async Task Main(string[] args)
+        {
+            // #if DEBUG
+            //          Debugger.Launch();
+            // #endif
+            //<docsnippet_startup>
+            var host = new HostBuilder()
+                //<docsnippet_configure_defaults>
+                .ConfigureFunctionsWorkerDefaults()
+                //</docsnippet_configure_defaults>
+                //<docsnippet_dependency_injection>
+                .ConfigureServices(Services =>
+                {
+                    var s = Environment.GetEnvironmentVariable("Azure:ServiceBus:ConnectionString");
+                   // Services.AddSingleton<IHttpResponderService, DefaultHttpResponderService>();
+                    Services.AddHttpClient();
+                    Services.AddHttpClient<DingDing>();
+                    Services.AddHttpClient<ThirdApisService>();
+                    Services.AddHttpClient<NotificationService>();
+                    Services.AddAzureServiceBus(Environment.GetEnvironmentVariable("Azure:ServiceBus:ConnectionString"));
+                    Services.AddAzureStorage(Environment.GetEnvironmentVariable("Azure:Storage:ConnectionString"));
+                    Services.AddAzureCosmos(Environment.GetEnvironmentVariable("Azure:Cosmos:ConnectionString"));
+                    Services.AddAzureRedis(Environment.GetEnvironmentVariable("Azure:Redis:ConnectionString"));
+
+                    //s.AddSingleton<IHttpResponderService, DefaultHttpResponderService>();
+                })
+                //</docsnippet_dependency_injection>
+                .Build();
+            //</docsnippet_startup>
+
+            //<docsnippet_host_run>
+            await host.RunAsync();
+            //</docsnippet_host_run>
+        }
+    }
+}

+ 11 - 0
TEAMModelOSFunction/Properties/serviceDependencies.json

@@ -0,0 +1,11 @@
+{
+  "dependencies": {
+    "appInsights1": {
+      "type": "appInsights.sdk"
+    },
+    "storage1": {
+      "type": "storage",
+      "connectionId": "AzureWebJobsStorage"
+    }
+  }
+}

+ 11 - 0
TEAMModelOSFunction/Properties/serviceDependencies.local.json

@@ -0,0 +1,11 @@
+{
+  "dependencies": {
+    "appInsights1": {
+      "type": "appInsights.sdk"
+    },
+    "storage1": {
+      "type": "storage.emulator",
+      "connectionId": "AzureWebJobsStorage"
+    }
+  }
+}

+ 37 - 0
TEAMModelOSFunction/TEAMModelOSFunction.csproj

@@ -0,0 +1,37 @@
+<Project Sdk="Microsoft.NET.Sdk">
+	<PropertyGroup>
+		<IsPackable>false</IsPackable>
+		<TargetFramework>net6.0</TargetFramework>
+		<LangVersion>preview</LangVersion>
+		<AzureFunctionsVersion>v4</AzureFunctionsVersion>
+		<OutputType>Exe</OutputType>
+		<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
+		<SignAssembly>true</SignAssembly>
+		<!--<AssemblyOriginatorKeyFile>..\..\key.snk</AssemblyOriginatorKeyFile>-->
+	</PropertyGroup>
+	<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
+		<DefineConstants>DEBUG;TRACE</DefineConstants>
+	</PropertyGroup>
+  <ItemGroup>
+        <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.CosmosDB" Version="3.0.10" />
+        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="5.0.0" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.0.0-beta.6" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.0.0-preview2" />
+	  <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="5.0.0" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\TEAMModelOS.SDK\TEAMModelOS.SDK.csproj" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Update="host.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Update="local.settings.json">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
+    </None>
+  </ItemGroup>
+</Project>

+ 11 - 0
TEAMModelOSFunction/host.json

@@ -0,0 +1,11 @@
+{
+    "version": "2.0",
+    "logging": {
+        "applicationInsights": {
+            "samplingSettings": {
+                "isEnabled": true,
+                "excludedTypes": "Request"
+            }
+        }
+    }
+}