CrazyIter_Bin 1 year ago
parent
commit
fe8bda1bf6

+ 8 - 1
TEAMModelOS.SDK/Models/Service/SystemService.cs

@@ -115,7 +115,7 @@ IES Morning Report:
 
 
         public static async Task<List<CodeValue> > AccumulateDaily(AzureRedisFactory _azureRedis,AzureCosmosFactory _azureCosmos,
-            CoreAPIHttpService coreAPIHttpService, DingDing dingDing,HttpClient _httpClient, SnowflakeId _snowflakeId,string notifyUrl, MailFactory _mailFactory)
+            CoreAPIHttpService coreAPIHttpService, DingDing dingDing,HttpClient _httpClient, SnowflakeId _snowflakeId,string notifyUrl, MailFactory _mailFactory, int am=0 ,int pm=0)
         {
             DateTimeOffset now = DateTimeOffset.Now;
             string day = now.ToString("yyyyMMdd");
@@ -262,6 +262,13 @@ IES Morning Report:
                 int sendTime_pm = 20;
                 int sendTime_am =8;
 #endif
+                if (am>0) { 
+                    sendTime_am = am;
+                }
+                if (pm>0)
+                {
+                    sendTime_pm = pm;
+                }
                 string lang = teacher.lang;
                 var tzt = now.GetGMTTime((int)teacher.timezone);
                 if (string.IsNullOrWhiteSpace(teacher.lang)) 

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

@@ -177,7 +177,7 @@ namespace TEAMModelOS.Controllers
             {
                 sql.Append("select  c.id,c.code,c.name,c.blob,c.periodId,c.gradeIds,c.subjectId,c.subjectName,c.score,c.useCount,c.scope,c.scoring,c.createTime,c.sheet ,c.mode ,c.sheetNo, c.tags,c.itemSort,c.qamode,c.isCodeOption,c.attachments,c.creatorId,c.secret from c");
                 AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
-                sql.Replace("where", $" where ( IS_DEFINED(c.secret) = false  || c.secret=0 )  || (c.secret==1 && c.creatorId='{id}') ");
+                cosmosDbQuery.QueryText= cosmosDbQuery.QueryText.Replace("where", $" where (( IS_DEFINED(c.secret) = false or  c.secret=0 )  or (c.secret=1 and  c.creatorId='{id}') ) and  ");
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<Paper>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Paper-{code}") }))
                 {
                     papers.Add(item);

+ 7 - 1
TEAMModelOS/Controllers/XTest/TestController.cs

@@ -124,6 +124,12 @@ namespace TEAMModelOS.Controllers
         [RequestSizeLimit(102_400_000_00)] //最大10000m左右
         public async Task<IActionResult> RemoveStuCourse(JsonElement json)
         {
+            json.TryGetProperty("am", out JsonElement _am);
+            json.TryGetProperty("pm", out JsonElement _pm);
+            int am = 0;
+            int pm = 0;
+            _am.TryGetInt32(out am);
+            _pm.TryGetInt32(out pm);
             var url = _configuration.GetValue<string>("HaBookAuth:CoreAPI");
             var clientID = _configuration.GetValue<string>("HaBookAuth:CoreService:clientID");
             var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
@@ -147,7 +153,7 @@ namespace TEAMModelOS.Controllers
             {
                 client.DefaultRequestHeaders.Add("Authorization", $"Bearer {token.AccessToken}");
             }
-            List<CodeValue> notifys= await SystemService.AccumulateDaily( _azureRedis,_azureCosmos, _coreAPIHttpService,_dingDing,client, _snowflakeId, url,_mailFactory);
+            List<CodeValue> notifys= await SystemService.AccumulateDaily( _azureRedis,_azureCosmos, _coreAPIHttpService,_dingDing,client, _snowflakeId, url,_mailFactory,am ,pm );
             return Ok(new { notifys });
         }