Browse Source

处理系统管理员异常问题

Li 2 years ago
parent
commit
14c283b7c4
1 changed files with 13 additions and 11 deletions
  1. 13 11
      TEAMModelBI/Controllers/BISchool/SchoolController.cs

+ 13 - 11
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -1529,13 +1529,13 @@ namespace TEAMModelBI.Controllers.BISchool
             //    cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
             List<YearCnt> yearCnts = new();  //当前的课例,活动,互动统计
-
+            List<string> schoolIds = new();
             string strSql = "SELECT value(count(c.id)) FROM c where c.pk='LessonRecord'";
             string scSql = null;
             if (!string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}"))
             {
                 //List<string> schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
-                List<string> schoolIds = new();
+
                 if (!string.IsNullOrEmpty($"{tmdId}"))
                 {
                     switch ($"{role}")
@@ -1548,19 +1548,21 @@ namespace TEAMModelBI.Controllers.BISchool
                             break;
                     }
                 }
-                else
-                    schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
-
-                if (schoolIds.Count == 0) return Ok(new { state = RespondCode.Ok, yearCnts, });
-                scSql = BICommonWay.ManyScSql("c.school", schoolIds);
             }
-
-            if (!string.IsNullOrEmpty($"{schooId}") && string.IsNullOrEmpty($"{tmdId}"))
+            else if (!string.IsNullOrEmpty($"{schooId}") && string.IsNullOrEmpty($"{tmdId}"))
                 scSql = $"c.school = '{schooId}'";
+            else 
+            {
+                schoolIds = await CommonFind.GetValueSingle(cosmosClient, "School", "select value(c.id) from c", "Base");
 
-            if ((string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}")) || (!string.IsNullOrEmpty($"{tmdId}") && !string.IsNullOrEmpty($"{schooId}")))
-                return Ok(new { state = RespondCode.ParamsError, msg = "参数错误" });
+                if (schoolIds.Count == 0)
+                    return Ok(new { state = RespondCode.Ok, yearCnts, });
+                else
+                    scSql = BICommonWay.ManyScSql("c.school", schoolIds);
+            }
 
+            //if ((string.IsNullOrEmpty($"{tmdId}") && string.IsNullOrEmpty($"{schooId}")) || (!string.IsNullOrEmpty($"{tmdId}") && !string.IsNullOrEmpty($"{schooId}")))
+                
             List<MonthStartEnd> mthStartEnds = await TimeHelper.GetYearSataMthCtMth(DateTimeOffset.UtcNow);
             if (mthStartEnds.Count > 0)
             {