فهرست منبع

Merge branch 'develop' into PL/develop-BI

Li 2 سال پیش
والد
کامیت
ab4abc850c
67فایلهای تغییر یافته به همراه2461 افزوده شده و 1954 حذف شده
  1. 4 0
      TEAMModelBI/ClientApp/src/api/index.js
  2. 3 3
      TEAMModelBI/ClientApp/src/view/index/index.vue
  3. 37 4
      TEAMModelBI/ClientApp/src/view/schoolServe/school.vue
  4. 6 5
      TEAMModelBI/Controllers/BISchool/SchoolController.cs
  5. 7 7
      TEAMModelBI/Controllers/BIServer/BiServersController.cs
  6. 1 1
      TEAMModelBI/Controllers/BISystem/CoreController.cs
  7. 0 4
      TEAMModelBI/Controllers/BITable/TableDingDingInfoController.cs
  8. 2 2
      TEAMModelBI/Controllers/BITest/Ies5TestController.cs
  9. 4 4
      TEAMModelBI/Controllers/BITest/TestController.cs
  10. 0 1
      TEAMModelBI/Controllers/LoginController.cs
  11. 0 1
      TEAMModelBI/Startup.cs
  12. 2 2
      TEAMModelOS.FunctionV4/HttpTrigger/BIHttpTrigger.cs
  13. 5 5
      TEAMModelOS.FunctionV4/HttpTrigger/IESHttpTrigger.cs
  14. 16 15
      TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs
  15. 2 1
      TEAMModelOS.FunctionV4/Program.cs
  16. 2 2
      TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs
  17. 4 4
      TEAMModelOS.FunctionV4/TimeTrigger/IESTimerTrigger.cs
  18. 31 25
      TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs
  19. 3 2
      TEAMModelOS.SDK/DI/CoreAPI/NotificationService.cs
  20. 5 4
      TEAMModelOS.SDK/DI/HttpTrigger/WebHookHttpTrigger.cs
  21. 85 59
      TEAMModelOS.SDK/DI/StudyAPI/ScsStudyApisService.cs
  22. 24 0
      TEAMModelOS.SDK/Models/Cosmos/Common/ArtMusic.cs
  23. 5 1
      TEAMModelOS.SDK/Models/Cosmos/School/SchoolTeacher.cs
  24. 1 0
      TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs
  25. 38 0
      TEAMModelOS.SDK/Models/Service/Common/TeacherService.cs
  26. 6 10
      TEAMModelOS.SDK/Models/Service/Third/ThirdApisService.cs
  27. 10 4
      TEAMModelOS.SDK/Models/Service/Third/ThirdService.cs
  28. 22 5
      TEAMModelOS/ClientApp/public/lang/en-US.js
  29. 18 1
      TEAMModelOS/ClientApp/public/lang/zh-CN.js
  30. 18 1
      TEAMModelOS/ClientApp/public/lang/zh-TW.js
  31. 9 3
      TEAMModelOS/ClientApp/src/api/notice.js
  32. BIN
      TEAMModelOS/ClientApp/src/assets/image/cus-import-cn.png
  33. BIN
      TEAMModelOS/ClientApp/src/assets/image/cus-import-en.png
  34. BIN
      TEAMModelOS/ClientApp/src/assets/image/cus-import-tw.png
  35. 15 3
      TEAMModelOS/ClientApp/src/common/BaseLayout.vue
  36. 273 273
      TEAMModelOS/ClientApp/src/common/BaseSelectSchool.vue
  37. 10 0
      TEAMModelOS/ClientApp/src/router/routes.js
  38. 10 0
      TEAMModelOS/ClientApp/src/view/Home.vue
  39. 493 483
      TEAMModelOS/ClientApp/src/view/coursemgt/ImportCus.vue
  40. 14 3
      TEAMModelOS/ClientApp/src/view/dashboard/fiveEdu/FiveEdu.vue
  41. 762 755
      TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue
  42. 199 0
      TEAMModelOS/ClientApp/src/view/log/Log.vue
  43. 5 2
      TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.less
  44. 50 4
      TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.vue
  45. 1 1
      TEAMModelOS/Controllers/Both/LessonRecordController.cs
  46. 3 3
      TEAMModelOS/Controllers/Client/AClassONEController.cs
  47. 2 3
      TEAMModelOS/Controllers/Common/CommonController.cs
  48. 1 3
      TEAMModelOS/Controllers/Normal/AbilitySubController.cs
  49. 2 2
      TEAMModelOS/Controllers/OpenApi/IRS/TianboController.cs
  50. 14 11
      TEAMModelOS/Controllers/School/SchoolController.cs
  51. 3 3
      TEAMModelOS/Controllers/System/CoreController.cs
  52. 15 4
      TEAMModelOS/Controllers/Teacher/InitController.cs
  53. 1 3
      TEAMModelOS/Controllers/Third/DingDingController.cs
  54. 1 3
      TEAMModelOS/Controllers/Third/OAuth2Controller.cs
  55. 31 31
      TEAMModelOS/Controllers/Third/Sc/ScApiController.cs
  56. 8 4
      TEAMModelOS/Controllers/Third/Sc/ScController.cs
  57. 6 7
      TEAMModelOS/Controllers/Third/Sc/ScDataInitController.cs
  58. 10 10
      TEAMModelOS/Controllers/Third/Sc/ScDataPushController.cs
  59. 3 3
      TEAMModelOS/Controllers/Third/Xkw/Sdk/XkwAPIHttpService.cs
  60. 136 136
      TEAMModelOS/Controllers/Third/Xkw/Sdk/XopHttpClient.cs
  61. 1 3
      TEAMModelOS/Controllers/Third/Xkw/XkwOAuth2Controller.cs
  62. 1 3
      TEAMModelOS/Controllers/Third/Xkw/XkwServiceController.cs
  63. 4 4
      TEAMModelOS/Controllers/XTest/FixDataController.cs
  64. 2 2
      TEAMModelOS/Controllers/XTest/FixLessonRecordController.cs
  65. 5 5
      TEAMModelOS/Controllers/XTest/TestController.cs
  66. 2 3
      TEAMModelOS/Startup.cs
  67. 8 8
      TEAMModelOS/appsettings.Development.json

+ 4 - 0
TEAMModelBI/ClientApp/src/api/index.js

@@ -207,6 +207,10 @@ export default {
     getsimpleSchool(data) {
     getsimpleSchool(data) {
         return post('/schoolcheck/get-scsimple', data)
         return post('/schoolcheck/get-scsimple', data)
     },
     },
+    //获取所有学校(所有)
+    getallSchool(data) {
+        return post('/batchschool/get-allscinfo', data)
+    },
 
 
     //首页dashboard数据接口
     //首页dashboard数据接口
     //获取各城市的学校数量(bar)
     //获取各城市的学校数量(bar)

+ 3 - 3
TEAMModelBI/ClientApp/src/view/index/index.vue

@@ -3250,12 +3250,12 @@ export default {
   background: url("../../assets/img/bg-index.jpg") no-repeat;
   background: url("../../assets/img/bg-index.jpg") no-repeat;
   background-size: 100% 100%;
   background-size: 100% 100%;
   position: relative;
   position: relative;
-  /* height: 100%; */
+  height: 100%;
 }
 }
 .statisticsbox,
 .statisticsbox,
 .statisticsbox-all {
 .statisticsbox-all {
-  width: 100%;
-  height: 100%;
+  /* width: 100%;
+  height: 100%; */
   padding: 0% 0%;
   padding: 0% 0%;
   line-height: 20px;
   line-height: 20px;
   position: relative;
   position: relative;

+ 37 - 4
TEAMModelBI/ClientApp/src/view/schoolServe/school.vue

@@ -64,7 +64,7 @@
       </div>
       </div>
     </div>
     </div>
     <div class="school-list">
     <div class="school-list">
-      <el-table :data="tableData" :ref="tablesInfo" id="tablescroll" style="width: 100%" height="72vh" v-loading="loading" element-loading-text="加载中..." empty-text="暂无数据" @selection-change="selectChange">
+      <el-table :data="tableData" :ref="tablesInfo" id="tablescroll" style="width: 100%" height="72vh" v-loading="loading" element-loading-text="加载中..." empty-text="暂无数据" @selection-change="selectChange" @sort-change="versionsSort">
         <el-table-column type="selection" width="55" v-if="PowerShow" />
         <el-table-column type="selection" width="55" v-if="PowerShow" />
         <!-- <el-table-column prop="index" :label="$t(`schoolManages.tables.serialnum`)" type="index" sortable align="center" /> -->
         <!-- <el-table-column prop="index" :label="$t(`schoolManages.tables.serialnum`)" type="index" sortable align="center" /> -->
         <el-table-column :label="$t(`schoolManages.tables.badge`)" width="150" align="center">
         <el-table-column :label="$t(`schoolManages.tables.badge`)" width="150" align="center">
@@ -79,7 +79,7 @@
                         <span>{{scope.row.period[0].name}}</span>
                         <span>{{scope.row.period[0].name}}</span>
                     </template>
                     </template>
                 </el-table-column> -->
                 </el-table-column> -->
-        <el-table-column :label="$t(`schoolManages.tables.scale`)" class="school-table-edition" sortable sort-by="scale" align="center">
+        <el-table-column :label="$t(`schoolManages.tables.scale`)" class="school-table-edition" sortable="custom" align="center">
           <template #default="scope">
           <template #default="scope">
             <!-- <el-image style="width: 80px; height: 80px" :src="imgData.basics" fit="fill" v-if="scope.row.scale === 0"></el-image>
             <!-- <el-image style="width: 80px; height: 80px" :src="imgData.basics" fit="fill" v-if="scope.row.scale === 0"></el-image>
             <el-image style="width: 80px; height: 80px" :src="imgData.standard" fit="fill" v-else-if="scope.row.scale === 500 && scope.row.hard.length === 0 && scope.row.serial.length === 0 && scope.row.service.length === 0">
             <el-image style="width: 80px; height: 80px" :src="imgData.standard" fit="fill" v-else-if="scope.row.scale === 500 && scope.row.hard.length === 0 && scope.row.serial.length === 0 && scope.row.service.length === 0">
@@ -733,7 +733,11 @@ export default {
       // })
       // })
       proxy.$api.getEveryinfo({}).then((res) => {
       proxy.$api.getEveryinfo({}).then((res) => {
         console.log(res, '顾问返回')
         console.log(res, '顾问返回')
-        res.state === 200 ? adminoptions.value.push(...res.ddUserInfos) : ''
+        if (res.state === 200) {
+          let newUser = res.ddUserInfos.filter((item) => { return item.handleRoles.length !== 0 && (item.handleRoles.includes('assist') || item.handleRoles.includes('sales')) })
+          console.log(newUser, '!!!!!')
+          adminoptions.value.push(...newUser)
+        }
       })
       })
       console.log(adminoptions.value, '目前所有顾问')
       console.log(adminoptions.value, '目前所有顾问')
     }
     }
@@ -1002,10 +1006,12 @@ export default {
         tableData.value.forEach((item) => { item.areaName = ''; areaSelect.value.data.forEach((itema) => { item.areaId === itema.id ? item.areaName = itema.name : '' }) })
         tableData.value.forEach((item) => { item.areaName = ''; areaSelect.value.data.forEach((itema) => { item.areaId === itema.id ? item.areaName = itema.name : '' }) })
         tablesccnt.value = res.scCnt
         tablesccnt.value = res.scCnt
         tableNexttoken.value = res.continuationToken
         tableNexttoken.value = res.continuationToken
+        loading.value = false
       }).catch((error) => {
       }).catch((error) => {
+        loading.value = false
         ElMessage.error('API异常,获取更多学校数据失败')
         ElMessage.error('API异常,获取更多学校数据失败')
       })
       })
-      setTimeout(function () { loading.value = false }, 800);
+      // setTimeout(function () { loading.value = false }, 800);
     }
     }
     function debounce (fn, wait) {
     function debounce (fn, wait) {
       if (timer.value !== null) {
       if (timer.value !== null) {
@@ -1062,6 +1068,32 @@ export default {
       })
       })
       // setTimeout(function () { loading.value = false }, 500);
       // setTimeout(function () { loading.value = false }, 500);
     }
     }
+    function versionsSort (val) {
+      console.log(val, '模式')
+      loading.value = true
+      let data = { province: selectValue.value.province, city: selectValue.value.city, dist: selectValue.value.dist }
+      proxy.$api.getallSchool(data).then((res) => {
+        if (res.state === 200) {
+          let major = []; let standard = []; let common = [];
+          res.schoolAssists.forEach((item) => {
+            item.scale === 0 && (item.size < 100 || item.size == 100) ? common.push(item) : ''
+            item.scale === 300 && item.size === 500 || (item.size > 100 && (!item.service.includes('YMPCVCIM') && !item.service.includes('VLY6J6N6') && !item.service.includes('VABAJ6NV'))) ? standard.push(item) : ''
+            item.service.includes('YMPCVCIM') || item.service.includes('VLY6J6N6') || item.service.includes('VABAJ6NV') ? major.push(item) : ''
+          })
+          console.log(major, '专业')
+          console.log(standard, '标准')
+          console.log(common, '普通')
+          let integrationData = []
+          val.order === 'descending' ? integrationData = ((integrationData.concat(major)).concat(standard)).concat(common) : val.order === 'ascending' ? integrationData = ((integrationData.concat(common)).concat(standard)).concat(major) : ''
+          console.log(integrationData, '最后合成')
+          tableData.value = integrationData
+          loading.value = false
+        }
+      }).catch((error) => {
+        loading.value = false
+        ElMessage.error('API异常,规模版本排序失败')
+      })
+    }
     watch(scrollHeight, (newdata, olddata) => {
     watch(scrollHeight, (newdata, olddata) => {
       if (newdata < olddata) {
       if (newdata < olddata) {
         scrollHeight.value < 0 ? debounce(datascroll, 500) : ''
         scrollHeight.value < 0 ? debounce(datascroll, 500) : ''
@@ -1140,6 +1172,7 @@ export default {
       schoolregionParams,
       schoolregionParams,
       originalNum,
       originalNum,
       nSchool,
       nSchool,
+      versionsSort
     }
     }
   },
   },
 }
 }

+ 6 - 5
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -51,9 +51,9 @@ namespace TEAMModelBI.Controllers.BISchool
         private readonly NotificationService _notificationService;
         private readonly NotificationService _notificationService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IWebHostEnvironment _environment; //读取文件
         private readonly IWebHostEnvironment _environment; //读取文件
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
 
 
-        public SchoolController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, AzureRedisFactory azureRedis, IConfiguration configuration, NotificationService notificationService, CoreAPIHttpService coreAPIHttpService, HttpClient httpClient, IWebHostEnvironment hostingEnvironment)
+        public SchoolController(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, AzureRedisFactory azureRedis, IConfiguration configuration, NotificationService notificationService, CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient, IWebHostEnvironment hostingEnvironment)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
@@ -2483,10 +2483,11 @@ namespace TEAMModelBI.Controllers.BISchool
             {
             {
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/ies5/get-school-order";
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/ies5/get-school-order";
                 string AccessToken = await getCoreAccessToken();
                 string AccessToken = await getCoreAccessToken();
-                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
+                var client = _httpClient.CreateClient();
+                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
                 string paramJson = JsonConvert.SerializeObject(new { school_code = schoolCode });
                 string paramJson = JsonConvert.SerializeObject(new { school_code = schoolCode });
                 var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
                 var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, content);
+                HttpResponseMessage responseMessage = await client.PostAsync(url, content);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
@@ -2510,7 +2511,7 @@ namespace TEAMModelBI.Controllers.BISchool
                 string ClientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
                 string ClientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
                 string Secret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                 string Secret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                 var content = new { grant_type = GrantType, client_id = ClientID, client_secret = Secret };
                 var content = new { grant_type = GrantType, client_id = ClientID, client_secret = Secret };
-                var response = await _httpClient.PostAsJsonAsync($"{Url}", content);
+                var response = await _httpClient.CreateClient().PostAsJsonAsync($"{Url}", content);
                 if (response.IsSuccessStatusCode)
                 if (response.IsSuccessStatusCode)
                 {
                 {
                     string responseBody = response.Content.ReadAsStringAsync().Result;
                     string responseBody = response.Content.ReadAsStringAsync().Result;

+ 7 - 7
TEAMModelBI/Controllers/BIServer/BiServersController.cs

@@ -37,7 +37,7 @@ namespace TEAMModelBI.Controllers.BIServer
         //读取配置信息
         //读取配置信息
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
 
 
-        private readonly IHttpClientFactory _http;
+        private readonly IHttpClientFactory httpClient;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
 
 
 
 
@@ -48,7 +48,7 @@ namespace TEAMModelBI.Controllers.BIServer
             _dingDing = dingDing;
             _dingDing = dingDing;
             _option = option?.Value;
             _option = option?.Value;
             _configuration = configuration;
             _configuration = configuration;
-            _http = http;
+            httpClient = http;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
         }
         }
 
 
@@ -91,7 +91,7 @@ namespace TEAMModelBI.Controllers.BIServer
                     return Ok(new { state = 200, coreUser });
                     return Ok(new { state = 200, coreUser });
                 else return Ok(new { state = 404, msg = "未找到改账户" });
                 else return Ok(new { state = 404, msg = "未找到改账户" });
 
 
-                //HttpClient httpClient = _http.CreateClient();
+                //HttpClient IHttpClientFactory = _http.CreateClient();
                 //string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
                 //string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
                 //HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync(url, jsonElment);
                 //HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync(url, jsonElment);
                 //List<userInfo> userInfos = new List<userInfo>();
                 //List<userInfo> userInfos = new List<userInfo>();
@@ -136,8 +136,8 @@ namespace TEAMModelBI.Controllers.BIServer
                 if (!jsonElement.TryGetProperty("HasUser", out JsonElement HasUser)) return BadRequest();
                 if (!jsonElement.TryGetProperty("HasUser", out JsonElement HasUser)) return BadRequest();
 
 
                 string smsurl = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
                 string smsurl = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
-                HttpClient httpClient = _http.CreateClient();
-                HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync($"{smsurl}/service/sandsms/pin", jsonElement);
+                 
+                HttpResponseMessage responseMessage = await httpClient.CreateClient().PostAsJsonAsync($"{smsurl}/service/sandsms/pin", jsonElement);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string str_json = await responseMessage.Content.ReadAsStringAsync();
                     string str_json = await responseMessage.Content.ReadAsStringAsync();
@@ -176,9 +176,9 @@ namespace TEAMModelBI.Controllers.BIServer
                 if (!jsonElement.TryGetProperty("Authorization_Pin", out JsonElement sms)) return BadRequest();
                 if (!jsonElement.TryGetProperty("Authorization_Pin", out JsonElement sms)) return BadRequest();
 
 
                 string smsurl = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
                 string smsurl = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
-                HttpClient httpClient = _http.CreateClient();
+      
                 var temp_job = new { Authorization_Pin = sms };
                 var temp_job = new { Authorization_Pin = sms };
-                HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync($"{smsurl}/service/verifiy/pin", temp_job);
+                HttpResponseMessage responseMessage = await httpClient.CreateClient().PostAsJsonAsync($"{smsurl}/service/verifiy/pin", temp_job);
 
 
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {

+ 1 - 1
TEAMModelBI/Controllers/BISystem/CoreController.cs

@@ -28,7 +28,7 @@ namespace TEAMModelBI.Controllers.BISystem
         private readonly Option _option;
         private readonly Option _option;
 
 
 
 
-        public CoreController(AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IPSearcher searcher, HttpClient httpClient)
+        public CoreController(AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IPSearcher searcher, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;

+ 0 - 4
TEAMModelBI/Controllers/BITable/TableDingDingInfoController.cs

@@ -90,8 +90,6 @@ namespace TEAMModelBI.Controllers.BITable
 
 
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
 
 
-                //HttpClient httpClient = _http.CreateClient();
-                //string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
 
 
                 //获取access_token
                 //获取access_token
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
@@ -916,8 +914,6 @@ namespace TEAMModelBI.Controllers.BITable
 
 
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
                 var (_tmdId, _tmdName, pic, did, dname, dpic) = HttpJwtAnalysis.JwtXAuthBI(HttpContext.GetXAuth("AuthToken"), _option);
 
 
-                //HttpClient httpClient = _http.CreateClient();
-                //string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
 
 
                 //获取access_token
                 //获取access_token
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
                 IDingTalkClient tokenClient = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");

+ 2 - 2
TEAMModelBI/Controllers/BITest/Ies5TestController.cs

@@ -37,9 +37,9 @@ namespace TEAMModelBI.Controllers.BITest
         //读取配置文件
         //读取配置文件
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
 
 
-        public Ies5TestController(AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IWebHostEnvironment hostingEnvironment, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, HttpClient httpClient)
+        public Ies5TestController(AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, DingDing dingDing, AzureStorageFactory azureStorage, IOptionsSnapshot<Option> option, IWebHostEnvironment hostingEnvironment, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;

+ 4 - 4
TEAMModelBI/Controllers/BITest/TestController.cs

@@ -71,9 +71,9 @@ namespace TEAMModelBI.Controllers.BITest
         //读取配置文件
         //读取配置文件
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private IPSearcher _ipSearcher;
         private IPSearcher _ipSearcher;
-        public TestController(IPSearcher ipSearcher, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IWebHostEnvironment hostingEnvironment, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, HttpClient httpClient)
+        public TestController(IPSearcher ipSearcher, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IWebHostEnvironment hostingEnvironment, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
@@ -1387,7 +1387,7 @@ namespace TEAMModelBI.Controllers.BITest
 
 
                 try
                 try
                 {
                 {
-                    string strs = await _httpClient.GetStringAsync(ulr);
+                    string strs = await _httpClient.CreateClient().GetStringAsync(ulr);
                     if (!string.IsNullOrWhiteSpace(strs))
                     if (!string.IsNullOrWhiteSpace(strs))
                     {
                     {
                         JsonElement json = strs.ToObject<JsonElement>();
                         JsonElement json = strs.ToObject<JsonElement>();
@@ -1422,7 +1422,7 @@ namespace TEAMModelBI.Controllers.BITest
                     string dayUrl = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(dayUrls, Encoding.UTF8)}&delay=6000";
                     string dayUrl = $"http://cdhabook.teammodel.cn:8805/screen/screenshot-png?width=1920&height=1450&url={HttpUtility.UrlEncode(dayUrls, Encoding.UTF8)}&delay=6000";
                     string dayImage = "";
                     string dayImage = "";
 
 
-                    string dayStr = await _httpClient.GetStringAsync(dayUrl);
+                    string dayStr = await _httpClient.CreateClient().GetStringAsync(dayUrl);
                     if (!string.IsNullOrWhiteSpace(dayStr))
                     if (!string.IsNullOrWhiteSpace(dayStr))
                     {
                     {
                         JsonElement dayJson = dayStr.ToObject<JsonElement>();
                         JsonElement dayJson = dayStr.ToObject<JsonElement>();

+ 0 - 1
TEAMModelBI/Controllers/LoginController.cs

@@ -355,7 +355,6 @@ namespace TEAMModelBI.Controllers
                 //    Website = BIConst.Global;
                 //    Website = BIConst.Global;
                 //}
                 //}
 
 
-                HttpClient httpClient = _http.CreateClient();
                 var table = _azureStorage.GetCloudTableClient().GetTableReference("BIDDUserInfo");
                 var table = _azureStorage.GetCloudTableClient().GetTableReference("BIDDUserInfo");
                 var tempUser = await table.FindListByDict<DingDingUserInfo>(new Dictionary<string, object> { { "PartitionKey", $"{partitionKey}" }, { "userId", $"{userId}" } });
                 var tempUser = await table.FindListByDict<DingDingUserInfo>(new Dictionary<string, object> { { "PartitionKey", $"{partitionKey}" }, { "userId", $"{userId}" } });
 
 

+ 0 - 1
TEAMModelBI/Startup.cs

@@ -129,7 +129,6 @@ namespace TEAMModelBI
             services.AddHttpClient<DingDing>(); 
             services.AddHttpClient<DingDing>(); 
             services.AddHttpClient<NotificationService>();
             services.AddHttpClient<NotificationService>();
             services.AddCoreAPIHttpService(Configuration);
             services.AddCoreAPIHttpService(Configuration);
-            services.AddHttpClient<CoreAPIHttpService>();
             services.AddHttpClient<HttpTrigger>();
             services.AddHttpClient<HttpTrigger>();
             services.AddMemoryCache();
             services.AddMemoryCache();
             services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = false; });
             services.AddControllers().AddJsonOptions(options => { options.JsonSerializerOptions.IgnoreNullValues = false; });

+ 2 - 2
TEAMModelOS.FunctionV4/HttpTrigger/BIHttpTrigger.cs

@@ -25,9 +25,9 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
 
 
-        public BIHttpTrigger(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, HttpClient httpClient)
+        public BIHttpTrigger(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;

+ 5 - 5
TEAMModelOS.FunctionV4/HttpTrigger/IESHttpTrigger.cs

@@ -37,9 +37,9 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         public IESHttpTrigger(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage
         public IESHttpTrigger(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage
-      , AzureRedisFactory azureRedis, HttpClient httpClient)
+      , AzureRedisFactory azureRedis, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
@@ -916,7 +916,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                     };
                     };
                     var st = screenshot.ToJsonString();
                     var st = screenshot.ToJsonString();
                     await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
                     await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
-                    var httpResponse = await _httpClient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
+                    var httpResponse = await _httpClient.CreateClient().PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
                        screenshot
                        screenshot
                     );
                     );
                    
                    
@@ -944,7 +944,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                         };
                         };
                         var st = screenshot.ToJsonString();
                         var st = screenshot.ToJsonString();
                         //  await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
                         //  await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
-                        var httpResponse = await _httpClient.PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
+                        var httpResponse = await _httpClient.CreateClient().PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
                            screenshot
                            screenshot
                         );
                         );
                         if (httpResponse.StatusCode == HttpStatusCode.OK)
                         if (httpResponse.StatusCode == HttpStatusCode.OK)
@@ -1000,7 +1000,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             public int pagesize { get; set; } = 5;
             public int pagesize { get; set; } = 5;
             public string? root { get; set; }
             public string? root { get; set; }
             public string? env { get; set; } = "release";
             public string? env { get; set; } = "release";
-            public string msgId { get; set; }
+            public string? msgId { get; set; }
         }
         }
     }
     }
 }
 }

+ 16 - 15
TEAMModelOS.FunctionV4/HttpTrigger/ScsYxptApis.cs

@@ -7,6 +7,7 @@ using System.Collections.Generic;
 using System.IO;
 using System.IO;
 using System.Linq;
 using System.Linq;
 using System.Net;
 using System.Net;
+using System.Net.Http;
 using System.Text;
 using System.Text;
 using System.Text.Json;
 using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -23,17 +24,17 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
-        private readonly ThirdApisService _thirdApisService;
+        private readonly IHttpClientFactory _httpClient;
         public static string Code { get; set; }
         public static string Code { get; set; }
         public static Dictionary<string, object> parameterMap = null;
         public static Dictionary<string, object> parameterMap = null;
-        public ScsYxptApis(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, ThirdApisService thirdApisService
+        public ScsYxptApis(IHttpClientFactory httpClient,AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage 
            , AzureRedisFactory azureRedis)
            , AzureRedisFactory azureRedis)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
-            _thirdApisService = thirdApisService;
+            _httpClient= httpClient;
         }
         }
         /// <summary>
         /// <summary>
         /// 5.3.1.1获取项目列表
         /// 5.3.1.1获取项目列表
@@ -60,7 +61,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient, config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     projects = result.content.ToObject<List<ScProject>>();
                     projects = result.content.ToObject<List<ScProject>>();
@@ -104,7 +105,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     projects = result.content.ToObject<List<ScProject>>();
                     projects = result.content.ToObject<List<ScProject>>();
@@ -156,7 +157,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表" };
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
                                 List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
@@ -214,7 +215,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.2获取学员名单" };
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.2获取学员名单" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScTeacher> teachers = result.content.ToObject<List<ScTeacher>>();
                                 List<ScTeacher> teachers = result.content.ToObject<List<ScTeacher>>();
@@ -275,7 +276,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             parameterMap["SchoolID"] = $"{schoolCode}";
                             parameterMap["SchoolID"] = $"{schoolCode}";
                             parameterMap["School"] = $"{schoolCode}";
                             parameterMap["School"] = $"{schoolCode}";
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.20获取学校设置的可选能力点" };
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.20获取学校设置的可选能力点" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
@@ -364,7 +365,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.19获取项目设置的可选能力点" };
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.19获取项目设置的可选能力点" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
@@ -440,7 +441,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     List<ScDiagnosis> diagnoses = result.content.ToObject<List<ScDiagnosis>>();
                     List<ScDiagnosis> diagnoses = result.content.ToObject<List<ScDiagnosis>>();
@@ -511,7 +512,7 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
             {
             {
                 ///{“result”:true,”reason”:null,”content”:”{“PXID”:””,”TID”:””,”TeacherName”:””,”ProjectTitle”:””,”ProjectItemTitle”:””,”CityName”:””,
                 ///{“result”:true,”reason”:null,”content”:”{“PXID”:””,”TID”:””,”TeacherName”:””,”ProjectTitle”:””,”ProjectItemTitle”:””,”CityName”:””,
                 ///”DisName”:””,”SchoolName”:””,”Sex”:””,”PXXK”:””,”PXXD”:””,”TeacherXK”:””,”TeacherXD”:””,”Email”:””}”,”pagecount”:1}
                 ///”DisName”:””,”SchoolName”:””,”Sex”:””,”PXXK”:””,”PXXD”:””,”TeacherXK”:””,”TeacherXD”:””,”Email”:””}”,”pagecount”:1}
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     teacher = result.content;
                     teacher = result.content;
@@ -835,19 +836,19 @@ namespace TEAMModelOS.FunctionV4.HttpTrigger
                     }
                     }
                 }
                 }
                 //推送数据
                 //推送数据
-                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
+                UpdateTeacherListSituation = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
 
 
-                UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
+                UpdateTeacherListDiagnosis = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
                 UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
 
 
-                UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
+                UploadKTSLList = await ThirdApisService.Post(_httpClient,config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
                 UploadKTSLList.bizcode = "UploadKTSLList";
                 UploadKTSLList.bizcode = "UploadKTSLList";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
 
 
-                UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
+                UploadSBTARPDFListV2 = await ThirdApisService.Post(_httpClient,config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
                 UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                 results.Add(UpdateTeacherListSituation);
                 results.Add(UpdateTeacherListSituation);

+ 2 - 1
TEAMModelOS.FunctionV4/Program.cs

@@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
 using System.Text;
 using System.Text;
 using System.Text.Json;
 using System.Text.Json;
 using System.Text.RegularExpressions;
 using System.Text.RegularExpressions;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.Models;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK;
@@ -47,7 +48,6 @@ namespace TEAMModelOS.FunctionV4
                //services.Configure<Option>(options => context. Configuration.GetSection("Option").Bind(options));
                //services.Configure<Option>(options => context. Configuration.GetSection("Option").Bind(options));
                services.AddHttpClient();
                services.AddHttpClient();
                services.AddHttpClient<DingDing>();
                services.AddHttpClient<DingDing>();
-               services.AddHttpClient<ThirdApisService>();
                services.AddHttpClient<NotificationService>();
                services.AddHttpClient<NotificationService>();
                services.AddCoreAPIHttpService(context.Configuration);
                services.AddCoreAPIHttpService(context.Configuration);
                services.AddAzureCosmos(context.Configuration.GetSection("Azure:Cosmos:ConnectionString").Get<string>());
                services.AddAzureCosmos(context.Configuration.GetSection("Azure:Cosmos:ConnectionString").Get<string>());
@@ -67,6 +67,7 @@ namespace TEAMModelOS.FunctionV4
                services.AddIPSearcher("");
                services.AddIPSearcher("");
            })
            })
            .Build();
            .Build();
+            ThreadPool.SetMinThreads(200, 200);
             await host.RunAsync();
             await host.RunAsync();
         }
         }
     }
     }

+ 2 - 2
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -62,11 +62,11 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly IConverter _converter;
         private readonly IConverter _converter;
         private readonly SnowflakeId _snowflakeId;
         private readonly SnowflakeId _snowflakeId;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         public ActiveTaskTopic(SnowflakeId snowflakeId, IConverter converter, CoreAPIHttpService coreAPIHttpService,
         public ActiveTaskTopic(SnowflakeId snowflakeId, IConverter converter, CoreAPIHttpService coreAPIHttpService,
             AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis,
             AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis,
             AzureServiceBusFactory serviceBus, IOptionsSnapshot<Option> option,
             AzureServiceBusFactory serviceBus, IOptionsSnapshot<Option> option,
-            NotificationService notificationService, IConfiguration configuration, HttpClient httpClient)
+            NotificationService notificationService, IConfiguration configuration, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;

+ 4 - 4
TEAMModelOS.FunctionV4/TimeTrigger/IESTimerTrigger.cs

@@ -42,9 +42,9 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly IConverter _converter;
         private readonly IConverter _converter;
         private readonly SnowflakeId _snowflakeId;
         private readonly SnowflakeId _snowflakeId;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private IPSearcher _ipSearcher;
         private IPSearcher _ipSearcher;
-        public IESTimerTrigger(IPSearcher ipSearcher,HttpClient httpClient,SnowflakeId snowflakeId,IConverter converter, AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis)
+        public IESTimerTrigger(IPSearcher ipSearcher, IHttpClientFactory httpClient,SnowflakeId snowflakeId,IConverter converter, AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
@@ -93,7 +93,7 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
                         string image = "";
                         string image = "";
                         try
                         try
                         {
                         {
-                            string strs = await _httpClient.GetStringAsync(ulr);
+                            string strs = await _httpClient.CreateClient().GetStringAsync(ulr);
                             if (!string.IsNullOrWhiteSpace(strs)) {
                             if (!string.IsNullOrWhiteSpace(strs)) {
                                 JsonElement json = strs.ToObject<JsonElement>();
                                 JsonElement json = strs.ToObject<JsonElement>();
                                 json.TryGetProperty("url", out JsonElement base64);
                                 json.TryGetProperty("url", out JsonElement base64);
@@ -131,7 +131,7 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
 
 
                             try
                             try
                             {
                             {
-                                string dayStr = await _httpClient.GetStringAsync(dayUrl);
+                                string dayStr = await _httpClient.CreateClient().GetStringAsync(dayUrl);
                                 if (!string.IsNullOrWhiteSpace(dayStr)) 
                                 if (!string.IsNullOrWhiteSpace(dayStr)) 
                                 {
                                 {
                                     JsonElement dayJson = dayStr.ToObject<JsonElement>();
                                     JsonElement dayJson = dayStr.ToObject<JsonElement>();

+ 31 - 25
TEAMModelOS.SDK/DI/CoreAPI/CoreAPIHttpService.cs

@@ -34,7 +34,7 @@ namespace TEAMModelOS.SDK
             string url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
             string url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
             var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
             var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
             var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
             var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-            services.AddHttpClient<CoreAPIHttpService>();
+            services.AddSingleton<CoreAPIHttpService>();
             services.Configure<CoreAPIHttpServiceOptions>(name  , o => { o.location = location;o.url =url;o.clientID = clientID; o.clientSecret = clientSecret; });
             services.Configure<CoreAPIHttpServiceOptions>(name  , o => { o.location = location;o.url =url;o.clientID = clientID; o.clientSecret = clientSecret; });
             return services;
             return services;
         }
         }
@@ -92,13 +92,14 @@ namespace TEAMModelOS.SDK
                 {
                 {
                     location = "Global";
                     location = "Global";
                 }
                 }
+                var client = _httpClient ;
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-                if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+                if (client.DefaultRequestHeaders.Contains("Authorization"))
                 {
                 {
-                    _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                    client.DefaultRequestHeaders.Remove("Authorization");
                 }
                 }
-                _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, data);
+                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, data);
                 if (responseMessage.Content != null)
                 if (responseMessage.Content != null)
                 {
                 {
                     string content = await responseMessage.Content.ReadAsStringAsync();
                     string content = await responseMessage.Content.ReadAsStringAsync();
@@ -231,15 +232,16 @@ namespace TEAMModelOS.SDK
                     replaceData.Add("scope", "school");
                     replaceData.Add("scope", "school");
                 }
                 }
                 else { replaceData.Add("scope", "private"); }
                 else { replaceData.Add("scope", "private"); }
+                var client = _httpClient;
                 var token = CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location).Result;
                 var token = CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location).Result;
-                if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+                if (client.DefaultRequestHeaders.Contains("Authorization"))
                 {
                 {
-                    _httpClient.DefaultRequestHeaders.Remove("Authorization");
-                    _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                    client.DefaultRequestHeaders.Remove("Authorization");
+                    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
                 }
                 }
                 else
                 else
                 {
                 {
-                    _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                    client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
                 }
                 }
                 foreach (var group in groups)
                 foreach (var group in groups)
                 {
                 {
@@ -371,14 +373,15 @@ namespace TEAMModelOS.SDK
                 {
                 {
                     location = "Global";
                     location = "Global";
                 }
                 }
+                var client = _httpClient;
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-                if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+                if (client.DefaultRequestHeaders.Contains("Authorization"))
                 {
                 {
-                    _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                    client.DefaultRequestHeaders.Remove("Authorization");
 
 
                 }
                 }
-                _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, data);
+                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, data);
                 if (responseMessage.Content != null)
                 if (responseMessage.Content != null)
                 {
                 {
                     string content = await responseMessage.Content.ReadAsStringAsync();
                     string content = await responseMessage.Content.ReadAsStringAsync();
@@ -429,14 +432,15 @@ namespace TEAMModelOS.SDK
             {
             {
                 location = "Global";
                 location = "Global";
             }
             }
+            var client = _httpClient;
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-            if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+            if (client.DefaultRequestHeaders.Contains("Authorization"))
             {
             {
-                _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                client.DefaultRequestHeaders.Remove("Authorization");
                
                
             }
             }
-            _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-            HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, data);
+            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+            HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, data);
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {
                 string content=await responseMessage.Content.ReadAsStringAsync();
                 string content=await responseMessage.Content.ReadAsStringAsync();
@@ -484,13 +488,14 @@ namespace TEAMModelOS.SDK
                 location = "Global";
                 location = "Global";
             }
             }
             url = $"{url}/oauth2/getuserinfos";
             url = $"{url}/oauth2/getuserinfos";
+            var client = _httpClient;
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-            if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+            if (client.DefaultRequestHeaders.Contains("Authorization"))
             {
             {
-                _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                client.DefaultRequestHeaders.Remove("Authorization");
             }
             }
-            _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-            HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, scontent);
+            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+            HttpResponseMessage responseMessage = await client.PostAsync(url, scontent);
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {
                 string content = await responseMessage.Content.ReadAsStringAsync();
                 string content = await responseMessage.Content.ReadAsStringAsync();
@@ -536,14 +541,15 @@ namespace TEAMModelOS.SDK
             {
             {
                 location = "Global";
                 location = "Global";
             }
             }
+            var client = _httpClient;
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
             var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-            if (_httpClient.DefaultRequestHeaders.Contains("Authorization"))
+            if (client.DefaultRequestHeaders.Contains("Authorization"))
             {
             {
-                _httpClient.DefaultRequestHeaders.Remove("Authorization");
+                client.DefaultRequestHeaders.Remove("Authorization");
 
 
             }
             }
-            _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-            HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, data);
+            client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+            HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, data);
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {
                 string content = await responseMessage.Content.ReadAsStringAsync();
                 string content = await responseMessage.Content.ReadAsStringAsync();

+ 3 - 2
TEAMModelOS.SDK/DI/CoreAPI/NotificationService.cs

@@ -28,9 +28,10 @@ namespace TEAMModelOS.SDK.DI.CoreAPI
                 {
                 {
                     location = "Global";
                     location = "Global";
                 }
                 }
+                var client = _httpClient;
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
                 var token = await CoreTokenExtensions.CreateAccessToken(clientID, clientSecret, location);
-                _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync(url, notification);
+                client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
+                HttpResponseMessage responseMessage = await client.PostAsJsonAsync(url, notification);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     return 200;
                     return 200;

+ 5 - 4
TEAMModelOS.SDK/DI/HttpTrigger/WebHookHttpTrigger.cs

@@ -33,8 +33,8 @@ namespace TEAMModelOS.SDK.DI
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
-        private readonly HttpClient _httpClient;
-        public WebHookHttpTrigger(HttpClient httpClient,AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage  , AzureRedisFactory azureRedis)
+        private readonly IHttpClientFactory _httpClient;
+        public WebHookHttpTrigger(IHttpClientFactory httpClient,AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage  , AzureRedisFactory azureRedis)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
@@ -141,8 +141,9 @@ namespace TEAMModelOS.SDK.DI
         /// <param name="notice"></param>
         /// <param name="notice"></param>
         public    async Task<HttpStatusCode> send (dynamic data,string domain, string notice) {
         public    async Task<HttpStatusCode> send (dynamic data,string domain, string notice) {
             var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             var timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-            _httpClient.Timeout=new TimeSpan(0,0,10);
-            HttpResponseMessage httpResponse =await  _httpClient.PostAsJsonAsync($"{domain}/webhook", new
+            var client = _httpClient.CreateClient();
+            client.Timeout=new TimeSpan(0,0,10);
+            HttpResponseMessage httpResponse =await client.PostAsJsonAsync($"{domain}/webhook", new
             {
             {
                 time = timestamp,
                 time = timestamp,
                 notice =notice,
                 notice =notice,

+ 85 - 59
TEAMModelOS.SDK/DI/StudyAPI/ScsStudyApisService.cs

@@ -15,60 +15,34 @@ using System.Text.Json;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models;
+using TEAMModelOS.SDK.Models.Dtos;
 
 
 namespace TEAMModelOS.SDK.DI
 namespace TEAMModelOS.SDK.DI
 {
 {
-    public static class ScsStudyApisExtensions 
-    {
-        public static IServiceCollection AddScsStudyApisService(this IServiceCollection services, IConfiguration _configuration, string name = "Default") 
-        {
-            if(services == null) throw new ArgumentNullException(nameof(services));
-            string location = _configuration.GetValue<string>("Option:Location");
-            string url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
-            var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
-            var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
-            services.AddScoped<ScsStudyApisService>();
-            return services;
-        }
-
-    }
-
-    public class ScsStudyApisServiceOptions
-    {
-        public string location { get; set; }
-        public string url { get; set; }
-        public string clientID { get; set; }
-        public string clientSecret { get; set; }
-    }
-
     public class ScsStudyApisService
     public class ScsStudyApisService
     {
     {
         private readonly AzureCosmosFactory _azureCosmos;
         private readonly AzureCosmosFactory _azureCosmos;
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
-        private readonly ThirdApisService _thirdApisService;
         public static string Code { get; set; }
         public static string Code { get; set; }
         public static Dictionary<string, object> parameterMap = null;
         public static Dictionary<string, object> parameterMap = null;
 
 
         //private readonly IWebHostEnvironment _environment;
         //private readonly IWebHostEnvironment _environment;
         public bool check = true;
         public bool check = true;
         private SnowflakeId _snowflakeId;
         private SnowflakeId _snowflakeId;
-        private readonly HttpClient _httpClient;
-        public readonly IOptionsMonitor<ScsStudyApisServiceOptions> options;
+        private readonly IHttpClientFactory _httpClient;
+      
         //private readonly IConfiguration _configuration;
         //private readonly IConfiguration _configuration;
         // private readonly DI.DingDing _dingDing;
         // private readonly DI.DingDing _dingDing;
         //public readonly Option _option;
         //public readonly Option _option;
-        public ScsStudyApisService(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, ThirdApisService thirdApisService, AzureRedisFactory azureRedis, HttpClient httpClient, IOptionsMonitor<ScsStudyApisServiceOptions> optionsMonitor, SnowflakeId snowflakeId)
+        public ScsStudyApisService(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage,   AzureRedisFactory azureRedis, IHttpClientFactory httpClient,   SnowflakeId snowflakeId)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _dingDing = dingDing;
             _dingDing = dingDing;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
-            _thirdApisService = thirdApisService;
-
             _httpClient = httpClient;
             _httpClient = httpClient;
-            options = optionsMonitor;
             //_environment = environment;
             //_environment = environment;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
             //_option = option?.Value;
             //_option = option?.Value;
@@ -102,15 +76,12 @@ namespace TEAMModelOS.SDK.DI
             ScsResult result = new() { bizcode = Code, title = "5.3.1.1获取项目列表" };
             ScsResult result = new() { bizcode = Code, title = "5.3.1.1获取项目列表" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     projects = result.content.ToObject<List<ScProject>>();
                     projects = result.content.ToObject<List<ScProject>>();
                 }
                 }
-                else
-                {
-
-                }
+                 
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
                 return (200, projects.ToJsonString());
                 return (200, projects.ToJsonString());
             }
             }
@@ -138,7 +109,7 @@ namespace TEAMModelOS.SDK.DI
             ScsResult result = new() { bizcode = Code, title = "5.3.1.1获取项目列表" };
             ScsResult result = new() { bizcode = Code, title = "5.3.1.1获取项目列表" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     projects = result.content.ToObject<List<ScProject>>();
                     projects = result.content.ToObject<List<ScProject>>();
@@ -183,7 +154,7 @@ namespace TEAMModelOS.SDK.DI
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表" };
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
                                 List<ScSchool> schools = result.content.ToObject<List<ScSchool>>();
@@ -202,9 +173,31 @@ namespace TEAMModelOS.SDK.DI
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetSchoolList\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n{areaId}\n{accessConfig}\n", GroupNames.醍摩豆服務運維群組);
-                //await response.WriteAsJsonAsync(new { data = scSchools.ToJsonString() });
-                return (500, scSchools.ToJsonString());
+                ScsProject project = null;
+                var ps = config.p.FindAll(z => z.status == 1);
+                if (ps.IsNotEmpty())
+                {
+                    project = ps[0];
+                }
+                if (project != null)
+                {
+                    var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+                    scSchools = await table.FindListByDict<ScSchool>(new Dictionary<string, object> { { "PartitionKey", "ScSchool" }, { "ProjectID", int.Parse(project.pd) }, { "ProjectItemID", int.Parse(project.pid) } });
+                    if (scSchools.IsNotEmpty())
+                    {
+                        return (200, scSchools.ToJsonString());
+                    }
+                    else
+                    {
+                        await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetSchoolList\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n{areaId}\n{accessConfig}\n", GroupNames.醍摩豆服務運維群組);
+                        return (500, scSchools.ToJsonString());
+                    }
+                }
+                else
+                {
+                    await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetSchoolList\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n{areaId}\n{accessConfig}\n", GroupNames.醍摩豆服務運維群組);
+                    return (500, scSchools.ToJsonString());
+                }
             }
             }
         }
         }
 
 
@@ -234,7 +227,7 @@ namespace TEAMModelOS.SDK.DI
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.2获取学员名单" };
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.2获取学员名单" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScTeacher> teachers = result.content.ToObject<List<ScTeacher>>();
                                 List<ScTeacher> teachers = result.content.ToObject<List<ScTeacher>>();
@@ -247,14 +240,37 @@ namespace TEAMModelOS.SDK.DI
                         }
                         }
                     }
                     }
                 }
                 }
-                //await response.WriteAsJsonAsync(new { data = scTeachers.ToJsonString() });
                 return (200, scTeachers.ToJsonString());
                 return (200, scTeachers.ToJsonString());
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetTeachersListByProject\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n{areaId}\n{accessConfig}", GroupNames.醍摩豆服務運維群組);
-                //await response.WriteAsJsonAsync(new { data = scTeachers.ToJsonString() });
-                return (500, scTeachers.ToJsonString());
+                ScsProject project = null;
+                var ps = config.p.FindAll(z => z.status == 1);
+                if (ps .IsNotEmpty())
+                {
+                    project = ps[0];
+                }
+                if (project != null)
+                {
+                    var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+                    scTeachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "ProjectID", int.Parse(project.pd) }, { "ProjectItemID", int.Parse(project.pid) } });
+                    if (scTeachers.IsNotEmpty())
+                    {
+                        return (200, scTeachers.ToJsonString());
+                    }
+                    else
+                    {
+                        await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetTeachersListByProject\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n", GroupNames.醍摩豆服務運維群組);
+                        return (500, scTeachers.ToJsonString());
+                    }
+                }
+                else 
+                {
+                    await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetTeachersListByProject\n{ex.Message}\n{ex.StackTrace}\n{results.ToJsonString()}\n", GroupNames.醍摩豆服務運維群組);
+                    return (500, scTeachers.ToJsonString());
+                }
+               
+               
             }
             }
         }
         }
 
 
@@ -287,7 +303,7 @@ namespace TEAMModelOS.SDK.DI
                             parameterMap["SchoolID"] = $"{schoolCode}";
                             parameterMap["SchoolID"] = $"{schoolCode}";
                             parameterMap["School"] = $"{schoolCode}";
                             parameterMap["School"] = $"{schoolCode}";
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.20获取学校设置的可选能力点" };
                             ScsResult result = new ScsResult { bizcode = Code, title = " 5.3.1.20获取学校设置的可选能力点" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
@@ -339,7 +355,7 @@ namespace TEAMModelOS.SDK.DI
                     }
                     }
                 }
                 }
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
-                return (500,projects.ToJsonString());
+                return (200,projects.ToJsonString());
             }
             }
         }
         }
 
 
@@ -369,7 +385,7 @@ namespace TEAMModelOS.SDK.DI
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectID"] = ps.pd;
                             parameterMap["ProjectItemID"] = ps.pid;
                             parameterMap["ProjectItemID"] = ps.pid;
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.19获取项目设置的可选能力点" };
                             ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.19获取项目设置的可选能力点" };
-                            result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                            result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                             if (result.result)
                             if (result.result)
                             {
                             {
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
                                 List<ScPDiagnosis> diagnoses = result.content.ToObject<List<ScPDiagnosis>>();
@@ -410,7 +426,7 @@ namespace TEAMModelOS.SDK.DI
                     }
                     }
                 }
                 }
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
                 //await response.WriteAsJsonAsync(new { data = projects.ToJsonString() });
-                return (500, projects.ToJsonString());
+                return (200, projects.ToJsonString());
             }
             }
         }
         }
 
 
@@ -434,7 +450,7 @@ namespace TEAMModelOS.SDK.DI
             ScsResult result = new() { bizcode = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
             ScsResult result = new() { bizcode = Code, title = "5.3.1.3通过项目编号获取学员测评能力项V2" };
             try
             try
             {
             {
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     List<ScDiagnosis> diagnoses = result.content.ToObject<List<ScDiagnosis>>();
                     List<ScDiagnosis> diagnoses = result.content.ToObject<List<ScDiagnosis>>();
@@ -468,7 +484,7 @@ namespace TEAMModelOS.SDK.DI
                     abilityNos = teacherDiagnoses[0].abilityNos.ToObject<List<string>>();
                     abilityNos = teacherDiagnoses[0].abilityNos.ToObject<List<string>>();
                 }
                 }
                 //await response.WriteAsJsonAsync(new { data = abilityNos.ToJsonString() });
                 //await response.WriteAsJsonAsync(new { data = abilityNos.ToJsonString() });
-                return (500, abilityNos.ToJsonString());
+                return (200, abilityNos.ToJsonString());
             }
             }
         }
         }
 
 
@@ -480,7 +496,7 @@ namespace TEAMModelOS.SDK.DI
         /// <param name="pxid"></param>
         /// <param name="pxid"></param>
         /// <param name="tid"></param>
         /// <param name="tid"></param>
         /// <returns></returns>
         /// <returns></returns>
-        public async Task<(int state, string json)> GetSingleTeacherByProject(string areaId, string accessConfig, string pxid, string tid)
+        public async Task<(int state, string json)> GetSingleTeacherByProject(string areaId, string accessConfig, string pxid, string tid )
         {
         {
             string teacher = null;
             string teacher = null;
             ScAccessConfig config = accessConfig.ToObject<JsonElement>().ToObject<ScAccessConfig>();
             ScAccessConfig config = accessConfig.ToObject<JsonElement>().ToObject<ScAccessConfig>();
@@ -494,7 +510,7 @@ namespace TEAMModelOS.SDK.DI
             {
             {
                 ///{“result”:true,”reason”:null,”content”:”{“PXID”:””,”TID”:””,”TeacherName”:””,”ProjectTitle”:””,”ProjectItemTitle”:””,”CityName”:””,
                 ///{“result”:true,”reason”:null,”content”:”{“PXID”:””,”TID”:””,”TeacherName”:””,”ProjectTitle”:””,”ProjectItemTitle”:””,”CityName”:””,
                 ///”DisName”:””,”SchoolName”:””,”Sex”:””,”PXXK”:””,”PXXD”:””,”TeacherXK”:””,”TeacherXD”:””,”Email”:””}”,”pagecount”:1}
                 ///”DisName”:””,”SchoolName”:””,”Sex”:””,”PXXK”:””,”PXXD”:””,”TeacherXK”:””,”TeacherXD”:””,”Email”:””}”,”pagecount”:1}
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 if (result.result)
                 if (result.result)
                 {
                 {
                     teacher = result.content;
                     teacher = result.content;
@@ -504,9 +520,19 @@ namespace TEAMModelOS.SDK.DI
             }
             }
             catch (Exception ex)
             catch (Exception ex)
             {
             {
-                //await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetSingleTeacherByProject\n{ex.Message}\n{ex.StackTrace}\n{result.ToJsonString()}\n{data}", GroupNames.醍摩豆服務運維群組);
+                var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
+                List<ScTeacher> teachers = await table.FindListByDict<ScTeacher>(new Dictionary<string, object> { { "PartitionKey", "ScTeacher" }, { "RowKey", $"{pxid}" } });
+                if (teachers.IsNotEmpty())
+                {
+                    teacher = teachers[0].ToJsonString();
+                    return (200, teacher);
+                }
+                else {
+                    await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")},IES5.ScApisService:GetSingleTeacherByProject\n{ex.Message}\n{ex.StackTrace}\n{result.ToJsonString()}\n", GroupNames.醍摩豆服務運維群組);
+                    return (500, teacher);
+                }
                 //await response.WriteAsJsonAsync(new { data = teacher });
                 //await response.WriteAsJsonAsync(new { data = teacher });
-                return (200, teacher);
+               
             }
             }
         }
         }
 
 
@@ -816,19 +842,19 @@ namespace TEAMModelOS.SDK.DI
                     }
                     }
                 }
                 }
                 //推送数据
                 //推送数据
-                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
+                UpdateTeacherListSituation = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
 
 
-                UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
+                UpdateTeacherListDiagnosis = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
                 UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
 
 
-                UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
+                UploadKTSLList = await ThirdApisService.Post(_httpClient,config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
                 UploadKTSLList.bizcode = "UploadKTSLList";
                 UploadKTSLList.bizcode = "UploadKTSLList";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
 
 
-                UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
+                UploadSBTARPDFListV2 = await ThirdApisService.Post(_httpClient,config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
                 UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                 UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                 results.Add(UpdateTeacherListSituation);
                 results.Add(UpdateTeacherListSituation);

+ 24 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/ArtMusic.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json;
+using System.Threading.Tasks;
+
+namespace TEAMModelOS.SDK.Models.Cosmos.Common
+{
+    public class ArtMusic : CosmosEntity
+    {
+        public ArtMusic()
+        {
+            pk = "ArtMusic";
+        }
+        public string activityId { get; set; }
+        public List<StuInfo> stus { get; set; }
+        public JsonElement JsonElement { get; set; }
+    }
+    public class StuInfo {
+        public string stuId { get; set; }
+        public List<double> scores { get; set; }
+    }
+}

+ 5 - 1
TEAMModelOS.SDK/Models/Cosmos/School/SchoolTeacher.cs

@@ -16,9 +16,13 @@ namespace TEAMModelOS.SDK.Models
         public string status { get; set; }
         public string status { get; set; }
         public long createTime { get; set; }
         public long createTime { get; set; }
         /// <summary>
         /// <summary>
-        /// 教师的科目数组
+        /// 教师的科目数组
         /// </summary>
         /// </summary>
         public List<string> subjectIds { get; set; }=new List<string>();
         public List<string> subjectIds { get; set; }=new List<string>();
+        /// <summary>
+        /// 榛樿�鐨勫�娈礽d
+        /// </summary>
+        public string periodId { get; set; }
         //public string groupId { get; set; }
         //public string groupId { get; set; }
         //public string groupName { get; set; }
         //public string groupName { get; set; }
     }
     }

+ 1 - 0
TEAMModelOS.SDK/Models/Cosmos/Teacher/Teacher.cs

@@ -11,6 +11,7 @@ namespace TEAMModelOS.SDK.Models
         public string picture { get; set; }
         public string picture { get; set; }
         public int size { get; set; }
         public int size { get; set; }
         public string defaultSchool { get; set; }
         public string defaultSchool { get; set; }
+        public string defaultschoolPeriod { get; set; }
         public List<TeacherSchool> schools { get; set; } = new List<TeacherSchool>();
         public List<TeacherSchool> schools { get; set; } = new List<TeacherSchool>();
         public List<TeacherArea> areas { get; set; } = new List<TeacherArea>();
         public List<TeacherArea> areas { get; set; } = new List<TeacherArea>();
         public List<ThirdBind> binds { get; set; } = new List<ThirdBind>();
         public List<ThirdBind> binds { get; set; } = new List<ThirdBind>();

+ 38 - 0
TEAMModelOS.SDK/Models/Service/Common/TeacherService.cs

@@ -35,6 +35,7 @@ namespace TEAMModelOS.Services
             List<object> schools = new List<object>();
             List<object> schools = new List<object>();
             List<AreaDto> areas = new List<AreaDto>();
             List<AreaDto> areas = new List<AreaDto>();
             string defaultschool = null;
             string defaultschool = null;
+            string defaultschoolPeriod = null;
             //TODO 取得Teacher 個人相關數據(課程清單、虛擬教室清單、歷史紀錄清單等),學校數據另外API處理,多校切換時不同
             //TODO 取得Teacher 個人相關數據(課程清單、虛擬教室清單、歷史紀錄清單等),學校數據另外API處理,多校切換時不同
             var client = _azureCosmos.GetCosmosClient();
             var client = _azureCosmos.GetCosmosClient();
             int total = 0;
             int total = 0;
@@ -115,6 +116,7 @@ namespace TEAMModelOS.Services
                     }
                     }
                 }
                 }
                 //检查是否有加入学校,如果加入学校,则当个人空间size是0G的时候,则免费获得一个G空间,但无论加入多少个学校,只能获取一次 1G的免费空间。没有加入学校则默认0G空间,除非自己购买空间
                 //检查是否有加入学校,如果加入学校,则当个人空间size是0G的时候,则免费获得一个G空间,但无论加入多少个学校,只能获取一次 1G的免费空间。没有加入学校则默认0G空间,除非自己购买空间
+                List<SchoolTeacher> schoolTeachers= new List<SchoolTeacher>();
                 if (teacher.schools.IsNotEmpty())
                 if (teacher.schools.IsNotEmpty())
                 {
                 {
                     foreach (var sc in teacher.schools)
                     foreach (var sc in teacher.schools)
@@ -129,6 +131,7 @@ namespace TEAMModelOS.Services
                             schoolExtobj.time = sc.time;
                             schoolExtobj.time = sc.time;
                             schoolExtobj.picture = sc.picture;
                             schoolExtobj.picture = sc.picture;
                             schoolExtobj.areaId = $"{sc.areaId}";
                             schoolExtobj.areaId = $"{sc.areaId}";
+
                             Area area = null;
                             Area area = null;
                             int access = 0;
                             int access = 0;
                             if (!string.IsNullOrEmpty($"{sc.areaId}"))
                             if (!string.IsNullOrEmpty($"{sc.areaId}"))
@@ -157,6 +160,24 @@ namespace TEAMModelOS.Services
                             {
                             {
                                 var jsonDoc = await JsonDocument.ParseAsync(sctch.ContentStream);
                                 var jsonDoc = await JsonDocument.ParseAsync(sctch.ContentStream);
                                 SchoolTeacher schoolTeacher = jsonDoc.RootElement.ToObject<SchoolTeacher>();
                                 SchoolTeacher schoolTeacher = jsonDoc.RootElement.ToObject<SchoolTeacher>();
+                                if (!string.IsNullOrWhiteSpace(schoolTeacher.periodId))
+                                {
+                                    schoolExtobj.periodId = schoolTeacher.periodId;
+                                }
+                                else
+                                {
+                                    var schoolbase = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(sc.schoolId, new PartitionKey($"Base"));
+                                    if (schoolbase.Status == 200) {
+                                        var schoolJsonDoc = await JsonDocument.ParseAsync(schoolbase.ContentStream);
+                                        School schoolBase = schoolJsonDoc.RootElement.ToObject<School>();
+                                        if (schoolBase.period.IsNotEmpty()) {
+                                            schoolExtobj.periodId = schoolBase.period[0].id;
+                                            schoolTeacher.periodId = schoolBase.period[0].id;
+                                            await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(schoolTeacher, id, new PartitionKey($"Teacher-{sc.schoolId}"));
+                                        }
+                                    }
+                                }
+                               
                                 if (schoolTeacher.name == null || schoolTeacher.picture == null || !schoolTeacher.name.Equals($"{name}") || !schoolTeacher.picture.Equals($"{picture}"))
                                 if (schoolTeacher.name == null || schoolTeacher.picture == null || !schoolTeacher.name.Equals($"{name}") || !schoolTeacher.picture.Equals($"{picture}"))
                                 {
                                 {
                                     schoolTeacher.name = $"{name}";
                                     schoolTeacher.name = $"{name}";
@@ -169,6 +190,7 @@ namespace TEAMModelOS.Services
                                     schoolExtobj.size = _size.GetInt32();
                                     schoolExtobj.size = _size.GetInt32();
                                 }
                                 }
                                 else { schoolExtobj.size = 0; }
                                 else { schoolExtobj.size = 0; }
+                                schoolTeachers.Add(schoolTeacher);
                             }
                             }
                             else
                             else
                             {
                             {
@@ -223,6 +245,20 @@ namespace TEAMModelOS.Services
                         teacher.defaultSchool = null;
                         teacher.defaultSchool = null;
                     }
                     }
                 }
                 }
+                var sctecher= schoolTeachers.Find(z => z.id.Equals(teacher.id) && z.code.Equals($"Teacher-{teacher.defaultSchool}"));
+                if (sctecher != null)
+                {
+                    defaultschoolPeriod = sctecher.periodId;
+                }
+                else {
+                    var sctch = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id, new PartitionKey($"Teacher-{teacher.defaultSchool}"));
+                    if (sctch.Status == 200 && sctch != null && sctch.ContentStream != null) {
+                        var jsonDoc = await JsonDocument.ParseAsync(sctch.ContentStream);
+                        SchoolTeacher schoolTeacher = jsonDoc.RootElement.ToObject<SchoolTeacher>();
+                        defaultschoolPeriod = schoolTeacher.periodId;
+                    }
+                }
+                teacher.defaultschoolPeriod= defaultschoolPeriod;   
                 await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                 await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                 //預設學校ID
                 //預設學校ID
                 defaultschool = teacher.defaultSchool;
                 defaultschool = teacher.defaultSchool;
@@ -301,6 +337,7 @@ namespace TEAMModelOS.Services
                 blob_sas = blob_sas,
                 blob_sas = blob_sas,
                 schools = schools,
                 schools = schools,
                 defaultschool = defaultschool,
                 defaultschool = defaultschool,
+                defaultschoolPeriod=defaultschoolPeriod,
                 courses = courses,
                 courses = courses,
                 total = total,
                 total = total,
                 osblob_sas = osblob_sas,
                 osblob_sas = osblob_sas,
@@ -330,6 +367,7 @@ namespace TEAMModelOS.Services
         public string blob_sas { get; set; }
         public string blob_sas { get; set; }
         public List<object> schools { get; set; } = new List<object>();
         public List<object> schools { get; set; } = new List<object>();
         public string defaultschool { get; set; }
         public string defaultschool { get; set; }
+        public string defaultschoolPeriod { get; set; }
         public List<object> courses { get; set; } = new List<object>();
         public List<object> courses { get; set; } = new List<object>();
         public int total { get; set; }
         public int total { get; set; }
         public string osblob_uri { get; set; }
         public string osblob_uri { get; set; }

+ 6 - 10
TEAMModelOS.SDK/Models/Service/Third/ThirdApisService.cs

@@ -13,15 +13,11 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models;
 namespace TEAMModelOS.SDK
 namespace TEAMModelOS.SDK
 {
 {
-    public class ThirdApisService
+    public static class ThirdApisService
     {
     {
        
        
-     //   private readonly HttpClient _httpClient;
-        public ThirdApisService(HttpClient httpClient)
-        {
-           // _httpClient = httpClient;
-        }
-        public async   Task<ScsResult> Post(string url, string Code, string PassKey,string privateKey, Dictionary<string ,object> data)
+     //   private readonly IHttpClientFactory _httpClient;
+        public async static   Task<ScsResult> Post(IHttpClientFactory  _httpClient, string url, string Code, string PassKey,string privateKey, Dictionary<string ,object> data)
         {
         {
             string result = "";
             string result = "";
             HttpResponseMessage response=null;
             HttpResponseMessage response=null;
@@ -39,14 +35,14 @@ namespace TEAMModelOS.SDK
                 string signatureStr = signatureDC.ToJsonString();
                 string signatureStr = signatureDC.ToJsonString();
                 string signature = AESHelper.AESEncrypt(signatureStr, privateKey);
                 string signature = AESHelper.AESEncrypt(signatureStr, privateKey);
                 #endregion
                 #endregion
-                HttpClient _httpClient = new HttpClient();
-                _httpClient.DefaultRequestHeaders.Add("Signature", signature);
+                var client = _httpClient.CreateClient();
+                client.DefaultRequestHeaders.Add("Signature", signature);
                 var request = new HttpRequestMessage();
                 var request = new HttpRequestMessage();
                 request.Method = new HttpMethod("POST");
                 request.Method = new HttpMethod("POST");
                 request.RequestUri = new Uri(url);
                 request.RequestUri = new Uri(url);
                 request.Content = new StringContent(sendMsg);
                 request.Content = new StringContent(sendMsg);
                 request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
                 request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
-                response = await _httpClient.SendAsync(request);
+                response = await client.SendAsync(request);
                 result = await response.Content.ReadAsStringAsync();
                 result = await response.Content.ReadAsStringAsync();
                 if (!result.Contains("操作失败"))
                 if (!result.Contains("操作失败"))
                 {
                 {

+ 10 - 4
TEAMModelOS.SDK/Models/Service/Third/ThirdService.cs

@@ -55,8 +55,14 @@ namespace TEAMModelOS.SDK.Models
                                         SchoolTeacher schoolTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(teacher.id, new PartitionKey($"Teacher-{school.id}"));
                                         SchoolTeacher schoolTeacher = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(teacher.id, new PartitionKey($"Teacher-{school.id}"));
                                         if (schoolTeacher != null)
                                         if (schoolTeacher != null)
                                         {
                                         {
-                                            if (schoolTeacher.roles.IsEmpty() || !schoolTeacher.roles.Contains("teacher"))
+                                            if (!schoolTeacher.roles.IsEmpty() )
                                             {
                                             {
+                                                if (!schoolTeacher.roles.Contains("teacher"))
+                                                {
+                                                    schoolTeacher.roles.Add("teacher");
+                                                }
+                                            }
+                                            else {
                                                 schoolTeacher.roles = new List<string> { "teacher" };
                                                 schoolTeacher.roles = new List<string> { "teacher" };
                                             }
                                             }
                                             schoolTeacher.status = "join";
                                             schoolTeacher.status = "join";
@@ -66,7 +72,7 @@ namespace TEAMModelOS.SDK.Models
                                             schoolTeacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                                             schoolTeacher.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                                             schoolTeacher.ttl = -1;
                                             schoolTeacher.ttl = -1;
                                             schoolTeacher.permissions = schoolTeacher.permissions.IsNotEmpty() ? schoolTeacher.permissions : new List<string>();
                                             schoolTeacher.permissions = schoolTeacher.permissions.IsNotEmpty() ? schoolTeacher.permissions : new List<string>();
-                                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher);
+                                            await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher, new PartitionKey(schoolTeacher.code));
                                         }
                                         }
                                     }
                                     }
                                     catch (CosmosException)
                                     catch (CosmosException)
@@ -84,7 +90,7 @@ namespace TEAMModelOS.SDK.Models
                                             createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                             createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
                                             ttl = -1
                                             ttl = -1
                                         };
                                         };
-                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher);
+                                        await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher,new PartitionKey(schoolTeacher.code));
                                     }
                                     }
                                 }
                                 }
                             }
                             }
@@ -103,7 +109,7 @@ namespace TEAMModelOS.SDK.Models
                                     status = "join",
                                     status = "join",
                                     createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
                                     createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
                                 };
                                 };
-                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher);
+                                await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").UpsertItemAsync(schoolTeacher, new PartitionKey(schoolTeacher.code));
                             }
                             }
                             await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(teacher, teacher.id, new PartitionKey("Base"));
                             await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync(teacher, teacher.id, new PartitionKey("Base"));
 
 

+ 22 - 5
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -1190,7 +1190,8 @@ const LANG_EN_US = {
         cusImp15: 'courseNo: Course ID (optional)',
         cusImp15: 'courseNo: Course ID (optional)',
         cusImp16: 'courseDesc: Course Description (optional)',
         cusImp16: 'courseDesc: Course Description (optional)',
         cusImp17: 'teacher: Instructor/Teacher (optional). If multiple teachers teach the same course, you need to copy the course information and create an additional row',
         cusImp17: 'teacher: Instructor/Teacher (optional). If multiple teachers teach the same course, you need to copy the course information and create an additional row',
-        cusImp18: 'classes: Class (optional). If there are multiple classes taught by the teacher, use commas to separate them.',
+        cusImp182: 'classYear: The school year the class belongs to (required)',
+        cusImp18: 'className: The class taught by the teacher (required), if multiple classes can be separated by commas. ',
         cusImp19: 'Subject',
         cusImp19: 'Subject',
         cusImp20: 'Course',
         cusImp20: 'Course',
         cusImp21: 'Course ID',
         cusImp21: 'Course ID',
@@ -4432,7 +4433,7 @@ const LANG_EN_US = {
         changeSchool: {
         changeSchool: {
             pageTitle: 'Switch School',
             pageTitle: 'Switch School',
             currentDataSchool: 'Current data source school',
             currentDataSchool: 'Current data source school',
-            HabookSmartSchool: 'Habook Smarter School'
+            HabookSmartSchool: 'HABOOK Smarter School'
         },
         },
         login: "Student Login",
         login: "Student Login",
         homeViewTitle: 'IES Learning Page - AClass ONE',
         homeViewTitle: 'IES Learning Page - AClass ONE',
@@ -4763,7 +4764,7 @@ const LANG_EN_US = {
                 conAnswer1: ' question(s) not answered (check the answer card for detail)',
                 conAnswer1: ' question(s) not answered (check the answer card for detail)',
                 conAnswer2: ', please complete the question first!',
                 conAnswer2: ', please complete the question first!',
                 conAnswer: 'Continue to answer',
                 conAnswer: 'Continue to answer',
-                modifyAns: "Modify the answer",
+                modifyAns: "Change Your Answer",
                 okSubmit: 'Confirm to submit answers',
                 okSubmit: 'Confirm to submit answers',
                 exitWrong: "Leave Practice Reminder",
                 exitWrong: "Leave Practice Reminder",
                 exitWrongDe: 'The system detects that you have not yet "End practicing", if you select "OK",',
                 exitWrongDe: 'The system detects that you have not yet "End practicing", if you select "OK",',
@@ -4936,7 +4937,7 @@ const LANG_EN_US = {
             noAns3: "not answered. Please complete before submitting",
             noAns3: "not answered. Please complete before submitting",
             noAns4: "Confirm",
             noAns4: "Confirm",
             noAns5: "Please answer first!",
             noAns5: "Please answer first!",
-            noAns6: "The answer to the questionnaire is not complete yet, do you want to submit a draft first? (You can still modify and submit next time)",
+            noAns6: "Survey answers are not yet complete, do you want to submit a draft first? (You can still revise and resubmit before the end of the activity)",
             delTitle: "The survey has been deleted, do you want to delete this record?",
             delTitle: "The survey has been deleted, do you want to delete this record?",
             delOk: "Delete",
             delOk: "Delete",
             delCancel: "Cancel",
             delCancel: "Cancel",
@@ -5204,7 +5205,7 @@ const LANG_EN_US = {
             finished: 'Completed',
             finished: 'Completed',
             unfinished: 'Incomplete',
             unfinished: 'Incomplete',
             noAns: 'No Answer',
             noAns: 'No Answer',
-            allowModify: 'Allow modify answers',
+            allowModify: 'Allow students to revise their answers',
             name: 'Name',
             name: 'Name',
             className: 'Class',
             className: 'Class',
             id: 'ID',
             id: 'ID',
@@ -5501,6 +5502,22 @@ const LANG_EN_US = {
         opt: 'Optimize Function',
         opt: 'Optimize Function',
         bug: 'Fixing known bug'
         bug: 'Fixing known bug'
     },
     },
+    // 操作日志
+    log: {
+        log: 'Operation log',
+        searchName: 'Operator Name',
+        searchId: 'Operator ID',
+        searchTime: 'Please select the operation time',
+        search: 'Search',
+        details: 'View Details',
+        index: 'Number',
+        platform: 'Platform',
+        type: 'Operation type',
+        time: 'Time',
+        action: 'Operation',
+        noMsgTip: 'No operation details! ',
+        exportLog: 'Export log'
+    },
     // 课堂统计
     // 课堂统计
     talMgmt: {
     talMgmt: {
         text1: 'Total Course(s)',
         text1: 'Total Course(s)',

+ 18 - 1
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -1190,7 +1190,8 @@ const LANG_ZH_CN = {
         cusImp15: 'courseNo: 课程编码(选填)',
         cusImp15: 'courseNo: 课程编码(选填)',
         cusImp16: 'courseDesc: 课程描述(选填)',
         cusImp16: 'courseDesc: 课程描述(选填)',
         cusImp17: 'teacher: 授课教师(选填),如果多个老师教授同一个课程,需要复制课程信息,新建一行',
         cusImp17: 'teacher: 授课教师(选填),如果多个老师教授同一个课程,需要复制课程信息,新建一行',
-        cusImp18: 'classes: 教师授课班级(选填),如果多个班级可以使用逗号分隔。',
+        cusImp182: 'classYear: 班级所属学年(必填)',
+        cusImp18: 'className: 教师授课班级(必填),如果多个班级可以使用逗号分隔。',
         cusImp19: '学科',
         cusImp19: '学科',
         cusImp20: '课程',
         cusImp20: '课程',
         cusImp21: '课程编码',
         cusImp21: '课程编码',
@@ -5505,6 +5506,22 @@ const LANG_ZH_CN = {
         opt: '优化功能',
         opt: '优化功能',
         bug: '修复已知Bug'
         bug: '修复已知Bug'
     },
     },
+    // 操作日志
+    log: {
+        log: '操作日志',
+        searchName: '操作人姓名',
+        searchId: '操作人ID',
+        searchTime: '请选择操作时间',
+        search: '查询',
+        details: '查看详情',
+        index: '编号',
+        platform: '平台',
+        type: '操作类型',
+        time: '时间',
+        action: '操作',
+        noMsgTip: '无操作详情数据!',
+        exportLog: '导出日志'
+    },
     // 课堂统计
     // 课堂统计
     talMgmt: {
     talMgmt: {
         text1: '收课总数',
         text1: '收课总数',

+ 18 - 1
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -1190,7 +1190,8 @@ const LANG_ZH_TW = {
         cusImp15: 'courseNo: 課程編碼(選填)',
         cusImp15: 'courseNo: 課程編碼(選填)',
         cusImp16: 'courseDesc: 課程描述(選填)',
         cusImp16: 'courseDesc: 課程描述(選填)',
         cusImp17: 'teacher: 授課教師(選填), 如果多個老師教授同一個課程,需要複製課程資訊,新建一行',
         cusImp17: 'teacher: 授課教師(選填), 如果多個老師教授同一個課程,需要複製課程資訊,新建一行',
-        cusImp18: 'classes: 教師授課班級(選填), 如果多個班級可以使用逗號分隔。 ',
+        cusImp182: 'classYear: 班級所屬學年(必填)',
+        cusImp18: 'className: 教師授課班級(必填),如果多個班級可以使用逗號分隔。 ',
         cusImp19: '學科',
         cusImp19: '學科',
         cusImp20: '課程',
         cusImp20: '課程',
         cusImp21: '課程編碼',
         cusImp21: '課程編碼',
@@ -5506,6 +5507,22 @@ const LANG_ZH_TW = {
         opt: '優化功能',
         opt: '優化功能',
         bug: '修復已知Bug'
         bug: '修復已知Bug'
     },
     },
+    // 操作日志
+    log: {
+        log: '操作日誌',
+        searchName: '操作人姓名',
+        searchId: '操作人ID',
+        searchTime: '請選擇操作時間',
+        search: '查詢',
+        details: '查看詳情',
+        index: '編號',
+        platform: '平台',
+        type: '操作類型',
+        time: '時間',
+        action: '操作',
+        noMsgTip: '無操作詳細資料! ',
+        exportLog: '匯出日誌'
+    },
     // 课堂统计
     // 课堂统计
     talMgmt: {
     talMgmt: {
         text1: '收課總數',
         text1: '收課總數',

+ 9 - 3
TEAMModelOS/ClientApp/src/api/notice.js

@@ -9,13 +9,19 @@ export default {
     /*
     /*
      *查询公告
      *查询公告
      */
      */
-     FindNotice: function (data) {
+    FindNotice: function (data) {
         return post('/school/notice/find', data)
         return post('/school/notice/find', data)
     },
     },
     /*
     /*
      *删除公告
      *删除公告
      */
      */
-     DelNotice: function (data) {
+    DelNotice: function (data) {
         return post('/school/notice/delete', data)
         return post('/school/notice/delete', data)
-    }
+    },
+    /*
+     *查询操作日志
+     */
+    FindLog: function (data) {
+        return post('/log/get-lists', data)
+    },
 }
 }

BIN
TEAMModelOS/ClientApp/src/assets/image/cus-import-cn.png


BIN
TEAMModelOS/ClientApp/src/assets/image/cus-import-en.png


BIN
TEAMModelOS/ClientApp/src/assets/image/cus-import-tw.png


+ 15 - 3
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -266,10 +266,10 @@ export default {
     IES5Menu() {
     IES5Menu() {
       return !this.$jsFn.checkJinNiu() && !this.$jsFn.checkTrain()
       return !this.$jsFn.checkJinNiu() && !this.$jsFn.checkTrain()
     },
     },
-      isShowArtMenu() {
+    isShowArtMenu() {
       let schoolCode = this.$store.state.userInfo.schoolCode
       let schoolCode = this.$store.state.userInfo.schoolCode
       let schoolProfile = JSON.parse(decodeURIComponent(localStorage.school_profile || '{}', "utf-8"))
       let schoolProfile = JSON.parse(decodeURIComponent(localStorage.school_profile || '{}', "utf-8"))
-      let schoolArt = schoolProfile.schoolShows?.find(item => item.code == schoolCode && item.status === 1)
+      let schoolArt = schoolProfile.schoolShows?.find(item => item.code == schoolCode && item.status === 1 && item.type === 'art')
       return (!!schoolArt && this.IES5Menu && this.$store.state.config.srvAdr == 'China') || this.$store.state.config.srvAdrType === 'test'
       return (!!schoolArt && this.IES5Menu && this.$store.state.config.srvAdr == 'China') || this.$store.state.config.srvAdrType === 'test'
     },
     },
     hasDashAuth() {
     hasDashAuth() {
@@ -307,7 +307,7 @@ export default {
           permission: 'dashboard-read',
           permission: 'dashboard-read',
           menuName: 'TeacherDashboard',
           menuName: 'TeacherDashboard',
           child: [],
           child: [],
-          isShow: this.IES5Menu && this.hasDashAuth && !this.isGlobalSite
+          isShow: this.IES5Menu && !this.isGlobalSite
         },
         },
         // 学校管理
         // 学校管理
         {
         {
@@ -396,6 +396,18 @@ export default {
               menuName: 'auth',
               menuName: 'auth',
               isShow: this.IES5Menu
               isShow: this.IES5Menu
               // isShow: this.$store.state.config.srvAdrType != 'product' && this.$jsFn.checkJinNiu()
               // isShow: this.$store.state.config.srvAdrType != 'product' && this.$jsFn.checkJinNiu()
+            },
+            // 操作日志
+            {
+              icon: 'iconfont icon-questionnaire',
+              name: `操作日志`,
+              router: '/home/log',
+              tag: '',
+              role: 'admin',
+              permission: 'teacher-read|teacher-upd',
+              menuName: 'log',
+              isShow: this.IES5Menu
+              // isShow: this.$store.state.config.srvAdrType != 'product' && this.$jsFn.checkJinNiu()
             }
             }
           ]
           ]
         },
         },

+ 273 - 273
TEAMModelOS/ClientApp/src/common/BaseSelectSchool.vue

@@ -1,312 +1,312 @@
 <template>
 <template>
-    <div class="base-school-select">
-        <div v-if="!joinSchools || !joinSchools.length">{{ noJoinSchoolContent }}</div>
-        <div v-else>
-            <!-- 学校切换 -->
-            <Dropdown class="school-select" transfer @on-click="onSchoolSelect" trigger="click">
-                <img class="school-logo" :src="curSchool.picture" style="width: 25px;" />
-                <a href="javascript:void(0)" :class="['base-user-post', areaSchs && areaSchs.length === 1 ? 'single-school' : '']">
-                    {{ curSchool.name }}
-                    <Icon type="ios-arrow-down"></Icon>
-                </a>
-                <DropdownMenu slot="list">
-                    <div v-for="(item,index) in areaSchs" :key="index">
-                        <DropdownItem :name="index">
-                            <div class="school-item">
-                                <img class="school-item-img" :src="item.picture || defaultLogo" alt="" style="border-radius: 50%;">
-                                <span>{{ item.name }}</span>
-                            </div>
-                        </DropdownItem>
-                    </div>
-                </DropdownMenu>
-            </Dropdown>
-            <!-- 学段切换 -->
-            <Dropdown @on-click="onPeriodSelect" transfer v-show="periods.length > 1" style="margin-left: 20px;">
-                <!-- <a href="javascript:void(0)" :class="['base-user-post', periods && periods.length === 1 ? 'single-school' : '']"> -->
-                <!-- ( {{ curPeriod.name }} )
+  <div class="base-school-select">
+    <div v-if="!joinSchools || !joinSchools.length">{{ noJoinSchoolContent }}</div>
+    <div v-else>
+      <!-- 学校切换 -->
+      <Dropdown class="school-select" transfer @on-click="onSchoolSelect" trigger="click">
+        <img class="school-logo" :src="curSchool.picture" style="width: 25px;" />
+        <a href="javascript:void(0)" :class="['base-user-post', areaSchs && areaSchs.length === 1 ? 'single-school' : '']">
+          {{ curSchool.name }}
+          <Icon type="ios-arrow-down"></Icon>
+        </a>
+        <DropdownMenu slot="list">
+          <div v-for="(item,index) in areaSchs" :key="index">
+            <DropdownItem :name="index">
+              <div class="school-item">
+                <img class="school-item-img" :src="item.picture || defaultLogo" alt="" style="border-radius: 50%;">
+                <span>{{ item.name }}</span>
+              </div>
+            </DropdownItem>
+          </div>
+        </DropdownMenu>
+      </Dropdown>
+      <!-- 学段切换 -->
+      <Dropdown @on-click="onPeriodSelect" transfer v-show="periods.length > 1" style="margin-left: 20px;">
+        <!-- <a href="javascript:void(0)" :class="['base-user-post', periods && periods.length === 1 ? 'single-school' : '']"> -->
+        <!-- ( {{ curPeriod.name }} )
 					<Icon type="ios-arrow-down"></Icon> -->
 					<Icon type="ios-arrow-down"></Icon> -->
-                <span class="period-select">
-                    &nbsp;
-                    {{ curPeriod.name }}
-                    <Icon type="md-arrow-dropdown" />
-                </span>
-                <!-- </a> -->
-                <!-- <span class="period-select">{{ curPeriod.name }}</span> -->
-                <DropdownMenu slot="list">
-                    <div v-for="(item,index) in periods" :key="index">
-                        <DropdownItem :name="index">
-                            <div class="school-item">
-                                <span>{{ item.name }}</span>
-                            </div>
-                        </DropdownItem>
-                    </div>
-                </DropdownMenu>
-            </Dropdown>
-        </div>
+        <span class="period-select">
+          &nbsp;
+          {{ curPeriod.name }}
+          <Icon type="md-arrow-dropdown" />
+        </span>
+        <!-- </a> -->
+        <!-- <span class="period-select">{{ curPeriod.name }}</span> -->
+        <DropdownMenu slot="list">
+          <div v-for="(item,index) in periods" :key="index">
+            <DropdownItem :name="index">
+              <div class="school-item">
+                <span>{{ item.name }}</span>
+              </div>
+            </DropdownItem>
+          </div>
+        </DropdownMenu>
+      </Dropdown>
     </div>
     </div>
+  </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { mapGetters } from 'vuex'
 import { mapGetters } from 'vuex'
 import User from '@/service/User.js'
 import User from '@/service/User.js'
 export default {
 export default {
-    inject: ['reload'],
-    data() {
-        return {
-            curSchool: {
-                logo: ''
-            },
-            defaultLogo: '',
-            user: {
-                schools: []
-            },
-            joinSchools: [],
-            areaSchs: [],
-            areaList: [],
-            periods: [],
-            curPeriod: {
-                name: ''
-            }
-        }
-    },
-    created() {
-        console.log('BaseSelectSchool初始化')
-        console.log(this.userProfile)
-        this.defaultLogo = require('@/assets/icon/default_school.png')
-        // 获取本地存储中的 用户信息
-        let user = this.$store.state.user.userProfile || JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8"));
-        let schoolProfile = localStorage.school_profile ? JSON.parse(decodeURIComponent(localStorage.school_profile,
-            "utf-8")) : undefined;
-        let localPeriodInfo = localStorage.curPeriod ? JSON.parse(localStorage.curPeriod) : null
-        this.user.schools = user.schools
-        let joinSchools = user.schools && user.schools.length ? user.schools.filter(i => i.status === 'join') : null
-        console.log(joinSchools);
-        /* 如果加入的学校都没有归属区 则需要补充‘其他学校’区 */
-        if (joinSchools && joinSchools.length) {
-            joinSchools.forEach(i => {
-                if (!i.area) {
-                    i.area = {
-                        name: this.$t('ability.otherSch'),
-                        access: 0
-                    }
-                }
-            })
+  inject: ['reload'],
+  data() {
+    return {
+      curSchool: {
+        logo: ''
+      },
+      defaultLogo: '',
+      user: {
+        schools: []
+      },
+      joinSchools: [],
+      areaSchs: [],
+      areaList: [],
+      periods: [],
+      curPeriod: {
+        name: ''
+      }
+    }
+  },
+  created() {
+    console.log('BaseSelectSchool初始化')
+    console.log(this.userProfile)
+    this.defaultLogo = require('@/assets/icon/default_school.png')
+    // 获取本地存储中的 用户信息
+    let user = this.$store.state.user.userProfile || JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8"));
+    let schoolProfile = localStorage.school_profile ? JSON.parse(decodeURIComponent(localStorage.school_profile,
+      "utf-8")) : undefined;
+    let localPeriodInfo = localStorage.curPeriod ? JSON.parse(localStorage.curPeriod) : null
+    this.user.schools = user.schools
+    let joinSchools = user.schools && user.schools.length ? user.schools.filter(i => i.status === 'join') : null
+    console.log(joinSchools);
+    /* 如果加入的学校都没有归属区 则需要补充‘其他学校’区 */
+    if (joinSchools && joinSchools.length) {
+      joinSchools.forEach(i => {
+        if (!i.area) {
+          i.area = {
+            name: this.$t('ability.otherSch'),
+            access: 0
+          }
         }
         }
-        this.joinSchools = joinSchools
-        // 如果本地存储已经有保存学校信息 则刷新后会直接读取之前的学校信息
-        if (joinSchools && joinSchools.length) {
-            if (schoolProfile) {
-                this.curSchool = joinSchools.find(i => i.schoolId === schoolProfile.school_base.id)
-            } else {
-                this.curSchool = user.defaultschool ? joinSchools.find(i => i.schoolId === user.defaultschool) : joinSchools[0]
-            }
-            this.$store.commit('setSchoolCode', this.curSchool.schoolId)
-            this.areaList = [...new Set(this.joinSchools.map(i => i.area).map(j => j.name))]
-            this.areaSchs = this.joinSchools.filter(i => i.area.name === this.curSchool.area.name)
-            this.periods = this.$store.state.user.schoolProfile.school_base.period
-            this.periods && (this.curPeriod = this.periods[localPeriodInfo && localPeriodInfo.periodIndex ? localPeriodInfo.periodIndex : 0])
-            if (!localPeriodInfo) {
-                this.curPeriod.periodIndex = 0
-                // 保存Vuex
-                this.$store.commit('user/setCurPeriod', this.curPeriod)
-                // 保存Stroage
-                localStorage.setItem('curPeriod', JSON.stringify(this.curPeriod))
-            } else {
-                this.$store.commit('user/setCurPeriod', localPeriodInfo)
+      })
+    }
+    this.joinSchools = joinSchools
+    // 如果本地存储已经有保存学校信息 则刷新后会直接读取之前的学校信息
+    if (joinSchools && joinSchools.length) {
+      if (schoolProfile) {
+        this.curSchool = joinSchools.find(i => i.schoolId === schoolProfile.school_base.id)
+      } else {
+        this.curSchool = user.defaultschool ? joinSchools.find(i => i.schoolId === user.defaultschool) : joinSchools[0]
+      }
+      this.$store.commit('setSchoolCode', this.curSchool.schoolId)
+      this.areaList = [...new Set(this.joinSchools.map(i => i.area).map(j => j.name))]
+      this.areaSchs = this.joinSchools.filter(i => i.area.name === this.curSchool.area.name)
+      this.periods = this.$store.state.user.schoolProfile.school_base.period
+      this.periods && (this.curPeriod = this.periods[localPeriodInfo && localPeriodInfo.periodIndex ? localPeriodInfo.periodIndex : 0])
+      if (!localPeriodInfo) {
+        this.curPeriod.periodIndex = 0
+        // 保存Vuex
+        this.$store.commit('user/setCurPeriod', this.curPeriod)
+        // 保存Stroage
+        localStorage.setItem('curPeriod', JSON.stringify(this.curPeriod))
+      } else {
+        this.$store.commit('user/setCurPeriod', localPeriodInfo)
+      }
+    } else {
+      this.$Message.warning(this.$t('utils.noShoolTip'))
+    }
+    console.log('当前区域学校 > ', this.areaSchs)
+    console.log('当前学校 > ', this.curSchool)
+    console.log('当前学段 > ', this.curPeriod)
+  },
+  methods: {
+    async onSchoolSelect(val) {
+      /* 如果没有加入的学校或者加入的学校都没有归属区 */
+      if (this.joinSchools.length) {
+        this.joinSchools.forEach(i => {
+          if (!i.area) {
+            i.area = {
+              name: this.$t('ability.otherSch')
             }
             }
-        } else {
-            this.$Message.warning(this.$t('utils.noShoolTip'))
-        }
-        console.log('当前区域学校 > ', this.areaSchs)
-        console.log('当前学校 > ', this.curSchool)
-        console.log('当前学段 > ', this.curPeriod)
+          }
+        })
+      }
+      let curAreaName = sessionStorage.getItem('areaName') || this.areaList[0]
+      this.joinSchools = this.user.schools.filter(i => i.status === 'join')
+      this.areaSchs = this.joinSchools.filter(i => i.area.name === curAreaName)
+      // this.$EventBus.$emit('onGlobalLoading', true)
+      this.curSchool = this.areaSchs[val]
+      let schoolCode = this.areaSchs[val].schoolId
+      this.changeCurSchool(schoolCode)
     },
     },
-    methods: {
-        async onSchoolSelect(val) {
-            /* 如果没有加入的学校或者加入的学校都没有归属区 */
-            if (this.joinSchools.length) {
-                this.joinSchools.forEach(i => {
-                    if (!i.area) {
-                        i.area = {
-                            name: this.$t('ability.otherSch')
-                        }
-                    }
-                })
-            }
-            let curAreaName = sessionStorage.getItem('areaName') || this.areaList[0]
-            this.joinSchools = this.user.schools.filter(i => i.status === 'join')
-            this.areaSchs = this.joinSchools.filter(i => i.area.name === curAreaName)
-            // this.$EventBus.$emit('onGlobalLoading', true)
-            this.curSchool = this.areaSchs[val]
-            let schoolCode = this.areaSchs[val].schoolId
-            this.changeCurSchool(schoolCode)
-        },
 
 
-        /* 学段选择 */
-        onPeriodSelect(val) {
-            this.curPeriod = this.periods[val]
-            // 保存当前学段的下标 提供给部分模块的select使用
-            this.curPeriod.periodIndex = val
-            // 保存Vuex
-            this.$store.commit('user/setCurPeriod', this.curPeriod)
-            // 保存Stroage
-            localStorage.setItem('curPeriod', JSON.stringify(this.curPeriod))
-        },
+    /* 学段选择 */
+    onPeriodSelect(val) {
+      this.curPeriod = this.periods[val]
+      // 保存当前学段的下标 提供给部分模块的select使用
+      this.curPeriod.periodIndex = val
+      // 保存Vuex
+      this.$store.commit('user/setCurPeriod', this.curPeriod)
+      // 保存Stroage
+      localStorage.setItem('curPeriod', JSON.stringify(this.curPeriod))
+    },
 
 
-        /* 学校切换后针对当前学校CODE进行操作 */
-        changeCurSchool(schoolCode, routerInfo) {
-            // this.$EventBus.$emit('onChangeSchool', {
-            // 	schoolCode: schoolCode
-            // })
-            this.$EventBus.$emit('onGlobalLoading', true)
-            // 更新当前school_code
-            this.$store.dispatch('user/setSchoolCode', schoolCode)
-            // 更新当前school_profile以及access
-            this.$store.dispatch('user/checkSchoolProfile').then(res => {
-                if (res) {
-                    this.$User.freshLogin()
-                }
-                console.log('切换学校了', this.curSchool, schoolCode)
-                console.log('当前学校的学段信息', this.$store.state.user.schoolProfile.school_base.period)
-                // 将教师列表信息清空
-                this.$store.commit('user/setTeachers', undefined)
-                this.periods = this.$store.state.user.schoolProfile.school_base.period
-                let vuexPeriod = this.$store.state.user.curPeriod
-                let preSchoolCode = localStorage.getItem('cur_schoolCode')
-                // 判断之前已经选择了学段 并且从区级切换回来的是同一学校 则去读取存储的学段数据 否则默认读取第一个学段信息
-                if (vuexPeriod && preSchoolCode && preSchoolCode === schoolCode) {
-                    this.onPeriodSelect(vuexPeriod.periodIndex)
-                } else {
-                    this.onPeriodSelect(0)
-                }
-                localStorage.removeItem('cacheSchoolFiles')
-                localStorage.removeItem('bankFilterConds')
-                localStorage.setItem('cur_schoolCode', schoolCode)
-                // this.periods && (this.curPeriod = this.periods[0])
-                setTimeout(() => {
-                    this.$EventBus.$emit('onGlobalLoading', false)
-                }, 1500)
-                routerInfo = routerInfo || { name: 'home' }
-                // console.error(routerInfo.name);
-                // console.error(this.$route);
-                this.$router.push(routerInfo)
-                if (routerInfo.name === this.$route.name) {
-                    this.reload()
-                }
-            });
+    /* 学校切换后针对当前学校CODE进行操作 */
+    changeCurSchool(schoolCode, routerInfo) {
+      // this.$EventBus.$emit('onChangeSchool', {
+      // 	schoolCode: schoolCode
+      // })
+      this.$EventBus.$emit('onGlobalLoading', true)
+      // 更新当前school_code
+      this.$store.dispatch('user/setSchoolCode', schoolCode)
+      // 更新当前school_profile以及access
+      this.$store.dispatch('user/checkSchoolProfile').then(res => {
+        if (res) {
+          this.$User.freshLogin()
         }
         }
-    },
-    mounted() {
-        // 解绑之前的事件 防止多次触发
-        // this.$EventBus.$off('onChangeSchool')
-        // this.$EventBus.$on('onChangeSchool', params => {
-        // 	if (this.curSchool && params.schoolCode !== this.curSchool.schoolId && params.user) {
-        // 		console.log('检测到切换学校')
-        // 		console.log(params)
-        // 		this.user = params.user
-        // 		let joinSchools = params.user.schools.filter(i => i.status === 'join')
-        // 		this.onSchoolSelect(params.isFirst ? 0 : joinSchools.map(j => j.schoolId).indexOf(params.schoolCode))
-        // 	}
-        // })
+        console.log('切换学校了', this.curSchool, schoolCode)
+        console.log('当前学校的学段信息', this.$store.state.user.schoolProfile.school_base.period)
+        // 将教师列表信息清空
+        this.$store.commit('user/setTeachers', undefined)
+        this.periods = this.$store.state.user.schoolProfile.school_base.period
+        let vuexPeriod = this.$store.state.user.curPeriod
+        let preSchoolCode = localStorage.getItem('cur_schoolCode')
+        // 判断之前已经选择了学段 并且从区级切换回来的是同一学校 则去读取存储的学段数据 否则默认读取第一个学段信息
+        if (vuexPeriod && preSchoolCode && preSchoolCode === schoolCode) {
+          this.onPeriodSelect(vuexPeriod.periodIndex)
+        } else {
+          this.onPeriodSelect(0)
+        }
+        localStorage.removeItem('cacheSchoolFiles')
+        localStorage.removeItem('bankFilterConds')
+        localStorage.setItem('cur_schoolCode', schoolCode)
+        // this.periods && (this.curPeriod = this.periods[0])
+        setTimeout(() => {
+          this.$EventBus.$emit('onGlobalLoading', false)
+        }, 1500)
+        routerInfo = routerInfo || { name: 'home' }
+        // console.error(routerInfo.name);
+        // console.error(this.$route);
+        this.$router.push(routerInfo)
+        if (routerInfo.name === this.$route.name) {
+          this.reload()
+        }
+      });
+    }
+  },
+  mounted() {
+    // 解绑之前的事件 防止多次触发
+    // this.$EventBus.$off('onChangeSchool')
+    // this.$EventBus.$on('onChangeSchool', params => {
+    // 	if (this.curSchool && params.schoolCode !== this.curSchool.schoolId && params.user) {
+    // 		console.log('检测到切换学校')
+    // 		console.log(params)
+    // 		this.user = params.user
+    // 		let joinSchools = params.user.schools.filter(i => i.status === 'join')
+    // 		this.onSchoolSelect(params.isFirst ? 0 : joinSchools.map(j => j.schoolId).indexOf(params.schoolCode))
+    // 	}
+    // })
 
 
-        // 监听区的切换
-        this.$EventBus.$off('onChangeArea')
-        this.$EventBus.$on('onChangeArea', params => {
-            console.log('区域切换', params);
-            console.log('区域切换', this.joinSchools);
-            if (this.joinSchools && this.joinSchools.length) {
-                this.areaSchs = this.joinSchools.filter(i => i.area.name === params.areaName)
-                console.log(this.areaSchs);
-                this.curSchool = params.schoolCode ? this.areaSchs.find(i => i.schoolId === params.schoolCode) : this.areaSchs[0]
-                let schoolCode = this.curSchool.schoolId
-                this.changeCurSchool(schoolCode, params.routerInfo)
-            }
-        })
-    },
+    // 监听区的切换
+    this.$EventBus.$off('onChangeArea')
+    this.$EventBus.$on('onChangeArea', params => {
+      console.log('区域切换', params);
+      console.log('区域切换', this.joinSchools);
+      if (this.joinSchools && this.joinSchools.length) {
+        this.areaSchs = this.joinSchools.filter(i => i.area.name === params.areaName)
+        console.log(this.areaSchs);
+        this.curSchool = params.schoolCode ? this.areaSchs.find(i => i.schoolId === params.schoolCode) : this.areaSchs[0]
+        let schoolCode = this.curSchool.schoolId
+        this.changeCurSchool(schoolCode, params.routerInfo)
+      }
+    })
+  },
 
 
-    computed: {
-        noJoinSchoolContent() {
-            let inviteSchools = this.user.schools.filter(i => i.status === 'invite')
-            let requestSchools = this.user.schools.filter(i => i.status === 'request')
-            // return requestSchools.length ? `${requestSchools[0].name}(${this.$t('settings.status3')})` : (inviteSchools.length ? `${inviteSchools[0].name}(${this.$t('settings.status2')})` : this.$t('utils.noJoinSchool'))
-            return requestSchools.length ? `${requestSchools[0].name}(${this.$t('settings.status3')})` : (inviteSchools.length ? `${inviteSchools[0].name}(${this.$t('settings.status2')})` : '')
-        },
-    }
+  computed: {
+    noJoinSchoolContent() {
+      let inviteSchools = this.user.schools.filter(i => i.status === 'invite')
+      let requestSchools = this.user.schools.filter(i => i.status === 'request')
+      // return requestSchools.length ? `${requestSchools[0].name}(${this.$t('settings.status3')})` : (inviteSchools.length ? `${inviteSchools[0].name}(${this.$t('settings.status2')})` : this.$t('utils.noJoinSchool'))
+      return requestSchools.length ? `${requestSchools[0].name}(${this.$t('settings.status3')})` : (inviteSchools.length ? `${inviteSchools[0].name}(${this.$t('settings.status2')})` : '')
+    },
+  }
 }
 }
 </script>
 </script>
 
 
 <style lang="less">
 <style lang="less">
 .base-school-select {
 .base-school-select {
-    // font-family: 'NotoSerif', '微软正黑体', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Sans-serif;
-    .ivu-dropdown {
-        .ivu-select-dropdown {
-            width: max-content;
-            width: -webkit-max-content;
-            left: -35%;
-        }
+  // font-family: 'NotoSerif', '微软正黑体', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Sans-serif;
+  .ivu-dropdown {
+    .ivu-select-dropdown {
+      width: max-content;
+      width: -webkit-max-content;
+      left: -35%;
+    }
 
 
-        .ivu-dropdown-menu {
-            max-height: 600px;
-            overflow: auto;
-        }
+    .ivu-dropdown-menu {
+      max-height: 600px;
+      overflow: auto;
+    }
 
 
-        .ivu-dropdown-item:hover {
-            background: #83d7ff;
-        }
+    .ivu-dropdown-item:hover {
+      background: #83d7ff;
+    }
 
 
-        a {
-            color: var(--primary-textColor) !important;
+    a {
+      color: var(--primary-textColor) !important;
 
 
-            &:hover {
-                color: var(--primary-textColor) !important;
-            }
+      &:hover {
+        color: var(--primary-textColor) !important;
+      }
 
 
-            .ivu-icon {
-                display: none;
-            }
+      .ivu-icon {
+        display: none;
+      }
 
 
-            &::after {
-                content: "";
-                display: inline-block;
-                width: 0;
-                height: 0;
-                border-right: solid 6px transparent;
-                border-left: solid 6px transparent;
-                border-top: solid 6px #16b1f3;
-                margin-left: 2px;
-                margin-bottom: 3px;
-            }
-        }
+      &::after {
+        content: "";
+        display: inline-block;
+        width: 0;
+        height: 0;
+        border-right: solid 6px transparent;
+        border-left: solid 6px transparent;
+        border-top: solid 6px #16b1f3;
+        margin-left: 2px;
+        margin-bottom: 3px;
+      }
     }
     }
+  }
 
 
-    .period-select {
-        font-size: 16px;
-        background: #1cc0f3;
-        padding: 2px 5px;
-        border-radius: 5px;
-        cursor: pointer;
-    }
+  .period-select {
+    font-size: 16px;
+    background: #1cc0f3;
+    padding: 2px 5px;
+    border-radius: 5px;
+    cursor: pointer;
+  }
 
 
-    .single-school {
-        &::after {
-            display: none !important;
-        }
+  .single-school {
+    &::after {
+      display: none !important;
     }
     }
+  }
 
 
-    .school-logo {
-        width: 30px;
-        border-radius: 50%;
-        margin-right: 10px;
-        margin-bottom: 5px;
-        vertical-align: middle;
-    }
+  .school-logo {
+    width: 30px;
+    border-radius: 50%;
+    margin-right: 10px;
+    margin-bottom: 5px;
+    vertical-align: middle;
+  }
 }
 }
 .school-item {
 .school-item {
-    display: flex;
-    align-items: center;
+  display: flex;
+  align-items: center;
 }
 }
 .school-item-img {
 .school-item-img {
-    width: 30px;
-    margin-right: 15px;
+  width: 30px;
+  margin-right: 15px;
 }
 }
 </style>
 </style>

+ 10 - 0
TEAMModelOS/ClientApp/src/router/routes.js

@@ -1329,6 +1329,16 @@ export const routes = [{
             middleware: ['login', 'ability:admin,auth-read|auth-upd'],
             middleware: ['login', 'ability:admin,auth-read|auth-upd'],
         }
         }
     },
     },
+    //操作日志
+    {
+        path: 'log',
+        name: 'log',
+        component: () => import('@/view/log/Log.vue'),
+        meta: {
+            activeName: 'log',
+            middleware: ['login', 'ability:admin,teacher-read|teacher-upd'],
+        }
+    },
     //管理艺术评测
     //管理艺术评测
     {
     {
         path: 'mgtArtExam',
         path: 'mgtArtExam',

+ 10 - 0
TEAMModelOS/ClientApp/src/view/Home.vue

@@ -375,6 +375,16 @@ export default {
       curNoSaveArr.push(val)
       curNoSaveArr.push(val)
       localStorage.setItem('noSave', JSON.stringify(curNoSaveArr))
       localStorage.setItem('noSave', JSON.stringify(curNoSaveArr))
     })
     })
+
+    this.$EventBus.$off('onGlobalLoading')
+    this.$EventBus.$on('onGlobalLoading', val => {
+      this.isLoading = val
+      console.error('HOME - ', val)
+      sessionStorage.setItem('isGlobalLoading', val)
+      if (!val) {
+        this.$EventBus.$emit('homePageInit')
+      }
+    })
   },
   },
   computed: {
   computed: {
     /* 判断是否加入学校 */
     /* 判断是否加入学校 */

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 493 - 483
TEAMModelOS/ClientApp/src/view/coursemgt/ImportCus.vue


+ 14 - 3
TEAMModelOS/ClientApp/src/view/dashboard/fiveEdu/FiveEdu.vue

@@ -423,8 +423,14 @@ export default {
           break;
           break;
         case 'art':
         case 'art':
           // this.$tools.exitFullscreen()
           // this.$tools.exitFullscreen()
-          this.$router.push('/artDashboard')
-          this.activeMenuId = menu.id
+          if (this.hasArtAuth) {
+            this.$router.push('/artDashboard')
+            this.activeMenuId = menu.id
+          } else {
+            this.noAuthModal = true
+            this.noAuthName = '艺术测评'
+          }
+
           break;
           break;
         case 'work':
         case 'work':
           this.noAuthModal = true
           this.noAuthModal = true
@@ -524,7 +530,12 @@ export default {
     },
     },
     /* 醍摩豆学校和研发学校才开放查阅的DEMO页面 */
     /* 醍摩豆学校和研发学校才开放查阅的DEMO页面 */
     isTestView() {
     isTestView() {
-      return ['hbcn', 'habook'].includes(this.$store.state.userInfo.schoolCode)
+      return ['habook', 'ydzt', 'cdydzt', 'hbcn'].includes(this.$store.state.userInfo.schoolCode)
+    },
+    /* 判断是否购买艺术评测 */
+    hasArtAuth() {
+      let schoolProfile = JSON.parse(decodeURIComponent(localStorage.school_profile || '{}', "utf-8"))
+      return schoolProfile.schoolShows?.find(item => item.code == schoolCode && item.status === 1 && item.type === 'art')
     }
     }
   }
   }
 }
 }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 762 - 755
TEAMModelOS/ClientApp/src/view/homepage/HomePage.vue


+ 199 - 0
TEAMModelOS/ClientApp/src/view/log/Log.vue

@@ -0,0 +1,199 @@
+<template>
+  <div class="log-container">
+    <div class="log-header">
+      <Select v-model="curNameIndex" @on-change="doSearch" style="width:250px;margin-right: 10px;" filterable clearable :placeholder="$t('log.searchName')" @on-clear="onNameClear">
+        <Option v-for="(item,index) in nameArr" :value="index">{{ item }}</Option>
+      </Select>
+      <Select v-model="curIdIndex" style="width:250px;margin-right: 10px;" filterable clearable :placeholder="$t('log.searchId')" @on-clear="onIdClear">
+        <Option v-for="(item,index) in idArr" :value="index">{{ item }}</Option>
+      </Select>
+      <DatePicker type="daterange" split-panels :placeholder="$t('log.searchTime')" style="width: 250px;margin-right: 10px;" @on-change="onDateChange"></DatePicker>
+      <Button type="primary" @click="doSearch" style="margin-right: 10px">{{ $t('log.search') }}</Button>
+      <Button type="warning" @click="doExport">{{ $t('log.exportLog') }}</Button>
+    </div>
+    <div class="log-table-box">
+      <Table stripe :columns="columns" :data="tableData" :loading="tableLoading">
+        <template slot="action" slot-scope="{ row,index }">
+          <Button type="primary" size="small" @click="showDetails(row)">{{ $t('log.details') }}</Button>
+        </template>
+        <template slot="time" slot-scope="{ row,index }">
+          <span>{{ $tools.formatTime(row.time) }}</span>
+        </template>
+      </Table>
+      <Page show-total :current="currentPage" :total="filterResults.length" :page-size="pageSizes" :page-size-opts="pageSizeOpts" @on-change="pageChange" @on-page-size-change="pageSizeChange" show-sizer />
+    </div>
+
+    <Modal v-model="tipModal" footer-hide :transfer="false">
+      <p style="font-weight: bold;margin:20px;font-size:18px">{{ tipContent }}</p>
+    </Modal>
+  </div>
+</template>
+
+<script>
+import excel from '@/utils/excel.js'
+export default {
+  data(vm) {
+    return {
+      curNameIndex: -1,
+      curIdIndex: -1,
+      idArr: [],
+      nameArr: [],
+      tipModal: false,
+      tipContent: '',
+      tableLoading: false,
+      currentPage: 1,
+      pageSizes: 15,
+      pageSizeOpts: [10, 15, 20, 30],
+      originList: [],
+      filterResults: [],
+      searchVal: '',
+      columns: [
+        {
+          title: vm.$t('log.index'),
+          key: 'index',
+          width: 120,
+          align: 'center'
+        },
+        {
+          title: vm.$t('log.searchName'),
+          key: 'name',
+          align: 'center'
+        },
+        {
+          title: 'ID',
+          key: 'tmdId',
+          align: 'center'
+        },
+        {
+          title: vm.$t('log.platform'),
+          key: 'platform',
+          align: 'center'
+        },
+        {
+          title: vm.$t('log.type'),
+          key: 'type',
+          align: 'center'
+        },
+        {
+          title: vm.$t('log.time'),
+          slot: 'time',
+          align: 'center'
+        },
+        {
+          title: vm.$t('log.action'),
+          slot: 'action',
+          align: 'center'
+        }
+      ],
+      tableData: [],
+      dateRange: []
+    }
+  },
+  created() {
+    this.tableLoading = true
+    this.$api.notice.FindLog({
+      tmdId: ''
+    }).then(res => {
+      if (res.logs.length) {
+        res.logs = res.logs.sort((a, b) => b.time - a.time)
+      }
+      this.filterResults = this._.cloneDeep(res.logs)
+      this.originList = this._.cloneDeep(res.logs)
+      this.idArr = [...new Set(res.logs.map(i => i.tmdId))]
+      this.nameArr = [...new Set(res.logs.map(i => i.name))]
+      this.pageChange(1)
+    })
+  },
+  methods: {
+    onDateChange(val) {
+      console.log(val)
+      if (!val.length || val.length && val.some(i => i == '')) {
+        this.dateRange = []
+        return
+      }
+      let start = new Date(val[0] + ' 00:00:00').getTime()
+      let end = new Date(val[1] + ' 23:59:59').getTime()
+      this.dateRange = [start, end]
+    },
+    onNameClear() {
+      this.curNameIndex = -1
+      this.doSearch()
+    },
+    onIdClear() {
+      this.curIdIndex = -1
+      this.doSearch()
+    },
+    /* 查看详情 */
+    showDetails(row) {
+      let local = localStorage.getItem('local')
+      this.tipContent = local === 'zh-cn' ? row.msg : local === 'zh-tw' ? row.tmsg : row.emsg
+      if (this.tipContent) {
+        this.tipModal = true
+      } else {
+        this.$Message.warning(this.vm.$t('log.noMsgTip'))
+      }
+
+    },
+    doSearch() {
+      this.filterResults = this.originList.filter(i => {
+        return (this.curNameIndex > -1 ? i.name.includes(this.nameArr[this.curNameIndex]) : true)
+          && (this.curIdIndex > -1 ? i.tmdId === this.idArr[this.curIdIndex] : true)
+          && (this.dateRange.length ? i.time >= this.dateRange[0] && i.time <= this.dateRange[1] : true)
+      }).sort((a, b) => b.time - a.time)
+      this.pageChange(1)
+    },
+    doExport() {
+      let header = [this.$t('log.index'), this.$t('log.searchName'), this.$t('log.searchId'), this.$t('log.platform'), this.$t('log.type'), this.$t('log.time')]
+      let keys = ['index', 'name', 'tmdId', 'platform', 'type', 'time']
+      let datas = this._.cloneDeep(this.filterResults)
+      datas.forEach(i => i.time = this.$tools.formatTime(i.time))
+      const params = {
+        title: header,
+        key: keys,
+        data: datas,
+        autoWidth: true,
+        filename: this.$store.state.user.schoolProfile.school_base.name + this.$t('log.log')
+      }
+      excel.export_array_to_excel(params)
+    },
+    // 分页操作
+    pageChange(page) {
+      this.tableLoading = true
+      let start = this.pageSizes * (page - 1)
+      let end = this.pageSizes * page
+      this.currentPage = page
+      setTimeout(() => {
+        this.tableData = this.filterResults.slice(start, end)
+        this.tableData.forEach((i, index) => {
+          i.index = (page - 1) * this.pageSizes + index + 1
+        })
+        this.tableLoading = false
+      }, 300)
+    },
+
+    // 页码操作
+    pageSizeChange(val) {
+      this.pageSizes = val
+      this.pageChange(1)
+    },
+  }
+}
+</script>
+
+
+<style lang="less">
+.log-container {
+  padding: 15px;
+  height: 100%;
+  overflow: auto;
+
+  .ivu-page {
+    text-align: center;
+    margin-top: 20px;
+  }
+}
+
+.log-table-box {
+  margin-top: 15px;
+}
+</style>

+ 5 - 2
TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.less

@@ -8,7 +8,6 @@
 		background-color: #ffffff;
 		background-color: #ffffff;
 		align-items: center;
 		align-items: center;
 		padding: 20px 25px;
 		padding: 20px 25px;
-		padding-top: 40px;
 
 
 		.split-line {
 		.split-line {
 			width: 2px;
 			width: 2px;
@@ -23,7 +22,7 @@
 			flex-direction: column;
 			flex-direction: column;
 			align-items: center;
 			align-items: center;
 			justify-content: center;
 			justify-content: center;
-			padding: 0 20px;
+			// padding: 0 20px;
 
 
 			&:first-child {
 			&:first-child {
 				padding-left: 10px;
 				padding-left: 10px;
@@ -170,6 +169,10 @@
 	.table-box {
 	.table-box {
 		overflow: auto;
 		overflow: auto;
 
 
+		/deep/ .ivu-table-cell {
+			text-overflow: unset;
+		}
+
 		/deep/ th .ivu-table-cell {
 		/deep/ th .ivu-table-cell {
 			display: inline-flex;
 			display: inline-flex;
 			align-items: center;
 			align-items: center;

+ 50 - 4
TEAMModelOS/ClientApp/src/view/research-center/ResearchMgt.vue

@@ -158,11 +158,15 @@
         <Icon type="md-settings" />
         <Icon type="md-settings" />
         <span>{{ $t('lessonRecord.setting') }}</span>
         <span>{{ $t('lessonRecord.setting') }}</span>
       </div>
       </div>
+      <div class="tool-item" @click="doBatchDelete" v-if="batchDelArr.length">
+        <Icon type="md-trash" color="red" />
+        <span>批量删除</span>
+      </div>
     </div>
     </div>
     <!-- 表格区域 -->
     <!-- 表格区域 -->
     <div class="table-box">
     <div class="table-box">
       <Scroll :on-reach-bottom="getMore" :distance-to-edge="[-2,-2]" :height="tableHeight">
       <Scroll :on-reach-bottom="getMore" :distance-to-edge="[-2,-2]" :height="tableHeight">
-        <Table stripe :columns="tableColumnNew" :data="tableData" :height="tableHeight" :loading="tableLoading" @on-sort-change='changeSort' ref="tableRef">
+        <Table stripe :columns="tableColumnNew" :data="tableData" :height="tableHeight" :loading="tableLoading" @on-sort-change='changeSort' @on-selection-change="onTableSelectChange" ref="tableRef">
           <template slot-scope="{ row,index }" slot="name">
           <template slot-scope="{ row,index }" slot="name">
             <div style="padding: 10px 0;">
             <div style="padding: 10px 0;">
               <div style="font-weight: bold;font-size: 16px;display:flex;align-items: center">
               <div style="font-weight: bold;font-size: 16px;display:flex;align-items: center">
@@ -172,16 +176,18 @@
                   <!-- <Tag color="red" v-if="row.status === 404">{{ $t('lessonRecord.cleaned') }}</Tag> -->
                   <!-- <Tag color="red" v-if="row.status === 404">{{ $t('lessonRecord.cleaned') }}</Tag> -->
                 </span>
                 </span>
               </div>
               </div>
-              <div class="info-tags" style="margin:5px 0;">
+              <div class="info-tags" style="margin:2px 0;">
                 <Tag color="primary">{{ row.tmdname }}</Tag>
                 <Tag color="primary">{{ row.tmdname }}</Tag>
                 <Tag color="green">{{ curPeriod.subjects.find(j => j.id === row.subjectId).name }}</Tag>
                 <Tag color="green">{{ curPeriod.subjects.find(j => j.id === row.subjectId).name }}</Tag>
                 <Tag color="cyan">{{ row.grade.map(i => curPeriod.grades[+i]).join(',') }}</Tag>
                 <Tag color="cyan">{{ row.grade.map(i => curPeriod.grades[+i]).join(',') }}</Tag>
                 <Tag color="blue">{{ row.groupNames.join('/') }}</Tag>
                 <Tag color="blue">{{ row.groupNames.join('/') }}</Tag>
-              </div>
-              <div>
                 <Tag color="orange" v-if="row.category && row.category.length">{{ row.category.join(',') }}</Tag>
                 <Tag color="orange" v-if="row.category && row.category.length">{{ row.category.join(',') }}</Tag>
                 <Tag color="#FFA2D3" v-if="row.favorite > 0">{{ $t('lessonRecord.favorite') }}</Tag>
                 <Tag color="#FFA2D3" v-if="row.favorite > 0">{{ $t('lessonRecord.favorite') }}</Tag>
               </div>
               </div>
+              <!-- <div>
+                <Tag color="orange" v-if="row.category && row.category.length">{{ row.category.join(',') }}</Tag>
+                <Tag color="#FFA2D3" v-if="row.favorite > 0">{{ $t('lessonRecord.favorite') }}</Tag>
+              </div> -->
             </div>
             </div>
           </template>
           </template>
           <!-- 科技手段分数 -->
           <!-- 科技手段分数 -->
@@ -341,6 +347,7 @@ export default {
   },
   },
   data(vm) {
   data(vm) {
     return {
     return {
+      batchDelArr: [],
       classTotalCount: 0,
       classTotalCount: 0,
       filterClassIds: [],
       filterClassIds: [],
       classArr: [],
       classArr: [],
@@ -479,6 +486,10 @@ export default {
       subjectList: [],
       subjectList: [],
       tableData: [],
       tableData: [],
       tableColumnNew: [
       tableColumnNew: [
+        {
+          type: 'selection',
+          width: 40,
+        },
         {
         {
           title: vm.$t('lessonRecord.lessonInfo'),
           title: vm.$t('lessonRecord.lessonInfo'),
           slot: 'name',
           slot: 'name',
@@ -677,6 +688,35 @@ export default {
     onClickAdFilter() {
     onClickAdFilter() {
       this.hideAdFilter = !this.hideAdFilter
       this.hideAdFilter = !this.hideAdFilter
     },
     },
+    onTableSelectChange(val) {
+      this.batchDelArr = val
+      console.log(val)
+    },
+    doBatchDelete() {
+      if (this.batchDelArr.length) {
+        this.$Modal.confirm({
+          title: this.$t('evaluation.newExercise.modalTip'),
+          content: `确认删除【${this.batchDelArr[0].name}】等${this.batchDelArr.length}个课堂记录吗?`,
+          onOk: () => {
+            this.$api.lessonRecord.delRcd({
+              "scope": 'school',
+              "delete_id": this.batchDelArr.map(i => i.id),
+              "opt": "delete",
+              "school": this.$store.state.userInfo.schoolCode
+            }).then(res => {
+              if (!res.error) {
+                this.$Message.success(this.$t('lessonRecord.delSuc'))
+                this.doFilter()
+                this.getAnalysisCount()
+              }
+            })
+          },
+          onCancel: () => {
+
+          }
+        })
+      }
+    },
     changeSort(val) {
     changeSort(val) {
       console.log(val)
       console.log(val)
       if (val.order === 'desc') {
       if (val.order === 'desc') {
@@ -1041,6 +1081,11 @@ export default {
           if (!res.error && res.lessonRecords) {
           if (!res.error && res.lessonRecords) {
             let schoolSas = await this.$tools.getSchoolSas()
             let schoolSas = await this.$tools.getSchoolSas()
             this.tableData = this.tableData.concat(this.getFullInfo(res.lessonRecords, schoolSas))
             this.tableData = this.tableData.concat(this.getFullInfo(res.lessonRecords, schoolSas))
+            this.tableData.forEach(i => {
+              if (this.batchDelArr.map(j => j.id).includes(i.id)) {
+                i._checked = true
+              }
+            })
             this.continuationToken = res.continuationToken
             this.continuationToken = res.continuationToken
           }
           }
         })
         })
@@ -1147,6 +1192,7 @@ export default {
             if (!res.error) {
             if (!res.error) {
               this.$Message.success(this.$t('lessonRecord.delSuc'))
               this.$Message.success(this.$t('lessonRecord.delSuc'))
               this.doFilter()
               this.doFilter()
+              this.getAnalysisCount()
             }
             }
           })
           })
         },
         },

+ 1 - 1
TEAMModelOS/Controllers/Both/LessonRecordController.cs

@@ -218,7 +218,7 @@ namespace TEAMModelOS.Controllers
             string tbname;
             string tbname;
             string code;
             string code;
             if (request.TryGetProperty("delete_id", out JsonElement _delete_id) && !string.IsNullOrEmpty($"{_delete_id}")
             if (request.TryGetProperty("delete_id", out JsonElement _delete_id) && !string.IsNullOrEmpty($"{_delete_id}")
-                            && request.TryGetProperty("tmdid", out JsonElement _dtmdid) && !string.IsNullOrEmpty($"{_dtmdid}")
+                           // && request.TryGetProperty("tmdid", out JsonElement _dtmdid) && !string.IsNullOrEmpty($"{_dtmdid}")
                             && request.TryGetProperty("scope", out JsonElement _dscope) && !string.IsNullOrEmpty($"{_dscope}")
                             && request.TryGetProperty("scope", out JsonElement _dscope) && !string.IsNullOrEmpty($"{_dscope}")
                             && request.TryGetProperty("opt", out JsonElement _opt) && !string.IsNullOrEmpty($"{_opt}"))
                             && request.TryGetProperty("opt", out JsonElement _opt) && !string.IsNullOrEmpty($"{_opt}"))
             {
             {

+ 3 - 3
TEAMModelOS/Controllers/Client/AClassONEController.cs

@@ -42,7 +42,7 @@ namespace TEAMModelOS.Controllers
     [ApiController]
     [ApiController]
     public class AClassONEController : ControllerBase
     public class AClassONEController : ControllerBase
     {
     {
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureCosmosFactory _azureCosmos;
         private readonly AzureCosmosFactory _azureCosmos;
@@ -56,7 +56,7 @@ namespace TEAMModelOS.Controllers
             AzureCosmosFactory azureCosmos,
             AzureCosmosFactory azureCosmos,
             DingDing dingDing,
             DingDing dingDing,
             SnowflakeId snowflakeId,
             SnowflakeId snowflakeId,
-            IOptionsSnapshot<Option> option, HttpClient httpClient, IConfiguration configuration)
+            IOptionsSnapshot<Option> option, IHttpClientFactory httpClient, IConfiguration configuration)
         {
         {
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
@@ -96,7 +96,7 @@ namespace TEAMModelOS.Controllers
             //return Ok(new { token = new { token.TokenType,token.AccessToken } });
             //return Ok(new { token = new { token.TokenType,token.AccessToken } });
             if (!json.TryGetProperty("js_code", out JsonElement js_code)) return BadRequest("js_code is null");
             if (!json.TryGetProperty("js_code", out JsonElement js_code)) return BadRequest("js_code is null");
             string url = $"https://api.weixin.qq.com/sns/jscode2session?appid={wxappid}&secret={wxsecret}&js_code={js_code}&grant_type=authorization_code";
             string url = $"https://api.weixin.qq.com/sns/jscode2session?appid={wxappid}&secret={wxsecret}&js_code={js_code}&grant_type=authorization_code";
-            HttpResponseMessage responseMessage = await _httpClient.GetAsync(url);
+            HttpResponseMessage responseMessage = await _httpClient.CreateClient().GetAsync(url);
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {
                 JsonDocument document = JsonDocument.Parse(responseMessage.Content.ReadAsStream());
                 JsonDocument document = JsonDocument.Parse(responseMessage.Content.ReadAsStream());

+ 2 - 3
TEAMModelOS/Controllers/Common/CommonController.cs

@@ -35,7 +35,7 @@ namespace TEAMModelOS.Controllers.Common
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly Option _option;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
-        private readonly IHttpClientFactory _clientFactory;
+        private readonly IHttpClientFactory _httpClient;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         public CommonController(CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, IHttpClientFactory clientFactory)
         public CommonController(CoreAPIHttpService coreAPIHttpService, AzureCosmosFactory azureCosmos, AzureServiceBusFactory serviceBus, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage, IHttpClientFactory clientFactory)
         {
         {
@@ -45,7 +45,7 @@ namespace TEAMModelOS.Controllers.Common
             _dingDing = dingDing;
             _dingDing = dingDing;
             _option = option?.Value;
             _option = option?.Value;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
-            _clientFactory = clientFactory;
+            _httpClient = clientFactory;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
         }
         }
 
 
@@ -172,7 +172,6 @@ namespace TEAMModelOS.Controllers.Common
                     }
                     }
                 }
                 }
                 await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<Dictionary<string, object>>(dy, dy["id"].ToString(), new Azure.Cosmos.PartitionKey(dy["code"].ToString()));
                 await client.GetContainer(Constant.TEAMModelOS, "Common").ReplaceItemAsync<Dictionary<string, object>>(dy, dy["id"].ToString(), new Azure.Cosmos.PartitionKey(dy["code"].ToString()));
-                var httpClient = _clientFactory.CreateClient();
                 var content = new { id = $"{id}", code = $"{code}" };
                 var content = new { id = $"{id}", code = $"{code}" };
                 await ActivityService.RefreshStuActivity(_coreAPIHttpService, client, _dingDing, $"{id}", $"{code}");
                 await ActivityService.RefreshStuActivity(_coreAPIHttpService, client, _dingDing, $"{id}", $"{code}");
                 return Ok(new { code=200, isScore });
                 return Ok(new { code=200, isScore });

+ 1 - 3
TEAMModelOS/Controllers/Normal/AbilitySubController.cs

@@ -35,20 +35,18 @@ namespace TEAMModelOS.Controllers
         private readonly SnowflakeId _snowflakeId;
         private readonly SnowflakeId _snowflakeId;
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly Option _option;
-        private readonly ThirdApisService _thirdApisService;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly ScsStudyApisService _scsStudyApisService;
         private readonly ScsStudyApisService _scsStudyApisService;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
-        public AbilitySubController(ScsStudyApisService scsStudyApisService, CoreAPIHttpService coreAPIHttpService, AzureStorageFactory azureStorage,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, ThirdApisService thirdApisService, HttpTrigger httpTrigge, AzureServiceBusFactory serviceBus, IConfiguration configuration)
+        public AbilitySubController(ScsStudyApisService scsStudyApisService, CoreAPIHttpService coreAPIHttpService, AzureStorageFactory azureStorage,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option,   HttpTrigger httpTrigge, AzureServiceBusFactory serviceBus, IConfiguration configuration)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
             _dingDing = dingDing;
             _dingDing = dingDing;
             _option = option?.Value;
             _option = option?.Value;
-            _thirdApisService = thirdApisService;
             _httpTrigger = httpTrigge;
             _httpTrigger = httpTrigge;
             _serviceBus = serviceBus;
             _serviceBus = serviceBus;
             _configuration = configuration;
             _configuration = configuration;

+ 2 - 2
TEAMModelOS/Controllers/OpenApi/IRS/TianboController.cs

@@ -34,8 +34,8 @@ namespace TEAMModelOS.Controllers
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly NotificationService _notificationService;
         private readonly NotificationService _notificationService;
-        private readonly HttpClient _httpClient;
-        public TianboController(CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureSignalRFactory azureSignalR, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, HttpClient httpClient)
+        private readonly IHttpClientFactory _httpClient;
+        public TianboController(CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureSignalRFactory azureSignalR, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;

+ 14 - 11
TEAMModelOS/Controllers/School/SchoolController.cs

@@ -53,10 +53,10 @@ namespace TEAMModelOS.Controllers
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly NotificationService _notificationService;
         private readonly NotificationService _notificationService;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
-        public SchoolController(IWebHostEnvironment environment,HttpTrigger httpTrigger,CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, HttpClient httpClient)
+        public SchoolController(IWebHostEnvironment environment,HttpTrigger httpTrigger,CoreAPIHttpService coreAPIHttpService, NotificationService notificationService, AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, IHttpClientFactory httpClient)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
@@ -633,10 +633,11 @@ namespace TEAMModelOS.Controllers
             {
             {
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreService:deviceinfo");
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreService:deviceinfo");
                 string AccessToken = await getCoreAccessToken();
                 string AccessToken = await getCoreAccessToken();
-                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
+                var client = _httpClient.CreateClient();
+                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
                 string uuidListJson = JsonConvert.SerializeObject(uuidList);
                 string uuidListJson = JsonConvert.SerializeObject(uuidList);
                 var content = new StringContent(uuidListJson, Encoding.UTF8, "application/json");
                 var content = new StringContent(uuidListJson, Encoding.UTF8, "application/json");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, content);
+                HttpResponseMessage responseMessage = await client.PostAsync(url, content);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
@@ -662,10 +663,11 @@ namespace TEAMModelOS.Controllers
             {
             {
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/ies5/get-school-order";
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/ies5/get-school-order";
                 string AccessToken = await getCoreAccessToken();
                 string AccessToken = await getCoreAccessToken();
-                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
+                var client = _httpClient.CreateClient();
+                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
                 string paramJson = JsonConvert.SerializeObject(new { school_code = schoolCode });
                 string paramJson = JsonConvert.SerializeObject(new { school_code = schoolCode });
                 var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
                 var content = new StringContent(paramJson, Encoding.UTF8, "application/json");
-                HttpResponseMessage responseMessage = await _httpClient.PostAsync(url, content);
+                HttpResponseMessage responseMessage = await client.PostAsync(url, content);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
                     string responseBody = responseMessage.Content.ReadAsStringAsync().Result;
@@ -689,7 +691,7 @@ namespace TEAMModelOS.Controllers
                 string ClientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
                 string ClientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
                 string Secret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                 string Secret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                 var content = new { grant_type = GrantType, client_id = ClientID, client_secret = Secret };
                 var content = new { grant_type = GrantType, client_id = ClientID, client_secret = Secret };
-                var response = await _httpClient.PostAsJsonAsync($"{Url}", content);
+                var response = await _httpClient.CreateClient().PostAsJsonAsync($"{Url}", content);
                 if (response.IsSuccessStatusCode)
                 if (response.IsSuccessStatusCode)
                 {
                 {
                     string responseBody = response.Content.ReadAsStringAsync().Result;
                     string responseBody = response.Content.ReadAsStringAsync().Result;
@@ -822,8 +824,9 @@ namespace TEAMModelOS.Controllers
                 bool unbindFlg = false; //解綁是否成功 true:成功 false:失敗
                 bool unbindFlg = false; //解綁是否成功 true:成功 false:失敗
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/bbauthapi/srunbind";
                 string url = _configuration.GetValue<string>("HaBookAuth:CoreBBAPI") + "/bbauthapi/srunbind";
                 string AccessToken = await getCoreAccessToken();
                 string AccessToken = await getCoreAccessToken();
-                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
-                HttpResponseMessage response = await _httpClient.PostAsJsonAsync(url, content);
+                var client = _httpClient.CreateClient();
+                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken);
+                HttpResponseMessage response = await client.PostAsJsonAsync(url, content);
                 if (response.StatusCode == HttpStatusCode.OK)
                 if (response.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string responseBody = await response.Content.ReadAsStringAsync();
                     string responseBody = await response.Content.ReadAsStringAsync();
@@ -1444,7 +1447,7 @@ namespace TEAMModelOS.Controllers
                                     {
                                     {
                                         _coreAPIHttpService.PushNotify(nameCodes, "teacher_space-change", Constant.NotifyType_IES5_Management,
                                         _coreAPIHttpService.PushNotify(nameCodes, "teacher_space-change", Constant.NotifyType_IES5_Management,
                                        new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.id }, { "schoolName", schoolData.name }, { "bsize", bsize }, { "asize", asize } }
                                        new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.id }, { "schoolName", schoolData.name }, { "bsize", bsize }, { "asize", asize } }
-                                         , _option.Location, _configuration, _dingDing, "");
+                                         , _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                                     }
                                     }
                                 }
                                 }
                             }
                             }
@@ -1496,7 +1499,7 @@ namespace TEAMModelOS.Controllers
                                         var schoolData = teacherHimself.schools.Find(z => z.schoolId.Equals($"{school_code}"));
                                         var schoolData = teacherHimself.schools.Find(z => z.schoolId.Equals($"{school_code}"));
                                         _coreAPIHttpService.PushNotify(nameCodes, "teacher_space-retract", Constant.NotifyType_IES5_Management,
                                         _coreAPIHttpService.PushNotify(nameCodes, "teacher_space-retract", Constant.NotifyType_IES5_Management,
                                         new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.id }, { "schoolName", schoolData.name } }
                                         new Dictionary<string, object> { { "tmdname", teacher.name }, { "tmdid", teacher.id }, { "schoolName", schoolData.name } }
-                                          , _option.Location, _configuration, _dingDing, "");
+                                          , _option.Location, _configuration, _dingDing, _environment.ContentRootPath);
                                     }
                                     }
                                     else
                                     else
                                     {
                                     {

+ 3 - 3
TEAMModelOS/Controllers/System/CoreController.cs

@@ -45,23 +45,23 @@ namespace TEAMModelOS.Controllers
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly DingDing _dingDing;
         private readonly DingDing _dingDing;
         private readonly Option _option;
         private readonly Option _option;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClientFactory;
         private readonly IPSearcher _searcher;
         private readonly IPSearcher _searcher;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly SnowflakeId _snowflakeId;
         private readonly SnowflakeId _snowflakeId;
-        public CoreController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId,CoreAPIHttpService coreAPIHttpService,IConfiguration configuration,IPSearcher searcher, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, HttpClient httpClient)
+        public CoreController(IHttpClientFactory httpClientFactory,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId,CoreAPIHttpService coreAPIHttpService,IConfiguration configuration,IPSearcher searcher, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _searcher = searcher;
             _searcher = searcher;
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _dingDing = dingDing;
             _dingDing = dingDing;
             _option = option?.Value;
             _option = option?.Value;
-            _httpClient = httpClient;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _configuration = configuration;
             _configuration = configuration;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
+            _httpClientFactory = httpClientFactory;
         }
         }
 
 
         public class NotifyData {
         public class NotifyData {

+ 15 - 4
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -33,6 +33,7 @@ using Microsoft.Azure.Cosmos.Table;
 using TEAMModelOS.SDK.DI.CoreAPI;
 using TEAMModelOS.SDK.DI.CoreAPI;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using DocumentFormat.OpenXml.Office2010.Excel;
 using DocumentFormat.OpenXml.Office2010.Excel;
+using DocumentFormat.OpenXml.Drawing.Charts;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers
 {
 {
@@ -294,6 +295,7 @@ namespace TEAMModelOS.Controllers
                         {
                         {
                             return BadRequest(new { status = -1, msg = "参数异常!" });
                             return BadRequest(new { status = -1, msg = "参数异常!" });
                         }
                         }
+                        //修改教师其他信息。
                     case bool when $"{_opt}".Equals("UpdateMoreInfo", StringComparison.OrdinalIgnoreCase) && (request.TryGetProperty("teacherInfo", out JsonElement _teacherInfo)):
                     case bool when $"{_opt}".Equals("UpdateMoreInfo", StringComparison.OrdinalIgnoreCase) && (request.TryGetProperty("teacherInfo", out JsonElement _teacherInfo)):
                         var techinfo = _teacherInfo.Deserialize<UpdateTeacherInfo>();
                         var techinfo = _teacherInfo.Deserialize<UpdateTeacherInfo>();
                         TeacherImport teacherImport = null;
                         TeacherImport teacherImport = null;
@@ -302,8 +304,9 @@ namespace TEAMModelOS.Controllers
                             try
                             try
                             {
                             {
                                 SchoolTeacher schoolTeacher = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(techinfo.id, new PartitionKey($"Teacher-{school}"));
                                 SchoolTeacher schoolTeacher = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<SchoolTeacher>(techinfo.id, new PartitionKey($"Teacher-{school}"));
-                                schoolTeacher.subjectIds = techinfo.subjectIds;
-                                schoolTeacher.job = techinfo.job;
+                                schoolTeacher.subjectIds =techinfo.subjectIds!=null  ? techinfo.subjectIds : schoolTeacher.subjectIds;
+                                schoolTeacher.job = techinfo.job!=null ? techinfo.job : schoolTeacher.job;
+                                schoolTeacher.periodId = techinfo.periodId!=null ? techinfo.periodId : schoolTeacher.periodId;
                                 await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(schoolTeacher, techinfo.id, new PartitionKey($"Teacher-{school}"));
                                 await client.GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync<SchoolTeacher>(schoolTeacher, techinfo.id, new PartitionKey($"Teacher-{school}"));
                                 Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school}", new PartitionKey("TeacherImport"));
                                 Azure.Response response = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReadItemStreamAsync($"{school}", new PartitionKey("TeacherImport"));
                                 if (response.Status == 200)
                                 if (response.Status == 200)
@@ -330,8 +333,8 @@ namespace TEAMModelOS.Controllers
                                         teacherImportInfo.picture = schoolTeacher.picture;
                                         teacherImportInfo.picture = schoolTeacher.picture;
                                         teacherImportInfo.status = schoolTeacher.status;
                                         teacherImportInfo.status = schoolTeacher.status;
                                         teacherImportInfo.name = schoolTeacher.name;
                                         teacherImportInfo.name = schoolTeacher.name;
-                                        teacherImportInfo.iname=techinfo.iname;
-                                        teacherImportInfo.note = techinfo.note;
+                                        teacherImportInfo.iname= techinfo.iname !=null ? techinfo.iname:teacherImportInfo.iname;
+                                        teacherImportInfo.note = techinfo.note != null ? techinfo.note : teacherImportInfo.note;
                                     }
                                     }
                                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school}", new PartitionKey("TeacherImport"));
                                     await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(teacherImport, $"{school}", new PartitionKey("TeacherImport"));
                                 }
                                 }
@@ -373,6 +376,7 @@ namespace TEAMModelOS.Controllers
         public class UpdateTeacherInfo { 
         public class UpdateTeacherInfo { 
             public string id { get; set; }
             public string id { get; set; }
             public string iname  { get; set; }
             public string iname  { get; set; }
+            public string periodId { get; set; }
             public List<string> subjectIds { get; set; } = new List<string>();
             public List<string> subjectIds { get; set; } = new List<string>();
             public string job { get; set; }
             public string job { get; set; }
             public string note { get; set; }
             public string note { get; set; }
@@ -462,6 +466,7 @@ namespace TEAMModelOS.Controllers
                     teacherInfo.blob_sas,
                     teacherInfo.blob_sas,
                     teacherInfo.schools,
                     teacherInfo.schools,
                     teacherInfo.defaultschool,
                     teacherInfo.defaultschool,
+                    teacherInfo.defaultschoolPeriod,
                     teacherInfo.courses,
                     teacherInfo.courses,
                     teacherInfo.total,
                     teacherInfo.total,
                     teacherInfo.osblob_uri,
                     teacherInfo.osblob_uri,
@@ -583,6 +588,7 @@ namespace TEAMModelOS.Controllers
                     teacher = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                     teacher = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReplaceItemAsync<Teacher>(teacher, id, new PartitionKey("Base"));
                 }
                 }
                 var response = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id, new PartitionKey($"Teacher-{school_code}"));
                 var response = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(id, new PartitionKey($"Teacher-{school_code}"));
+                string defaultPeriodId = "";
                 if (response.Status == 200)
                 if (response.Status == 200)
                 {
                 {
                     using var json = await JsonDocument.ParseAsync(response.ContentStream);
                     using var json = await JsonDocument.ParseAsync(response.ContentStream);
@@ -590,6 +596,10 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         size = _size.GetInt32();
                         size = _size.GetInt32();
                     }
                     }
+                    if (json.RootElement.TryGetProperty("periodId", out JsonElement _periodId))
+                    {
+                        defaultPeriodId =$"{_periodId}";
+                    }
                     if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
                     if (json.RootElement.TryGetProperty("roles", out JsonElement _roles) && _roles.ValueKind != JsonValueKind.Null)
                     {
                     {
                         foreach (var obj in _roles.EnumerateArray())
                         foreach (var obj in _roles.EnumerateArray())
@@ -840,6 +850,7 @@ namespace TEAMModelOS.Controllers
                     currArea,
                     currArea,
                     lessonLimit,
                     lessonLimit,
                     teacher.lessonShow,
                     teacher.lessonShow,
+                    defaultPeriodId,
                     productSum = new
                     productSum = new
                     {
                     {
                         //serial = serials,
                         //serial = serials,

+ 1 - 3
TEAMModelOS/Controllers/Third/DingDingController.cs

@@ -55,7 +55,6 @@ namespace TEAMModelOS.Controllers.Third
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly ThirdApisService _scsApisService;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
         /// <summary>
         /// <summary>
@@ -76,7 +75,7 @@ namespace TEAMModelOS.Controllers.Third
         public string _sc_url;
         public string _sc_url;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         public DingDingController(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
         public DingDingController(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService,   HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -87,7 +86,6 @@ namespace TEAMModelOS.Controllers.Third
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
         }
         }

+ 1 - 3
TEAMModelOS/Controllers/Third/OAuth2Controller.cs

@@ -59,7 +59,6 @@ namespace TEAMModelOS.Controllers.Third
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly ThirdApisService _scsApisService;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
         /// <summary>
         /// <summary>
@@ -80,7 +79,7 @@ namespace TEAMModelOS.Controllers.Third
         public string _sc_url;
         public string _sc_url;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         public OAuth2Controller(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
         public OAuth2Controller(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -91,7 +90,6 @@ namespace TEAMModelOS.Controllers.Third
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
         }
         }

+ 31 - 31
TEAMModelOS/Controllers/Third/Sc/ScApiController.cs

@@ -29,6 +29,7 @@ using System.Web;
 using static TEAMModelOS.Controllers.FixDataController;
 using static TEAMModelOS.Controllers.FixDataController;
 using System.Collections;
 using System.Collections;
 using FastJSON;
 using FastJSON;
+using System.Net.Http;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers
 {
 {
@@ -54,13 +55,13 @@ namespace TEAMModelOS.Controllers
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _accountHttpService;
         private readonly CoreAPIHttpService _accountHttpService;
-        private readonly ThirdApisService _scsApisService;
+        private readonly IHttpClientFactory _httpClient;
         public readonly string type = "scsyxpt";
         public readonly string type = "scsyxpt";
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
          private List<ScComConfig> scsyxptConfigs { get; set; }
          private List<ScComConfig> scsyxptConfigs { get; set; }
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
-        public ScApiController(AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-         AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService accountHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+        public ScApiController(IHttpClientFactory httpClient,AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+         AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService accountHttpService, HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -71,9 +72,8 @@ namespace TEAMModelOS.Controllers
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _accountHttpService = accountHttpService;
             _accountHttpService = accountHttpService;
-            _scsApisService = scsApisService;
-           
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
+            _httpClient= httpClient;
         }
         }
         /// <summary>
         /// <summary>
         ///
         ///
@@ -93,7 +93,7 @@ namespace TEAMModelOS.Controllers
                 { "ProjectItemID", "1249" }
                 { "ProjectItemID", "1249" }
             };
             };
             var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
             var table = _azureStorage.GetCloudTableClient().GetTableReference("ScYxpt");
-            ScsResult GetSchoolList1 = await _scsApisService.Post("https://scts.scedu.com.cn/webservice/EduService.asmx/RequestService", Code, "MSmZQnjvySxwB8KZ", "CA00580BB7BFA3817334CFA38257AC9A", parameterMap);
+            ScsResult GetSchoolList1 = await ThirdApisService.Post(_httpClient,"https://scts.scedu.com.cn/webservice/EduService.asmx/RequestService", Code, "MSmZQnjvySxwB8KZ", "CA00580BB7BFA3817334CFA38257AC9A", parameterMap);
             GetSchoolList1.bizcode = Code;
             GetSchoolList1.bizcode = Code;
             GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
             GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
             List<ScSchool>  schools = GetSchoolList1.content.ToObject<List<ScSchool>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
             List<ScSchool>  schools = GetSchoolList1.content.ToObject<List<ScSchool>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
@@ -129,7 +129,7 @@ namespace TEAMModelOS.Controllers
             string Code = "GetProjectInfoByTrainComID";
             string Code = "GetProjectInfoByTrainComID";
             Dictionary<string, object> parameterMap = new Dictionary<string, object>();
             Dictionary<string, object> parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", scsyxptConfig.trainComID);
             parameterMap.Add("TrainComID", scsyxptConfig.trainComID);
-            ScsResult GetProjectInfoByTrainComID = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetProjectInfoByTrainComID = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetProjectInfoByTrainComID.bizcode = Code;
             GetProjectInfoByTrainComID.bizcode = Code;
             GetProjectInfoByTrainComID.title = "5.3.1.1获取项目列表";
             GetProjectInfoByTrainComID.title = "5.3.1.1获取项目列表";
 
 
@@ -142,7 +142,7 @@ namespace TEAMModelOS.Controllers
                 { "ProjectID", "92" },
                 { "ProjectID", "92" },
                 { "ProjectItemID", "1131" }
                 { "ProjectItemID", "1131" }
             };
             };
-            ScsResult GetSchoolList1 = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetSchoolList1 = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetSchoolList1.bizcode = Code;
             GetSchoolList1.bizcode = Code;
             GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
             GetSchoolList1.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
 
 
@@ -154,7 +154,7 @@ namespace TEAMModelOS.Controllers
                 { "ProjectID", "82" },
                 { "ProjectID", "82" },
                 { "ProjectItemID", "1086" }
                 { "ProjectItemID", "1086" }
             };
             };
-            ScsResult GetProjectDiagnosis = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetProjectDiagnosis = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetProjectDiagnosis.bizcode = Code;
             GetProjectDiagnosis.bizcode = Code;
             GetProjectDiagnosis.title = "5.3.1.19获取项目设置的可选能力点";
             GetProjectDiagnosis.title = "5.3.1.19获取项目设置的可选能力点";
             // 补充
             // 补充
@@ -167,7 +167,7 @@ namespace TEAMModelOS.Controllers
                 //parameterMap.Add("ProjectItemID", "22");
                 //parameterMap.Add("ProjectItemID", "22");
                 { "PXID", "242849" }
                 { "PXID", "242849" }
             };
             };
-            ScsResult GetDiagnosisListByProject_V2 = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetDiagnosisListByProject_V2 = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetDiagnosisListByProject_V2.bizcode = Code;
             GetDiagnosisListByProject_V2.bizcode = Code;
             GetDiagnosisListByProject_V2.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
             GetDiagnosisListByProject_V2.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
 
 
@@ -180,7 +180,7 @@ namespace TEAMModelOS.Controllers
                 { "ProjectID", "82" },
                 { "ProjectID", "82" },
                 { "ProjectItemID", "1086" }
                 { "ProjectItemID", "1086" }
             };
             };
-            ScsResult GetTeachersListByProject = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetTeachersListByProject = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetTeachersListByProject.bizcode = Code;
             GetTeachersListByProject.bizcode = Code;
 
 
 
 
@@ -192,7 +192,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("Pxid", "254175");
             parameterMap.Add("Pxid", "254175");
             parameterMap.Add("Tid", "422152");
             parameterMap.Add("Tid", "422152");
-            ScsResult GetSingleTeacherByProject = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetSingleTeacherByProject = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetSingleTeacherByProject.bizcode = Code;
             GetSingleTeacherByProject.bizcode = Code;
             GetSingleTeacherByProject.title = "5.3.1.11获取跳转学员信息";
             GetSingleTeacherByProject.title = "5.3.1.11获取跳转学员信息";
 
 
@@ -208,7 +208,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectItemID", "24");
             parameterMap.Add("ProjectItemID", "24");
             parameterMap.Add("PXID", "65321");
             parameterMap.Add("PXID", "65321");
-            ScsResult GetDiagnosisListByProject = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetDiagnosisListByProject = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetDiagnosisListByProject.bizcode = Code;
             GetDiagnosisListByProject.bizcode = Code;
             GetDiagnosisListByProject.title = "5.3.1.3通过项目编号获取学员测评能力项";
             GetDiagnosisListByProject.title = "5.3.1.3通过项目编号获取学员测评能力项";
 
 
@@ -221,7 +221,7 @@ namespace TEAMModelOS.Controllers
             //parameterMap.Add("ProjectID", "22");
             //parameterMap.Add("ProjectID", "22");
             //parameterMap.Add("ProjectItemID", "22");
             //parameterMap.Add("ProjectItemID", "22");
             parameterMap.Add("PXID", "244188");
             parameterMap.Add("PXID", "244188");
-            ScsResult GetDiagnosisListByProject_V2T = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetDiagnosisListByProject_V2T = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetDiagnosisListByProject_V2T.bizcode = Code;
             GetDiagnosisListByProject_V2T.bizcode = Code;
             GetDiagnosisListByProject_V2T.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
             GetDiagnosisListByProject_V2T.title = "5.3.1.3通过项目编号获取学员测评能力项V2";
 
 
@@ -238,7 +238,7 @@ namespace TEAMModelOS.Controllers
                 parameterMap.Add("CourseHour", "50");
                 parameterMap.Add("CourseHour", "50");
                 parameterMap.Add("ResearchText", "");//学习成果描述,字符长度<=300
                 parameterMap.Add("ResearchText", "");//学习成果描述,字符长度<=300
                 parameterMap.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
                 parameterMap.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
-                UpdateTeacherSituation = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+                UpdateTeacherSituation = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
                 UpdateTeacherSituation.bizcode = Code;
                 UpdateTeacherSituation.bizcode = Code;
                 UpdateTeacherSituation.title = "5.3.1.4学员培训基本情况回写";
                 UpdateTeacherSituation.title = "5.3.1.4学员培训基本情况回写";
             }
             }
@@ -266,7 +266,7 @@ namespace TEAMModelOS.Controllers
                 pfileMapA.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 pfileMapA.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 pfileMapA.Add("fileType", "pdf");
                 pfileMapA.Add("fileType", "pdf");
                 pfilesA.Add(pfileMapA);
                 pfilesA.Add(pfileMapA);
-                UpdateTeacherDiagnosis = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+                UpdateTeacherDiagnosis = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
                 UpdateTeacherDiagnosis.bizcode = Code;
                 UpdateTeacherDiagnosis.bizcode = Code;
                 UpdateTeacherDiagnosis.title = "5.3.1.5学员能力点测评结果回写";
                 UpdateTeacherDiagnosis.title = "5.3.1.5学员能力点测评结果回写";
             }
             }
@@ -279,7 +279,7 @@ namespace TEAMModelOS.Controllers
             Code = "GetDiagnosisDic";
             Code = "GetDiagnosisDic";
             parameterMap = new Dictionary<string, object>();
             parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
-            ScsResult GetDiagnosisDic = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetDiagnosisDic = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetDiagnosisDic.bizcode = Code;
             GetDiagnosisDic.bizcode = Code;
             GetDiagnosisDic.title = "5.3.1.6获取能力测评体系字典值数据";
             GetDiagnosisDic.title = "5.3.1.6获取能力测评体系字典值数据";
 
 
@@ -289,7 +289,7 @@ namespace TEAMModelOS.Controllers
             parameterMap = new Dictionary<string, object>();
             parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("DiagnosisDicID", "3");
             parameterMap.Add("DiagnosisDicID", "3");
-            ScsResult GetDiagnosisItemDic = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetDiagnosisItemDic = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetDiagnosisItemDic.bizcode = Code;
             GetDiagnosisItemDic.bizcode = Code;
             GetDiagnosisItemDic.title = "5.3.1.7获取能力测评评价类型字典值数据";
             GetDiagnosisItemDic.title = "5.3.1.7获取能力测评评价类型字典值数据";
 
 
@@ -299,7 +299,7 @@ namespace TEAMModelOS.Controllers
             parameterMap = new Dictionary<string, object>();
             parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("DiagnosisItemID", "4");
             parameterMap.Add("DiagnosisItemID", "4");
-            ScsResult GetchoiceDic = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetchoiceDic = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetchoiceDic.bizcode = Code;
             GetchoiceDic.bizcode = Code;
             GetchoiceDic.title = "5.3.1.8获取能力测评评价类型细则字典值数据";
             GetchoiceDic.title = "5.3.1.8获取能力测评评价类型细则字典值数据";
 
 
@@ -309,7 +309,7 @@ namespace TEAMModelOS.Controllers
             parameterMap = new Dictionary<string, object>();
             parameterMap = new Dictionary<string, object>();
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("PXID", "65321");
             parameterMap.Add("PXID", "65321");
-            ScsResult GetTeacherInfoByPXID = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetTeacherInfoByPXID = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetTeacherInfoByPXID.bizcode = Code;
             GetTeacherInfoByPXID.bizcode = Code;
             GetTeacherInfoByPXID.title = "5.3.1.9根据培训ID与机构ID获取老师信息";
             GetTeacherInfoByPXID.title = "5.3.1.9根据培训ID与机构ID获取老师信息";
 
 
@@ -321,7 +321,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("ProjectItemID", "3");
             parameterMap.Add("ProjectItemID", "3");
             parameterMap.Add("SchoolID", "220913");
             parameterMap.Add("SchoolID", "220913");
             parameterMap.Add("Type", "0");
             parameterMap.Add("Type", "0");
-            ScsResult GetSchoolPlanBySchoolID = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetSchoolPlanBySchoolID = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetSchoolPlanBySchoolID.bizcode = Code;
             GetSchoolPlanBySchoolID.bizcode = Code;
             GetSchoolPlanBySchoolID.title = "5.3.1.10根据培训项目ID与学校ID获取学校方案";
             GetSchoolPlanBySchoolID.title = "5.3.1.10根据培训项目ID与学校ID获取学校方案";
 
 
@@ -376,7 +376,7 @@ namespace TEAMModelOS.Controllers
                     //parameterMapData.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
                     //parameterMapData.Add("ComPassed", "1");//0、未认定  1、合格  2、优秀  3、不合格  4、其他
                     //list.Add(parameterMapData);
                     //list.Add(parameterMapData);
                 }
                 }
-                UpdateTeacherListSituation = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
+                UpdateTeacherListSituation = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
                 UpdateTeacherListSituation.bizcode = Code;
                 UpdateTeacherListSituation.bizcode = Code;
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
             }
             }
@@ -454,7 +454,7 @@ namespace TEAMModelOS.Controllers
                 //    pfiles.Add(pfileMap);
                 //    pfiles.Add(pfileMap);
                 //    list.Add(parameterMapData);
                 //    list.Add(parameterMapData);
                 //}
                 //}
-                UpdateTeacherListDiagnosis = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
+                UpdateTeacherListDiagnosis = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
                 UpdateTeacherListDiagnosis.bizcode = Code;
                 UpdateTeacherListDiagnosis.bizcode = Code;
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                 UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
             }
             }
@@ -477,7 +477,7 @@ namespace TEAMModelOS.Controllers
                 parameterMap.Add("fileSize", "247767");
                 parameterMap.Add("fileSize", "247767");
                 parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 parameterMap.Add("fileType", "pdf");
                 parameterMap.Add("fileType", "pdf");
-                UploadSBTARPDF = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+                UploadSBTARPDF = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
                 UploadSBTARPDF.bizcode = Code;
                 UploadSBTARPDF.bizcode = Code;
                 UploadSBTARPDF.title = "5.3.1.14学员校本研修PDF回写";
                 UploadSBTARPDF.title = "5.3.1.14学员校本研修PDF回写";
             }
             }
@@ -515,7 +515,7 @@ namespace TEAMModelOS.Controllers
                     parameterMapData.Add("fileType", "pdf");
                     parameterMapData.Add("fileType", "pdf");
                     list.Add(parameterMapData);
                     list.Add(parameterMapData);
                 }
                 }
-                UploadSBTARPDFList = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
+                UploadSBTARPDFList = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
                 UploadSBTARPDFList.bizcode = Code;
                 UploadSBTARPDFList.bizcode = Code;
                 UploadSBTARPDFList.title = "5.3.1.15学员校本教研PDF批量回写";
                 UploadSBTARPDFList.title = "5.3.1.15学员校本教研PDF批量回写";
             }
             }
@@ -535,7 +535,7 @@ namespace TEAMModelOS.Controllers
                 parameterMap.Add("fileSize", "247767");
                 parameterMap.Add("fileSize", "247767");
                 parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 parameterMap.Add("md5", "9c3da8c5c07c2c660cd73c01f56d7fca");
                 parameterMap.Add("fileType", "mp4");
                 parameterMap.Add("fileType", "mp4");
-                UploadKTSL = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+                UploadKTSL = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
                 UploadKTSL.bizcode = Code;
                 UploadKTSL.bizcode = Code;
                 UploadKTSL.title = "5.3.1.16学员课堂实录回写";
                 UploadKTSL.title = "5.3.1.16学员课堂实录回写";
             }
             }
@@ -573,7 +573,7 @@ namespace TEAMModelOS.Controllers
                     parameterMapData.Add("fileType", "mp4");
                     parameterMapData.Add("fileType", "mp4");
                     list.Add(parameterMapData);
                     list.Add(parameterMapData);
                 }
                 }
-                UploadKTSLList = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
+                UploadKTSLList = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
                 UploadKTSLList.bizcode = Code;
                 UploadKTSLList.bizcode = Code;
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                 UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
 
 
@@ -586,7 +586,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("TrainComID", trainComID);
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectItemID", "24");
             parameterMap.Add("ProjectItemID", "24");
-            ScsResult GetSchoolList = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetSchoolList = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetSchoolList.bizcode = Code;
             GetSchoolList.bizcode = Code;
             GetSchoolList.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
             GetSchoolList.title = "5.3.1.18根据机构ID、项目ID、子项目ID返回学校列表";
 
 
@@ -602,7 +602,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectID", "22");
             parameterMap.Add("ProjectItemID", "21");
             parameterMap.Add("ProjectItemID", "21");
             parameterMap.Add("SchoolID", "200001");
             parameterMap.Add("SchoolID", "200001");
-            ScsResult GetSchoolDiagnosis = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetSchoolDiagnosis = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetSchoolDiagnosis.bizcode = Code;
             GetSchoolDiagnosis.bizcode = Code;
             GetSchoolDiagnosis.title = "5.3.1.20获取学校设置的可选能力点";
             GetSchoolDiagnosis.title = "5.3.1.20获取学校设置的可选能力点";
 
 
@@ -614,7 +614,7 @@ namespace TEAMModelOS.Controllers
             parameterMap.Add("ProjectItemID", "24");
             parameterMap.Add("ProjectItemID", "24");
             parameterMap.Add("curPage", "1");
             parameterMap.Add("curPage", "1");
             parameterMap.Add("pageSize", "10");
             parameterMap.Add("pageSize", "10");
-            ScsResult GetTeachersPageListByProject = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
+            ScsResult GetTeachersPageListByProject = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterMap);
             GetTeachersPageListByProject.bizcode = Code;
             GetTeachersPageListByProject.bizcode = Code;
             GetTeachersPageListByProject.title = "5.3.1.21分页获取学员名单";
             GetTeachersPageListByProject.title = "5.3.1.21分页获取学员名单";
 
 
@@ -669,7 +669,7 @@ namespace TEAMModelOS.Controllers
                 parameterMapData.Add("files", files);
                 parameterMapData.Add("files", files);
                 list.Add(parameterMapData);
                 list.Add(parameterMapData);
             }
             }
-            ScsResult UploadSBTARPDFListV2 = await _scsApisService.Post(scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
+            ScsResult UploadSBTARPDFListV2 = await  ThirdApisService.Post(_httpClient,scsyxptConfig.url, Code, scsyxptConfig.passKey, scsyxptConfig.privateKey, parameterContent);
             UploadSBTARPDFListV2.bizcode = Code;
             UploadSBTARPDFListV2.bizcode = Code;
             UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
             UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
 
 

+ 8 - 4
TEAMModelOS/Controllers/Third/Sc/ScController.cs

@@ -54,7 +54,6 @@ namespace TEAMModelOS.Controllers
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly ThirdApisService _scsApisService;
         public readonly string type = "scsyxpt";
         public readonly string type = "scsyxpt";
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
@@ -62,7 +61,7 @@ namespace TEAMModelOS.Controllers
 
 
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         public ScController(ScsStudyApisService scsStudyApisService, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
         public ScController(ScsStudyApisService scsStudyApisService, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService,  HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -73,7 +72,6 @@ namespace TEAMModelOS.Controllers
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
             _scsStudyApisService = scsStudyApisService;
             _scsStudyApisService = scsStudyApisService;
@@ -249,8 +247,14 @@ namespace TEAMModelOS.Controllers
                                 schoolTeacher.pk = "Teacher";
                                 schoolTeacher.pk = "Teacher";
                                 schoolTeacher.name = teacher.name;
                                 schoolTeacher.name = teacher.name;
                                 schoolTeacher.picture = teacher.picture;
                                 schoolTeacher.picture = teacher.picture;
-                                if (schoolTeacher.roles.IsEmpty() || !schoolTeacher.roles.Contains("teacher"))
+                                if (!schoolTeacher.roles.IsEmpty())
                                 {
                                 {
+                                    if (!schoolTeacher.roles.Contains("teacher"))
+                                    {
+                                        schoolTeacher.roles .Add("teacher");
+                                    }
+                                }
+                                else {
                                     schoolTeacher.roles = new List<string> { "teacher" };
                                     schoolTeacher.roles = new List<string> { "teacher" };
                                 }
                                 }
                                 schoolTeacher.permissions = schoolTeacher.permissions.IsNotEmpty() ? schoolTeacher.permissions : new List<string>();
                                 schoolTeacher.permissions = schoolTeacher.permissions.IsNotEmpty() ? schoolTeacher.permissions : new List<string>();

+ 6 - 7
TEAMModelOS/Controllers/Third/Sc/ScDataInitController.cs

@@ -31,6 +31,7 @@ using static TEAMModelOS.SDK.SchoolService;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using static TEAMModelOS.Controllers.ScController;
 using static TEAMModelOS.Controllers.ScController;
 using OpenXmlPowerTools;
 using OpenXmlPowerTools;
+using System.Net.Http;
 
 
 namespace TEAMModelOS.Controllers.Third
 namespace TEAMModelOS.Controllers.Third
 {
 {
@@ -55,14 +56,13 @@ namespace TEAMModelOS.Controllers.Third
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly ScsStudyApisService _scsStudyApisService;
         private readonly ScsStudyApisService _scsStudyApisService;
-        private readonly ThirdApisService _scsApisService;
         public readonly string type = "scsyxpt";
         public readonly string type = "scsyxpt";
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
-        private readonly ThirdApisService _thirdApisService;
+        private readonly IHttpClientFactory _httpClient;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
-        public ScDataInitController(ThirdApisService thirdApisService, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ScsStudyApisService scsStudyApis, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+        public ScDataInitController(IHttpClientFactory httpClient,  IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ScsStudyApisService scsStudyApis,  HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -74,10 +74,9 @@ namespace TEAMModelOS.Controllers.Third
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
             _scsStudyApisService = scsStudyApis;
             _scsStudyApisService = scsStudyApis;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
-            _thirdApisService = thirdApisService;
+            _httpClient = httpClient;
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -99,7 +98,7 @@ namespace TEAMModelOS.Controllers.Third
                 Dictionary<string, object> parameterMap = new Dictionary<string, object>();
                 Dictionary<string, object> parameterMap = new Dictionary<string, object>();
                 parameterMap.Add("TrainComID", config.trainComID);
                 parameterMap.Add("TrainComID", config.trainComID);
                 ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
                 ScsResult result = new ScsResult { bizcode = Code, title = "5.3.1.1获取项目列表" };
-                result = await _thirdApisService.Post(config.url, Code, config.passKey, config.privateKey, parameterMap);
+                result = await ThirdApisService.Post(_httpClient,config.url, Code, config.passKey, config.privateKey, parameterMap);
                 List<ScProject> projects = result.content.ToObject<List<ScProject>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
                 List<ScProject> projects = result.content.ToObject<List<ScProject>>(new JsonSerializerOptions { PropertyNameCaseInsensitive = false });
                 List<ScProject> scProjects = await table.FindListByDict<ScProject>(new Dictionary<string, object> { { Constant.PartitionKey, "ScProject" }, { "trainComID", $"{config.trainComID}" } });
                 List<ScProject> scProjects = await table.FindListByDict<ScProject>(new Dictionary<string, object> { { Constant.PartitionKey, "ScProject" }, { "trainComID", $"{config.trainComID}" } });
 
 

+ 10 - 10
TEAMModelOS/Controllers/Third/Sc/ScDataPushController.cs

@@ -22,6 +22,7 @@ using DinkToPdf.Contracts;
 using System.IO;
 using System.IO;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Authorization;
 using TEAMModelOS.Filter;
 using TEAMModelOS.Filter;
+using System.Net.Http;
 
 
 namespace TEAMModelOS.Controllers
 namespace TEAMModelOS.Controllers
 {
 {
@@ -157,18 +158,17 @@ namespace TEAMModelOS.Controllers
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly IConverter _converter;
         private readonly IConverter _converter;
         public readonly string type = "scsyxpt";
         public readonly string type = "scsyxpt";
+        public readonly IHttpClientFactory _httpClient;
  
  
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
 
 
-        private readonly ThirdApisService _thirdApisService;
-        public ScDataPushController(IConverter converter, ThirdApisService thirdApisService, AzureCosmosFactory azureCosmos,   AzureStorageFactory azureStorage,  IConfiguration configuration)
+        public ScDataPushController(IHttpClientFactory httpClient,IConverter converter,  AzureCosmosFactory azureCosmos,   AzureStorageFactory azureStorage,  IConfiguration configuration)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
-           
             _azureStorage = azureStorage;
             _azureStorage = azureStorage;
             _converter = converter;
             _converter = converter;
             _configuration = configuration;
             _configuration = configuration;
-            _thirdApisService = thirdApisService;
+            _httpClient = httpClient;
         }
         }
         [ProducesDefaultResponseType]
         [ProducesDefaultResponseType]
         [HttpPost("push-leave")]
         [HttpPost("push-leave")]
@@ -238,7 +238,7 @@ namespace TEAMModelOS.Controllers
             ScsResult UpdateTeacherListSituation = null;
             ScsResult UpdateTeacherListSituation = null;
             if (list53112.IsNotEmpty())
             if (list53112.IsNotEmpty())
             {
             {
-                UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
+                UpdateTeacherListSituation = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                 if (UpdateTeacherListSituation.result) {
                 if (UpdateTeacherListSituation.result) {
@@ -558,7 +558,7 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         //Thread.Sleep(10 * 1000);
                         //Thread.Sleep(10 * 1000);
                         dicts.Add(parameterContent53112);
                         dicts.Add(parameterContent53112);
-                        UpdateTeacherListSituation = await _thirdApisService.Post(config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
+                        UpdateTeacherListSituation = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListSituation", config.passKey, config.privateKey, parameterContent53112);
                         UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                         UpdateTeacherListSituation.bizcode = "UpdateTeacherListSituation";
                         UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                         UpdateTeacherListSituation.title = "5.3.1.12学员培训基本情况批量回写";
                         results.Add(UpdateTeacherListSituation);
                         results.Add(UpdateTeacherListSituation);
@@ -568,7 +568,7 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         //Thread.Sleep(10 * 1000);
                         //Thread.Sleep(10 * 1000);
                         dicts.Add(parameterContent53113);
                         dicts.Add(parameterContent53113);
-                        UpdateTeacherListDiagnosis = await _thirdApisService.Post(config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
+                        UpdateTeacherListDiagnosis = await ThirdApisService.Post(_httpClient,config.url, "UpdateTeacherListDiagnosis", config.passKey, config.privateKey, parameterContent53113);
                         UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                         UpdateTeacherListDiagnosis.bizcode = "UpdateTeacherListDiagnosis";
                         UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                         UpdateTeacherListDiagnosis.title = "5.3.1.13学员能力点测评结果批量回写";
                         results.Add(UpdateTeacherListDiagnosis);
                         results.Add(UpdateTeacherListDiagnosis);
@@ -578,7 +578,7 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         //Thread.Sleep(10 * 1000 );
                         //Thread.Sleep(10 * 1000 );
                         dicts.Add(parameterContent53117);
                         dicts.Add(parameterContent53117);
-                        UploadKTSLList = await _thirdApisService.Post(config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
+                        UploadKTSLList = await ThirdApisService.Post(_httpClient,config.url, "UploadKTSLList", config.passKey, config.privateKey, parameterContent53117);
                         UploadKTSLList.bizcode = "UploadKTSLList";
                         UploadKTSLList.bizcode = "UploadKTSLList";
                         UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                         UploadKTSLList.title = "5.3.1.17学员课堂实录批量回写";
                         results.Add(UploadKTSLList);
                         results.Add(UploadKTSLList);
@@ -588,7 +588,7 @@ namespace TEAMModelOS.Controllers
                     {
                     {
                         //Thread.Sleep(10 * 1000 );
                         //Thread.Sleep(10 * 1000 );
                         dicts.Add(parameterContent53122);
                         dicts.Add(parameterContent53122);
-                        UploadSBTARPDFListV2 = await _thirdApisService.Post(config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
+                        UploadSBTARPDFListV2 = await ThirdApisService.Post(_httpClient,config.url, "UploadSBTARPDFListV2", config.passKey, config.privateKey, parameterContent53122);
                         UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                         UploadSBTARPDFListV2.bizcode = "UploadSBTARPDFListV2";
                         UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                         UploadSBTARPDFListV2.title = "5.3.1.22学员校本教研PDF(每人可以返回多条)批量回写";
                         results.Add(UploadSBTARPDFListV2);
                         results.Add(UploadSBTARPDFListV2);
@@ -1045,7 +1045,7 @@ namespace TEAMModelOS.Controllers
             parameterContent53123.Add("ProjectItemID", config.p.Where(x => x.status == 1).First().pid);
             parameterContent53123.Add("ProjectItemID", config.p.Where(x => x.status == 1).First().pid);
             parameterContent53123.Add("PXID", $"{sc.PXID}");
             parameterContent53123.Add("PXID", $"{sc.PXID}");
             parameterContent53123.Add("TID", $"{sc.TID}");
             parameterContent53123.Add("TID", $"{sc.TID}");
-            ScsResult GetDiagnosisResultByPXIDCommand = await _thirdApisService.Post(config.url, "GetDiagnosisResultByPXIDCommand", config.passKey, config.privateKey, parameterContent53123);
+            ScsResult GetDiagnosisResultByPXIDCommand = await ThirdApisService.Post(_httpClient,config.url, "GetDiagnosisResultByPXIDCommand", config.passKey, config.privateKey, parameterContent53123);
             if (GetDiagnosisResultByPXIDCommand.result)
             if (GetDiagnosisResultByPXIDCommand.result)
             {
             {
                 PushData pushData = GetDiagnosisResultByPXIDCommand.content.ToObject<PushData>();
                 PushData pushData = GetDiagnosisResultByPXIDCommand.content.ToObject<PushData>();

+ 3 - 3
TEAMModelOS/Controllers/Third/Xkw/Sdk/XkwAPIHttpService.cs

@@ -41,9 +41,9 @@ namespace TEAMModelOS.Controllers.Third.Xkw.Sdk
         private String appId;
         private String appId;
         private String secret;
         private String secret;
         public int TimeoutInSeconds { get; set; } = DEFAULT_TIMEOUT;
         public int TimeoutInSeconds { get; set; } = DEFAULT_TIMEOUT;
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         public readonly IOptionsMonitor<XkwAPIHttpServiceOptions> options;
         public readonly IOptionsMonitor<XkwAPIHttpServiceOptions> options;
-        public XkwAPIHttpService(HttpClient httpClient, IOptionsMonitor<XkwAPIHttpServiceOptions> optionsMonitor, AzureStorageFactory _azureStorageFactory)
+        public XkwAPIHttpService(IHttpClientFactory httpClient, IOptionsMonitor<XkwAPIHttpServiceOptions> optionsMonitor, AzureStorageFactory _azureStorageFactory)
         {
         {
 
 
             _httpClient = httpClient;
             _httpClient = httpClient;
@@ -115,7 +115,7 @@ namespace TEAMModelOS.Controllers.Third.Xkw.Sdk
             HttpResponseMessage response = null;
             HttpResponseMessage response = null;
             using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
             using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
             {
             {
-                response = _httpClient.SendAsync(request, cts.Token).Result;
+                response = _httpClient.CreateClient().SendAsync(request, cts.Token).Result;
             }
             }
             String responseText = response.Content.ReadAsStringAsync().Result;
             String responseText = response.Content.ReadAsStringAsync().Result;
             if (response.StatusCode != HttpStatusCode.OK)
             if (response.StatusCode != HttpStatusCode.OK)

+ 136 - 136
TEAMModelOS/Controllers/Third/Xkw/Sdk/XopHttpClient.cs

@@ -10,142 +10,142 @@ using System.Web;
 
 
 namespace TEAMModelOS.Controllers.Third.Xkw
 namespace TEAMModelOS.Controllers.Third.Xkw
 {
 {
-    public class XopHttpClient : IDisposable
-    {
-        private static int DEFAULT_TIMEOUT = 5;
-
-        private String baseUrl;
-        private String appId;
-        private String secret;
-
-        public int TimeoutInSeconds { get; set; } = DEFAULT_TIMEOUT;
-
-        private HttpClient httpClient;
-
-
-        public void Dispose()
-        {
-            this.httpClient?.Dispose();
-        }
-
-        public XopHttpClient(String baseUrl, String appId, String secret) : this(baseUrl, appId, secret, null)
-        {
-        }
-
-        public XopHttpClient(String baseUrl, String appId, String secret, WebProxy proxy) : this(baseUrl, appId, secret, DEFAULT_TIMEOUT, proxy)
-        {
-        }
-
-        public XopHttpClient(String baseUrl, String appId, String secret, int timeout) : this(baseUrl, appId, secret, timeout, null)
-        {
-        }
-
-        public XopHttpClient(String baseUrl, String appId, String secret, int timeout, WebProxy proxy)
-        {
-            this.baseUrl = baseUrl;
-            this.appId = appId;
-            this.secret = secret;
-            if (proxy != null)
-            {
-                var httpClientHandler = new HttpClientHandler
-                {
-                    Proxy = proxy
-                };
-                this.httpClient = new HttpClient(httpClientHandler, true);
-            }
-            else
-            {
-                this.httpClient = new HttpClient();
-            }
-            this.httpClient.DefaultRequestHeaders.Add(HmacConst.KEY_APP_ID, appId);
-        }
-
-        public T Get<T>(String uri)
-        {
-            return Get<T>(uri, null);
-        }
-
-        public T Get<T>(String uri, Dictionary<String, String> parameters)
-        {
-            return SendRequest<T>(HttpMethod.Get, uri, parameters, null, null, this.TimeoutInSeconds);
-        }
-
-        public T Post<T>(String uri, Dictionary<String, String> parameters, String text, String contentType)
-        {
-            return SendRequest<T>(HttpMethod.Post, uri, parameters, text, "application/json", this.TimeoutInSeconds);
-        }
-
-        public T PostAsText<T>(String uri, Dictionary<String, String> parameters, String text)
-        {
-            return SendRequest<T>(HttpMethod.Post, uri, parameters, text, "text/plain", this.TimeoutInSeconds);
-        }
-
-        public T PostAsJson<T>(String uri, Dictionary<String, String> parameters, Object data)
-        {
+    //public class XopHttpClient : IDisposable
+    //{
+    //    private static int DEFAULT_TIMEOUT = 5;
+
+    //    private String baseUrl;
+    //    private String appId;
+    //    private String secret;
+
+    //    public int TimeoutInSeconds { get; set; } = DEFAULT_TIMEOUT;
+
+    //    private IHttpClientFactory httpClient;
+
+
+    //    public void Dispose()
+    //    {
+    //        this.httpClient?.Dispose();
+    //    }
+
+    //    public XopHttpClient(String baseUrl, String appId, String secret) : this(baseUrl, appId, secret, null)
+    //    {
+    //    }
+
+    //    public XopHttpClient(String baseUrl, String appId, String secret, WebProxy proxy) : this(baseUrl, appId, secret, DEFAULT_TIMEOUT, proxy)
+    //    {
+    //    }
+
+    //    public XopHttpClient(String baseUrl, String appId, String secret, int timeout) : this(baseUrl, appId, secret, timeout, null)
+    //    {
+    //    }
+
+    //    public XopHttpClient(String baseUrl, String appId, String secret, int timeout, WebProxy proxy)
+    //    {
+    //        this.baseUrl = baseUrl;
+    //        this.appId = appId;
+    //        this.secret = secret;
+    //        if (proxy != null)
+    //        {
+    //            var httpClientHandler = new HttpClientHandler
+    //            {
+    //                Proxy = proxy
+    //            };
+    //            this.httpClient = new HttpClient(httpClientHandler, true);
+    //        }
+    //        else
+    //        {
+    //            this.httpClient = new HttpClient();
+    //        }
+    //        this.httpClient.DefaultRequestHeaders.Add(HmacConst.KEY_APP_ID, appId);
+    //    }
+
+    //    public T Get<T>(String uri)
+    //    {
+    //        return Get<T>(uri, null);
+    //    }
+
+    //    public T Get<T>(String uri, Dictionary<String, String> parameters)
+    //    {
+    //        return SendRequest<T>(HttpMethod.Get, uri, parameters, null, null, this.TimeoutInSeconds);
+    //    }
+
+    //    public T Post<T>(String uri, Dictionary<String, String> parameters, String text, String contentType)
+    //    {
+    //        return SendRequest<T>(HttpMethod.Post, uri, parameters, text, "application/json", this.TimeoutInSeconds);
+    //    }
+
+    //    public T PostAsText<T>(String uri, Dictionary<String, String> parameters, String text)
+    //    {
+    //        return SendRequest<T>(HttpMethod.Post, uri, parameters, text, "text/plain", this.TimeoutInSeconds);
+    //    }
+
+    //    public T PostAsJson<T>(String uri, Dictionary<String, String> parameters, Object data)
+    //    {
             
             
-           string json = JsonConvert.SerializeObject(data);
-            return SendRequest<T>(HttpMethod.Post, uri, parameters, json, "application/json", this.TimeoutInSeconds);
-        }
-
-        //public T PostAsForm<T>(String uri, Dictionary<String, String> parameters, Dictionary<String, String> formData)
-        //{
-        //    if (formData == null)
-        //    {
-        //        formData = new Dictionary<string, string>();
-        //    }
-        //    using (HttpContent requestContent = new FormUrlEncodedContent(formData.ToList()))
-        //    {
-        //        return SendRequest<T>(HttpMethod.Post, uri, parameters, requestContent, this.TimeoutInSeconds);
-        //    }
-        //}
-
-        public T SendRequest<T>(HttpMethod method, String path, Dictionary<String, String> parameters, String requestBodyStr, String requestContentType, int timeoutInSeconds)
-        {
-            Dictionary<String, String> dic = new Dictionary<string, string>();
-            if (parameters != null)
-            {
-                foreach (var item in parameters)
-                {
-                    dic.Add(item.Key, item.Value);
-                }
-            }
-            // 不对body验签,添加url验签
-            //UriIdentifier uriIdentifier = HmacCommonUtils.SplitUriPrefix(path);
-            dic.Add(HmacConst.KEY_URL, path);
-            HmacResult signRlt = HmacUtils.Sign(appId, secret, dic, requestBodyStr);
-
-            String pathWithQuery = path;
-            if (parameters?.Count > 0)
-            {
-                pathWithQuery = path + "?" + String.Join("&", parameters.Select(i => $"{i.Key}={HttpUtility.UrlEncode(i.Value)}"));
-            }
-
-            HttpRequestMessage request = new HttpRequestMessage(method, baseUrl + pathWithQuery);
-            if (requestBodyStr != null)
-            {
-                StringContent requestContent = new StringContent(requestBodyStr, Encoding.UTF8, requestContentType);
-                request.Content = requestContent;
-            }
-            request.Headers.Add(HmacConst.KEY_TIMESTAMP, signRlt.TimeStamp.ToString());
-            request.Headers.Add(HmacConst.KEY_SIGN, signRlt.Sign);
-            request.Headers.Add(HmacConst.KEY_NONCE, signRlt.Nonce);
-
-            HttpResponseMessage response = null;
-            using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
-            {
-                response = this.httpClient.SendAsync(request, cts.Token).Result;
-            }
-            String responseText = response.Content.ReadAsStringAsync().Result;
-            if (response.StatusCode != HttpStatusCode.OK)
-            {
-                String message = $"服务错误: 状态码: {(int)response.StatusCode}, resposneText: {responseText}";
-                XopException bapiException = new XopException(message, response);
-                throw bapiException;
-            }
-
-            return JsonConvert.DeserializeObject<T>(responseText);
-        }
-
-    }
+    //       string json = JsonConvert.SerializeObject(data);
+    //        return SendRequest<T>(HttpMethod.Post, uri, parameters, json, "application/json", this.TimeoutInSeconds);
+    //    }
+
+    //    //public T PostAsForm<T>(String uri, Dictionary<String, String> parameters, Dictionary<String, String> formData)
+    //    //{
+    //    //    if (formData == null)
+    //    //    {
+    //    //        formData = new Dictionary<string, string>();
+    //    //    }
+    //    //    using (HttpContent requestContent = new FormUrlEncodedContent(formData.ToList()))
+    //    //    {
+    //    //        return SendRequest<T>(HttpMethod.Post, uri, parameters, requestContent, this.TimeoutInSeconds);
+    //    //    }
+    //    //}
+
+    //    public T SendRequest<T>(HttpMethod method, String path, Dictionary<String, String> parameters, String requestBodyStr, String requestContentType, int timeoutInSeconds)
+    //    {
+    //        Dictionary<String, String> dic = new Dictionary<string, string>();
+    //        if (parameters != null)
+    //        {
+    //            foreach (var item in parameters)
+    //            {
+    //                dic.Add(item.Key, item.Value);
+    //            }
+    //        }
+    //        // 不对body验签,添加url验签
+    //        //UriIdentifier uriIdentifier = HmacCommonUtils.SplitUriPrefix(path);
+    //        dic.Add(HmacConst.KEY_URL, path);
+    //        HmacResult signRlt = HmacUtils.Sign(appId, secret, dic, requestBodyStr);
+
+    //        String pathWithQuery = path;
+    //        if (parameters?.Count > 0)
+    //        {
+    //            pathWithQuery = path + "?" + String.Join("&", parameters.Select(i => $"{i.Key}={HttpUtility.UrlEncode(i.Value)}"));
+    //        }
+
+    //        HttpRequestMessage request = new HttpRequestMessage(method, baseUrl + pathWithQuery);
+    //        if (requestBodyStr != null)
+    //        {
+    //            StringContent requestContent = new StringContent(requestBodyStr, Encoding.UTF8, requestContentType);
+    //            request.Content = requestContent;
+    //        }
+    //        request.Headers.Add(HmacConst.KEY_TIMESTAMP, signRlt.TimeStamp.ToString());
+    //        request.Headers.Add(HmacConst.KEY_SIGN, signRlt.Sign);
+    //        request.Headers.Add(HmacConst.KEY_NONCE, signRlt.Nonce);
+
+    //        HttpResponseMessage response = null;
+    //        using (CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromSeconds(timeoutInSeconds)))
+    //        {
+    //            response = this.httpClient.SendAsync(request, cts.Token).Result;
+    //        }
+    //        String responseText = response.Content.ReadAsStringAsync().Result;
+    //        if (response.StatusCode != HttpStatusCode.OK)
+    //        {
+    //            String message = $"服务错误: 状态码: {(int)response.StatusCode}, resposneText: {responseText}";
+    //            XopException bapiException = new XopException(message, response);
+    //            throw bapiException;
+    //        }
+
+    //        return JsonConvert.DeserializeObject<T>(responseText);
+    //    }
+
+    //}
 
 
 }
 }

+ 1 - 3
TEAMModelOS/Controllers/Third/Xkw/XkwOAuth2Controller.cs

@@ -56,13 +56,12 @@ namespace TEAMModelOS.Controllers
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly ThirdApisService _scsApisService;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
  
  
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         public XkwOAuth2Controller(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
         public XkwOAuth2Controller(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+          AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService,  HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -73,7 +72,6 @@ namespace TEAMModelOS.Controllers
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
         }
         }

+ 1 - 3
TEAMModelOS/Controllers/Third/Xkw/XkwServiceController.cs

@@ -61,7 +61,6 @@ namespace TEAMModelOS.Controllers.Third.Xkw
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        private readonly ThirdApisService _scsApisService;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly IWebHostEnvironment _environment;
         private readonly IWebHostEnvironment _environment;
         private readonly XkwAPIHttpService _xkwAPIHttpService;
         private readonly XkwAPIHttpService _xkwAPIHttpService;
@@ -76,7 +75,7 @@ namespace TEAMModelOS.Controllers.Third.Xkw
 
 
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         public XkwServiceController(XkwAPIHttpService xkwAPIHttpService, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
         public XkwServiceController(XkwAPIHttpService xkwAPIHttpService, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
-            AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
+            AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService,   HttpTrigger httpTrigger)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _snowflakeId = snowflakeId;
             _snowflakeId = snowflakeId;
@@ -87,7 +86,6 @@ namespace TEAMModelOS.Controllers.Third.Xkw
             _configuration = configuration;
             _configuration = configuration;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
             _coreAPIHttpService = coreAPIHttpService;
             _coreAPIHttpService = coreAPIHttpService;
-            _scsApisService = scsApisService;
             _httpTrigger = httpTrigger;
             _httpTrigger = httpTrigger;
             _environment = environment;
             _environment = environment;
             _xkwAPIHttpService=xkwAPIHttpService;
             _xkwAPIHttpService=xkwAPIHttpService;

+ 4 - 4
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -48,7 +48,7 @@ namespace TEAMModelOS.Controllers
     [ApiController]
     [ApiController]
     public class FixDataController : ControllerBase
     public class FixDataController : ControllerBase
     {
     {
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
@@ -59,7 +59,7 @@ namespace TEAMModelOS.Controllers
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly ScsStudyApisService _scsStudyApisService;
         private readonly ScsStudyApisService _scsStudyApisService;
-        public FixDataController(HttpClient httpClient, HttpTrigger httpTrigger, AzureServiceBusFactory serviceBus, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ScsStudyApisService scsStudyApisService)
+        public FixDataController(IHttpClientFactory httpClient, HttpTrigger httpTrigger, AzureServiceBusFactory serviceBus, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ScsStudyApisService scsStudyApisService)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;
@@ -307,10 +307,10 @@ namespace TEAMModelOS.Controllers
             jsons = Regex.Replace(jsons, @"\s", "");
             jsons = Regex.Replace(jsons, @"\s", "");
             List<JoinSchool> joins = jsons.ToObject<List<JoinSchool>>();
             List<JoinSchool> joins = jsons.ToObject<List<JoinSchool>>();
             string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
             string url = _configuration.GetValue<string>("HaBookAuth:CoreId:userinfo");
-            HttpClient client = new HttpClient();
+          
             var tmdids = joins.Select(x => x.tmdid).ToList();
             var tmdids = joins.Select(x => x.tmdid).ToList();
             var content = new StringContent(tmdids.ToJsonString(), Encoding.UTF8, "application/json");
             var content = new StringContent(tmdids.ToJsonString(), Encoding.UTF8, "application/json");
-            HttpResponseMessage responseMessage = await client.PostAsync(url, content);
+            HttpResponseMessage responseMessage = await _httpClient.CreateClient().PostAsync(url, content);
             List<Teacher> ids = null;
             List<Teacher> ids = null;
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {

+ 2 - 2
TEAMModelOS/Controllers/XTest/FixLessonRecordController.cs

@@ -46,7 +46,7 @@ namespace TEAMModelOS.Controllers.XTest
     [ApiController]
     [ApiController]
     public class FixLessonRecordController : ControllerBase
     public class FixLessonRecordController : ControllerBase
     {
     {
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         private readonly IConfiguration _configuration;
         private readonly IConfiguration _configuration;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
@@ -56,7 +56,7 @@ namespace TEAMModelOS.Controllers.XTest
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly AzureServiceBusFactory _serviceBus;
         private readonly HttpTrigger _httpTrigger;
         private readonly HttpTrigger _httpTrigger;
         private readonly CoreAPIHttpService _coreAPIHttpService;
         private readonly CoreAPIHttpService _coreAPIHttpService;
-        public FixLessonRecordController(HttpClient httpClient, HttpTrigger httpTrigger, AzureServiceBusFactory serviceBus, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService)
+        public FixLessonRecordController(IHttpClientFactory httpClient, HttpTrigger httpTrigger, AzureServiceBusFactory serviceBus, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, DingDing dingDing, IOptionsSnapshot<Option> option, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService)
         {
         {
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
             _azureRedis = azureRedis;
             _azureRedis = azureRedis;

+ 5 - 5
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -44,7 +44,7 @@ namespace TEAMModelOS.Controllers
     [ApiController]
     [ApiController]
     public class TestController : ControllerBase
     public class TestController : ControllerBase
     {
     {
-        private readonly HttpClient _httpClient;
+        private readonly IHttpClientFactory _httpClient;
         public IWebHostEnvironment _environment { get; set; }
         public IWebHostEnvironment _environment { get; set; }
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureStorageFactory _azureStorage;
         private readonly AzureRedisFactory _azureRedis;
         private readonly AzureRedisFactory _azureRedis;
@@ -56,7 +56,7 @@ namespace TEAMModelOS.Controllers
         private readonly IPSearcher _searcher;
         private readonly IPSearcher _searcher;
         public IConfiguration _configuration { get; set; }
         public IConfiguration _configuration { get; set; }
         private readonly IConverter _converter;
         private readonly IConverter _converter;
-        public TestController(IConverter converter, IPSearcher searcher, IOptionsSnapshot<Option> option, CoreAPIHttpService coreAPIHttpService, HttpClient httpClient, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, IConfiguration configuration, AzureServiceBusFactory serviceBus, DingDing dingDing)
+        public TestController(IConverter converter, IPSearcher searcher, IOptionsSnapshot<Option> option, CoreAPIHttpService coreAPIHttpService, IHttpClientFactory httpClient, IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, AzureRedisFactory azureRedis, AzureStorageFactory azureStorage, IConfiguration configuration, AzureServiceBusFactory serviceBus, DingDing dingDing)
         {
         {
             _converter = converter;
             _converter = converter;
             _azureCosmos = azureCosmos;
             _azureCosmos = azureCosmos;
@@ -392,7 +392,7 @@ namespace TEAMModelOS.Controllers
                 Dictionary<string, object> data = new Dictionary<string, object>();
                 Dictionary<string, object> data = new Dictionary<string, object>();
                 data.Add("method", "api/School/getSchool");
                 data.Add("method", "api/School/getSchool");
                 data.Add("params", new { CountryId = "CN", CityId = region });
                 data.Add("params", new { CountryId = "CN", CityId = region });
-                HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync("https://contest.teammodel.cn/api/School/getSchool", data);
+                HttpResponseMessage responseMessage = await _httpClient.CreateClient().PostAsJsonAsync("https://contest.teammodel.cn/api/School/getSchool", data);
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 if (responseMessage.StatusCode == HttpStatusCode.OK)
                 {
                 {
                     string Content = await responseMessage.Content.ReadAsStringAsync();
                     string Content = await responseMessage.Content.ReadAsStringAsync();
@@ -504,10 +504,10 @@ namespace TEAMModelOS.Controllers
         {
         {
 
 
 
 
-            HttpClient _httpClient = new HttpClient();
+            
             //  _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
             //  _httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
             var pa = new { grant_type = "device", client_id = "9794e418-c4ef-4fd5-a42d-accaa2d96d6e", client_secret = "ruL?I79h0w1AZaZXtBaZeZuQLQXLa=:-" };
             var pa = new { grant_type = "device", client_id = "9794e418-c4ef-4fd5-a42d-accaa2d96d6e", client_secret = "ruL?I79h0w1AZaZXtBaZeZuQLQXLa=:-" };
-            HttpResponseMessage responseMessage = await _httpClient.PostAsJsonAsync("https://api2-rc.teammodel.net/oauth2/token", pa);
+            HttpResponseMessage responseMessage = await _httpClient.CreateClient().PostAsJsonAsync("https://api2-rc.teammodel.net/oauth2/token", pa);
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             if (responseMessage.StatusCode == HttpStatusCode.OK)
             {
             {
                 return 200;
                 return 200;

+ 2 - 3
TEAMModelOS/Startup.cs

@@ -111,9 +111,8 @@ namespace TEAMModelOS
             services.AddHttpClient<DingDing>();
             services.AddHttpClient<DingDing>();
             services.AddHttpClient<NotificationService>();
             services.AddHttpClient<NotificationService>();
             services.AddCoreAPIHttpService(Configuration);
             services.AddCoreAPIHttpService(Configuration);
-            services.AddScsStudyApisService(Configuration);//
-           // services.AddHttpClient<CoreAPIHttpService>();
-            services.AddHttpClient<ThirdApisService>();
+           //services.AddHttpClient<CoreAPIHttpService>();
+            services.AddSingleton <ScsStudyApisService>();
             services.AddHttpClient<HttpTrigger>();
             services.AddHttpClient<HttpTrigger>();
             services.AddMemoryCache();
             services.AddMemoryCache();
             services.AddSpaStaticFiles(opt => opt.RootPath = "ClientApp/dist");
             services.AddSpaStaticFiles(opt => opt.RootPath = "ClientApp/dist");

+ 8 - 8
TEAMModelOS/appsettings.Development.json

@@ -21,22 +21,22 @@
   },
   },
   "Azure": {
   "Azure": {
     "Storage": {
     "Storage": {
-      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodeltest;AccountKey=O2W2vadCqexDxWO+px+QK7y1sHwsYj8f/WwKLdOdG5RwHgW/Dupz9dDUb4c1gi6ojzQaRpFUeAAmOu4N9E+37A==;EndpointSuffix=core.chinacloudapi.cn"
+      "ConnectionString": "DefaultEndpointsProtocol=https;AccountName=teammodelos;AccountKey=Dl04mfZ9hE9cdPVO1UtqTUQYN/kz/dD/p1nGvSq4tUu/4WhiKcNRVdY9tbe8620nPXo/RaXxs+1F9sVrWRo0bg==;EndpointSuffix=core.chinacloudapi.cn"
     },
     },
     "Cosmos": {
     "Cosmos": {
-      "ConnectionString": "AccountEndpoint=https://cdhabookdep-free.documents.azure.cn:443/;AccountKey=JTUVk92Gjsx17L0xqxn0X4wX2thDPMKiw4daeTyV1HzPb6JmBeHdtFY1MF1jdctW1ofgzqkDMFOtcqS46by31A==;"
+      "ConnectionString": "AccountEndpoint=https://teammodelos.documents.azure.cn:443/;AccountKey=clF73GwPECfP1lKZTCvs8gLMMyCZig1HODFbhDUsarsAURO7TcOjVz6ZFfPqr1HzYrfjCXpMuVD5TlEG5bFGGg==;"
     },
     },
     "Redis": {
     "Redis": {
-      "ConnectionString": "52.130.252.100:6379,password=habook,ssl=false,abortConnect=False,writeBuffer=10240"
+      "ConnectionString": "CoreRedisCN.redis.cache.chinacloudapi.cn:6380,password=LyJWP1ORJdv+poXWofAF97lhCEQPg1wXWqvtzXGXQuE=,ssl=True,abortConnect=False"
     },
     },
     "ServiceBus": {
     "ServiceBus": {
-      "ConnectionString": "Endpoint=sb://teammodelos.servicebus.chinacloudapi.cn/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=Sy4h4EQ8zP+7w/lOLi1X3tGord/7ShFHimHs1vC50Dc=",
-      "ActiveTask": "dep-active-task",
-      "ItemCondQueue": "dep-itemcond",
-      "GenPdfQueue": "dep-genpdf"
+      "ConnectionString": "Endpoint=sb://coreiotservicebuscnpro.servicebus.chinacloudapi.cn/;SharedAccessKeyName=TEAMModelOS;SharedAccessKey=llRPBMDJG9w1Nnifj+pGhV0g4H2REcq0PjvX2qqpcOg=",
+      "ActiveTask": "active-task",
+      "ItemCondQueue": "itemcond",
+      "GenPdfQueue": "genpdf"
     },
     },
     "SignalR": {
     "SignalR": {
-      "ConnectionString": "Endpoint=https://channel.service.signalr.net;AccessKey=KrblW06tuA4a/GyqRPDU0ynFFmAWxbAvyJihHclSXbQ=;Version=1.0;"
+      "ConnectionString": "Endpoint=https://channel.signalr.azure.cn;AccessKey=AtcB7JYFNUbUXb1rGxa3PVksQ2X5YSv3JOHZR9J88tw=;Version=1.0;"
     }
     }
   },
   },
   "HaBookAuth": {
   "HaBookAuth": {