Browse Source

精熟系統請求URL及認證key修正

jeff 1 year ago
parent
commit
64ff6595f1
1 changed files with 23 additions and 8 deletions
  1. 23 8
      TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

+ 23 - 8
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -1648,17 +1648,32 @@ namespace TEAMModelOS.FunctionV4
                     //string connect = _configuration.GetValue<string>("HaBookAuth:Crtmabank") + "https://malearnfunction.chinacloudsites.cn/api/crtmabank";
                     //string connect = _configuration.GetValue<string>("HaBookAuth:Crtmabank") + "https://malearnfunction.chinacloudsites.cn/api/crtmabank";
                     string location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
                     string location = $"{Environment.GetEnvironmentVariable("Option:Location")}";
                     string urlAction = string.Empty;
                     string urlAction = string.Empty;
-                    if (location.Contains("China") || location.Contains("China-Dep") || location.Contains("China-Test"))
+                    string accessKey = string.Empty;
+                    if (location.Contains("China"))
                     {
                     {
-                        urlAction = "https://malearnfunction.chinacloudsites.cn";
+                        if(location.Equals("China")) //大陸正式站
+                        {
+                            urlAction = "https://malearn.teammodel.cn";
+                            accessKey = "QUzQqbqbnLsTDTeaJy4Br6wUuqPoAlKpzRK2S6PGImRHAzFuySGAeA==";
+                        }
+                        else if(location.Equals("China-Dep") || location.Equals("China-Test")) //大陸測試站
+                        {
+                            urlAction = "https://malearn-rc.teammodel.cn";
+                            accessKey = "hESc0g7Q60FTEss4ZnVXPB61S1a8WlAXIq5ULl3T3oTxAzFunpLDwA==";
+                        }                        
                     }
                     }
                     else if (location.Contains("Global"))
                     else if (location.Contains("Global"))
                     {
                     {
-                        urlAction = "https://malearnfunction.azurewebsites.net";
-                    }
-                    else if (location.Contains("Global-Test"))
-                    {
-                        urlAction = "https://malearn-test.azurewebsites.net";
+                        if(location.Equals("Global")) //國際正式站
+                        {
+                            urlAction = "https://malearn.teammodel.net";
+                            accessKey = "I-2lTcdggJkZWSBwOXQIm4oHx-huwX3d0wLe-9pgojThAzFuq_KNFg==";
+                        }
+                        else if(location.Equals("Global-Test")) //國際測試站
+                        {
+                            urlAction = "https://malearn-rc.teammodel.net";
+                            accessKey = "_l4Cb_tHIRBw_iv3ZuwVqjkMwjg4_HtDaxhAmZ8OwJraAzFu_DAY8A==";
+                        }
                     }
                     }
                     string connect = $"{urlAction}/api/crtmabank";
                     string connect = $"{urlAction}/api/crtmabank";
                     var htc = _httpClient.CreateClient();
                     var htc = _httpClient.CreateClient();
@@ -1666,7 +1681,7 @@ namespace TEAMModelOS.FunctionV4
                     {
                     {
                         htc.DefaultRequestHeaders.Remove("x-functions-key");
                         htc.DefaultRequestHeaders.Remove("x-functions-key");
                     }
                     }
-                    htc.DefaultRequestHeaders.Add("x-functions-key", "QUzQqbqbnLsTDTeaJy4Br6wUuqPoAlKpzRK2S6PGImRHAzFuySGAeA==");
+                    htc.DefaultRequestHeaders.Add("x-functions-key", accessKey);
                     string paramJson = JsonConvert.SerializeObject(errors);
                     string paramJson = JsonConvert.SerializeObject(errors);
                     var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
                     var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
                     await htc.PostAsync(connect, content);
                     await htc.PostAsync(connect, content);