Преглед изворни кода

Merge branch 'develop-rc' into develop

CrazyIter_Bin пре 2 година
родитељ
комит
ec77b58182

+ 1 - 1
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageBlobExtensions.cs

@@ -159,7 +159,7 @@ namespace TEAMModelOS.SDK.DI
             if (!prefixs.IsNotEmpty()) return false;
             try
             {
-                BlobContainerClient bcc = client.GetBlobContainerClient(blobContainerName);
+                BlobContainerClient bcc = client.GetBlobContainerClient(blobContainerName.ToLower());
                 BlobBatchClient bbc = client.GetBlobBatchClient();
                 List<Uri> blobs = new List<Uri>();
                 List<Task<Azure.Response<bool>>> list = new List<Task<Response<bool>>>();

+ 9 - 9
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageFactory.cs

@@ -54,7 +54,7 @@ namespace TEAMModelOS.SDK.DI
             try
             {
                 var options = _optionsMonitor.Get(name);
-                return new BlobContainerClient(options.StorageAccountConnectionString, containerName);
+                return new BlobContainerClient(options.StorageAccountConnectionString, containerName.ToLower());
             }
             catch (OptionsValidationException e)
             {
@@ -97,7 +97,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     StartsOn = DateTimeOffset.UtcNow.Subtract(new TimeSpan(0, 15, 0)),
                     ExpiresOn = DateTimeOffset.UtcNow.Add(new TimeSpan(36135, 0, 0, 0)),
-                    BlobContainerName = containerName
+                    BlobContainerName = containerName.ToLower()
                 };
 
                 blobSasBuilder.SetPermissions(blobContainerSasPermissions);
@@ -107,7 +107,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     Scheme = "https",
                     Host = $"{accountname}.blob.{endpoint}",
-                    Path = containerName
+                    Path = containerName.ToLower()
                     //Query = sasQueryParameters.ToString()
                 };
 
@@ -138,7 +138,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     StartsOn = DateTimeOffset.UtcNow.Subtract(new TimeSpan(0, 15, 0)),
                     ExpiresOn = DateTimeOffset.UtcNow.Add(new TimeSpan(1, 0, 15, 0)),
-                    BlobContainerName = containerName
+                    BlobContainerName = containerName.ToLower()
                 };
 
                 blobSasBuilder.SetPermissions(blobContainerSasPermissions);
@@ -148,7 +148,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     Scheme = "https",
                     Host = $"{accountname}.blob.{endpoint}",
-                    Path = containerName
+                    Path = containerName.ToLower()
                     //Query = sasQueryParameters.ToString()
                 };
 
@@ -242,7 +242,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     StartsOn = DateTimeOffset.UtcNow.Subtract(new TimeSpan(0, 15, 0)),
                     ExpiresOn = DateTimeOffset.UtcNow.Add(new TimeSpan(1, 0, 15, 0)),
-                    BlobContainerName = containerName,
+                    BlobContainerName = containerName.ToLower(),
                     BlobName = blobName
                 };
 
@@ -253,7 +253,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     Scheme = "https",
                     Host = $"{accountname}.blob.{endpoint}",
-                    Path = $"{containerName}/{blobName}",
+                    Path = $"{containerName.ToLower()}/{blobName}",
                     Query = sasQueryParameters.ToString()
                 };
 
@@ -288,7 +288,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     StartsOn = DateTimeOffset.UtcNow.Subtract(new TimeSpan(0, 15, 0)),
                     ExpiresOn = dateTime,
-                    BlobContainerName = containerName,
+                    BlobContainerName = containerName.ToLower(),
                     BlobName = blobName
                 };
 
@@ -299,7 +299,7 @@ namespace TEAMModelOS.SDK.DI
                 {
                     Scheme = "https",
                     Host = $"{accountname}.blob.{endpoint}",
-                    Path = $"{containerName}/{blobName}",
+                    Path = $"{containerName.ToLower()}/{blobName}",
                     Query = sasQueryParameters.ToString()
                 };
                 return new BlobAuth { url = fullUri.Uri.ToString(), sas = sasQueryParameters.ToString(), timeout = time };

+ 0 - 2
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageFactoryOptions.cs

@@ -9,6 +9,4 @@ namespace TEAMModelOS.SDK.DI
         public string Name { get; set; }
         public string StorageAccountConnectionString { get; set; }
     }
-
-   
 }

+ 7 - 0
TEAMModelOS/Controllers/School/SchoolTeacherController.cs

@@ -47,6 +47,8 @@ namespace TEAMModelOS.Controllers
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment;
         private readonly DingDing _dingDing;
+
+        
         public SchoolTeacherController(IWebHostEnvironment  environment,DingDing dingDing, CoreAPIHttpService coreAPIHttpService, AzureServiceBusFactory azureServiceBus, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IConfiguration configuration, NotificationService notificationService)
         {
             _dingDing = dingDing;
@@ -474,6 +476,7 @@ namespace TEAMModelOS.Controllers
         {
             try
             {
+
                 var client = _azureCosmos.GetCosmosClient();
                 //參數取得
                 if (!request.TryGetProperty("school_code", out JsonElement school_code)) return BadRequest();
@@ -517,6 +520,7 @@ namespace TEAMModelOS.Controllers
                 foreach (var id in ids)
                 {
                     SchoolTeacher st = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(id, new PartitionKey($"Teacher-{school_code}"));
+                    Teacher teacher = await client.GetContainer(Constant.TEAMModelOS, Constant.Teacher).ReadItemAsync<Teacher>(id, new PartitionKey($"Base"));
                     if (permission.IsNotEmpty())
                     {
                         st.permissions = permission;
@@ -537,6 +541,9 @@ namespace TEAMModelOS.Controllers
                     if (_pmClean.ValueKind.Equals(JsonValueKind.True)) {
                         st.permissions = new List<string>();
                     }
+
+                    _coreAPIHttpService.PushNotify(new List<IdNameCode> { new IdNameCode { id = teacher.id, name = teacher.name, code = teacher.lang } }, "expire-private_lessonRecord", Constant.NotifyType_IES5_Course,
+                                                                 new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.name }, }, $"{Environment.GetEnvironmentVariable("Option:Location")}", _configuration, _dingDing, "");
                     await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(st, id, new PartitionKey($"Teacher-{school_code}"));
                     schoolTeachers.Add(st);
                 }