Explorar o código

update 返回教师和学习空间

CrazyIter_Bin %!s(int64=2) %!d(string=hai) anos
pai
achega
0663b27e16

+ 1 - 1
TEAMModelOS.SDK/Models/Service/Common/BlobService.cs

@@ -183,7 +183,7 @@ namespace TEAMModelOS.SDK.Services
             }
             catch (Exception ex)
             {
-                await _dingDing.SendBotMsg($"IES5,{location},blob/used-space()\n{ex.Message}\n{ex.StackTrace}\n{name},\n{scope}", GroupNames.醍摩豆服務運維群組);
+                await _dingDing.SendBotMsg($"IES5,{location},GetSurplusSpace \n{ex.Message}\n{ex.StackTrace}\n{name},\n{scope}", GroupNames.醍摩豆服務運維群組);
                 return (usedSize, teach, total, surplus, catalog);
             }
             if (usedSize > 0 && total > 0) {

+ 14 - 3
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -36,6 +36,7 @@ using DocumentFormat.OpenXml.Drawing.Charts;
 using static TEAMModelOS.Controllers.FixDataController;
 using IdCode = TEAMModelOS.SDK.Models.IdCode;
 using TEAMModelOS.SDK.Models.Service.BI;
+using TEAMModelOS.SDK.Services;
 
 namespace TEAMModelOS.Controllers
 {
@@ -472,6 +473,9 @@ namespace TEAMModelOS.Controllers
                 var result = await table.ExecuteQuerySegmentedAsync(new TableQuery<OAuthShow>().Where(qurey), null);
                 List<OAuthShow> shows = result.Results;
                 string lang = !string.IsNullOrWhiteSpace(teacherInfo.teacher.lang) ? teacherInfo.teacher.lang : head_lang;
+                //返回剩余空间
+                (long usedSize, long teach, long total, long surplus, Dictionary<string, double?> catalog) space =
+                    await BlobService.GetSurplusSpace(teacher.id, "private", _option.Location, _azureCosmos, _azureRedis, _azureStorage, _dingDing, _httpTrigger);
                 if (string.IsNullOrWhiteSpace(lang))
                 {
                     if (_option.Location.Contains("China"))
@@ -514,7 +518,9 @@ namespace TEAMModelOS.Controllers
                     status = 200,
                     teacherInfo.areas,
                     lessonLimit,
-                    teacherInfo.teacher.lessonShow
+                    teacherInfo.teacher.lessonShow,
+                    privateSpace= new { size = space.usedSize, catalog = space.catalog, teach = space.teach, surplus = space.surplus, total = space.total },
+                    schoolSpace = new { size = 0, catalog = 0, teach = 0, surplus = 0, total = 0 }
                 });
             }
             catch (CosmosException ex)
@@ -869,7 +875,9 @@ namespace TEAMModelOS.Controllers
                     var area_result = await table.ExecuteQuerySegmentedAsync(new TableQuery<OAuthShow>().Where(area_tbqurey), null);
                     areaShows = area_result.Results;
                 }
-
+                //返回剩余空间
+                (long usedSize, long teach, long total, long surplus, Dictionary<string, double?> catalog) space =
+                    await BlobService.GetSurplusSpace(school_base.id, "school", _option.Location, _azureCosmos, _azureRedis, _azureStorage, _dingDing, _httpTrigger);
                 //学校版本处理
                 _ = BISchoolService.UpSchoolEdition(client, _dingDing, services.Select(s => s.prodCode).ToList(), $"{school_code}");
 
@@ -898,7 +906,10 @@ namespace TEAMModelOS.Controllers
                     {
                         //serial = serials,
                         service = services
-                    }
+                    }  
+                    ,
+                    privateSpace = new { size = 0, catalog = 0, teach = 0, surplus = 0, total = 0 } ,
+                    schoolSpace = new { size = space.usedSize, catalog = space.catalog, teach = space.teach, surplus = space.surplus, total = space.total }
                 });
             }
             catch (CosmosException ex)