CrazyIter_Bin 2 years ago
parent
commit
89983433e7

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

@@ -303,7 +303,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                         if (!exist)
                         {   ///key不存在则正常进行计算
                             bool condition = false;
-                            TimeSpan timeSpan = new TimeSpan(DateTimeOffset.UtcNow.AddMinutes(5).Ticks);
+                            TimeSpan timeSpan = new TimeSpan(DateTimeOffset.UtcNow.AddMinutes(15).Ticks);
                             timeSpan = timeSpan - new TimeSpan(DateTimeOffset.UtcNow.Ticks);
                             //准备处理Blob刷新时间
                             long action = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
@@ -327,7 +327,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                         else
                         {
                             ///key存在则,则刷新key对应的值
-                            TimeSpan timeSpan = new TimeSpan(DateTimeOffset.UtcNow.AddMinutes(5).Ticks);
+                            TimeSpan timeSpan = new TimeSpan(DateTimeOffset.UtcNow.AddMinutes(15).Ticks);
                             timeSpan = timeSpan - new TimeSpan(DateTimeOffset.UtcNow.Ticks);
                             long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                             await _azureRedis.GetRedisClient(8).StringSetAsync(lockKey, now, expiry: timeSpan);

+ 16 - 1
TEAMModelOS/Controllers/Teacher/InitController.cs

@@ -250,7 +250,6 @@ namespace TEAMModelOS.Controllers
                                //保存日志
                                 Dictionary<string, object> replaceData = new() { { "oName" ,$"{name}" }, { "oId", $"{userid}" }, { "scName", $"{schoolBase.name}" }, { "scId", $"{schoolBase.id}" } , { "tName", $"{targetTeacher.name}" }, { "tId", $"{targetTeacher.id}" } };
                                 _ = _azureStorage.SaveLogLang("transfer-admin-role", _environment.ContentRootPath, replaceData, _dingDing, bizId: $"{userid}-{schoolBase.id}-{_targetTecher}", httpContext: HttpContext, scope: "school");
-
                                 //保存管理员移交至BI
                                 await AzureStorageBlobExtensions.SaveBILog(blobClient, tableClient, "school-transfer-admin", strMsg?.ToString(), _dingDing, twebsite: "IES5", httpContext: HttpContext);
                                 return Ok(new { status = 1 });
@@ -329,6 +328,22 @@ namespace TEAMModelOS.Controllers
                             }
                         }
                         return BadRequest(new { status = -1, msg = "参数异常!" });
+                    case bool when $"{_opt}".Equals("QuitSchool", StringComparison.OrdinalIgnoreCase):
+                        if (HttpContext.Items.TryGetValue("Roles", out object _roles))
+                        {
+                            List<string> roles = (List<string>)_roles;
+                            if (!roles.Contains("admin"))
+                            {
+                            }
+                            else
+                            {
+                                return BadRequest(new { status = -1, msg = "管理员不能退出学校!" });
+                            }
+                        }
+                        else {
+                            return BadRequest(new { status = -1, msg = "参数异常!" });
+                        }
+                        
 
                 }
             }

+ 7 - 4
TEAMModelOS/Controllers/Third/Sc/ScDataPushController.cs

@@ -436,15 +436,15 @@ namespace TEAMModelOS.Controllers
         [ProducesDefaultResponseType]
         [HttpPost("push")]
         public async Task<IActionResult> Push(JsonElement json) {
-             
-         
+
+            string force = $"{json.GetProperty("force")}";
             string areaIdJson = $"{json.GetProperty("areaId")}";
             List<string> schools = json.GetProperty("schools").ToObject<List<string>>();
             List<string> pushTeachers = json.GetProperty("pushTeachers").ToObject<List<string>>();
-            (List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)= await PushData(areaIdJson, schools, pushTeachers);
+            (List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)= await PushData(areaIdJson, schools, pushTeachers, force);
             return Ok(new { data = new { results, fails, dicts } });        
         }
-        private async Task<(List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)> PushData(string areaIdJson, List<string> schools, List<string> pushTeachers) {
+        private async Task<(List<ScsResult> results, List<PushFail> fails, List<Dictionary<string, object>> dicts)> PushData(string areaIdJson, List<string> schools, List<string> pushTeachers,string force="0") {
             var client = _azureCosmos.GetCosmosClient();
             Dictionary<string, Dictionary<string, object>> pushDatas = new Dictionary<string, Dictionary<string, object>>();
             List<Dictionary<string, object>> dicts = new List<Dictionary<string, object>>();
@@ -515,6 +515,9 @@ namespace TEAMModelOS.Controllers
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TeacherTrain>(queryText: queryText.ToString(),
                     requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TeacherTrain-{school}") }))
                     {
+                        if (force.Equals("1")) {
+                            item.pushes = new HashSet<string>();
+                        }
                         trains.Add(item);
                     }
                 }

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

@@ -2689,7 +2689,7 @@ namespace TEAMModelOS.Controllers
             //金牛直属。
             if (!json.TryGetProperty("areaId", out JsonElement areaId)) { BadRequest(); }
             //string sql = $"SELECT  distinct  c.id,s.schoolId as code , c.name as nickname, s.name as name     FROM c  join s in  c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
-            //    $" and array_length(c.binds)>0  and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
+            //    $" and array_length(c.binds)>0  and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'")  )})";
             string sql = $"SELECT  distinct  c.id,s.schoolId as code , c.name as nickname, s.name as name     FROM c  join s in  c.schools where s.areaId='{areaId}'" +
                $" and array_length(c.binds)>0  ";
             List<IdNameCode> tmdidSchooCode = new List<IdNameCode>();

+ 1 - 0
TEAMModelOS/Lang/zh-cn.json

@@ -1,4 +1,5 @@
 {
+  "quit_school": [ "教师退出学校通知", "{tmdname}({tmdid})申请退出{schoolName}。", "同意", "拒绝" ],
   "request_school": [ "申请加入学校通知", "{tmdname}({tmdid})申请加入{schoolName}。", "同意", "拒绝" ],
   "invite_school": [ "邀请加入学校通知", "{schoolName}邀请您加入学校。", "接受", "婉拒" ],
   "remove_school": [ "从学校移除通知", "{schoolName}将您从学校教师名单中移除。" ],