CrazyIter_Bin 11 kuukautta sitten
vanhempi
commit
6b3e954eda

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

@@ -84,17 +84,17 @@ namespace TEAMModelOS.FunctionV4.TimeTrigger
         [Function("DailyReport")]
         [Function("DailyReport")]
         //0 1 * * * * 一天中每小时的第 1 分钟
         //0 1 * * * * 一天中每小时的第 1 分钟
         //0 */10 * * * *  每五分钟一次
         //0 */10 * * * *  每五分钟一次
-        public async Task DailyReport([TimerTrigger("0 05 * * * *")] TimerInfo myTimer, ILogger log)
+        public async Task DailyReport([TimerTrigger("0 40 * * * *")] TimerInfo myTimer, ILogger log)
         {
         {
             try
             try
             {
             {
                 await _dingDing.SendBotMsg($"定时任务{DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss")}", GroupNames.成都开发測試群組);
                 await _dingDing.SendBotMsg($"定时任务{DateTimeOffset.Now.ToString("yyyy-MM-dd HH:mm:ss")}", GroupNames.成都开发測試群組);
                 string local = Environment.GetEnvironmentVariable("Option:Location");
                 string local = Environment.GetEnvironmentVariable("Option:Location");
-                if (local.Contains("Test")||local.Contains("Dep"))
+               // if (local.Contains("Test")||local.Contains("Dep"))
                 {
                 {
 
 
-                    int am =8;
-                    int pm = 20;
+                    int am =9;
+                    int pm = 9;
                     //int am = DateTimeOffset.Now.Hour;
                     //int am = DateTimeOffset.Now.Hour;
                     //int pm = DateTimeOffset.Now.Hour;
                     //int pm = DateTimeOffset.Now.Hour;
                     var url = Environment.GetEnvironmentVariable("HaBookAuth:CoreAPI");
                     var url = Environment.GetEnvironmentVariable("HaBookAuth:CoreAPI");

+ 24 - 4
TEAMModelOS.SDK/Models/Service/SystemService.cs

@@ -626,8 +626,18 @@ IES Morning Report:
                     var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id)  && !string.IsNullOrWhiteSpace(x.mail));
                     var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id)  && !string.IsNullOrWhiteSpace(x.mail));
                     if (coreUser!=null)
                     if (coreUser!=null)
                     {
                     {
-                        var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name, sender: "TEAMModel");
-                       // await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail },{ "tid","1234" },{ "vars",new { title=title,body=template } } } ,coreAPIHttpService.options.location,_configuration);
+                       // var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name, sender: "TEAMModel");
+                        //var tid = lang.Equals("zh-cn") ? "d-136eddbd974046f1a721c8f4e210b9bf" : lang.Equals("zh-tw") ? "d-136eddbd974046f1a721c8f4e210b9bf" : "d-95ac2d657d1b4d9dbb7b79defc17f714";
+                        var tid = string.Empty;
+                        if (coreAPIHttpService.options.location.Contains("China"))
+                        {
+                            tid= "IES5GeneralTemplate";
+                        }
+                        else
+                        {
+                            tid= lang.Equals("zh-tw") ? "d-136eddbd974046f1a721c8f4e210b9bf" : "d-95ac2d657d1b4d9dbb7b79defc17f714";
+                        }
+                        await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail }, { "tid", tid }, { "vars", new { title = title, notificationcontent = template } } }, coreAPIHttpService.options.location, _configuration);
                     }
                     }
                     notify.Append(template);
                     notify.Append(template);
                 }
                 }
@@ -675,8 +685,18 @@ IES Morning Report:
                     var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id)  && !string.IsNullOrWhiteSpace(x.mail));
                     var coreUser = coreUsers.Find(x => x.id.Equals(teacher.id)  && !string.IsNullOrWhiteSpace(x.mail));
                     if (coreUser!=null)
                     if (coreUser!=null)
                     {
                     {
-                        var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name,sender:"TEAMModel");
-                        //await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail }, { "tid", "1234" }, { "vars", new { title = title, body = template } } }, coreAPIHttpService.options.location, _configuration);
+                       // var token = _mailFactory.GetSmtpClient().SendEmail(_azureCosmos, dingDing, eventId, title, template, coreUser.mail, teacher.id, teacher.name,sender:"TEAMModel");
+
+                        var tid = string.Empty ;
+                        if (coreAPIHttpService.options.location.Contains("China"))
+                        {
+                            tid=lang.Equals("zh-cn") ? "IES5GeneralTemplate" : lang.Equals("zh-tw") ? "IES5GeneralTemplate" : "IES5GeneralTemplate";
+                        }
+                        else {
+                            tid=lang.Equals("zh-cn")? "d-270b4ec690f541a9a4045d7a4032bc3b" : lang.Equals("zh-tw") ? "d-136eddbd974046f1a721c8f4e210b9bf" : "d-95ac2d657d1b4d9dbb7b79defc17f714";
+                        }
+
+                        await coreAPIHttpService.SendMail(new Dictionary<string, object> { { "to", coreUser.mail }, { "tid", tid }, { "vars", new { title = title, notificationcontent = template } } }, coreAPIHttpService.options.location, _configuration);
                     }
                     }
                     notify.Append(template);
                     notify.Append(template);
                 }
                 }

+ 23 - 0
TEAMModelOS/Controllers/Both/PaperController.cs

@@ -175,8 +175,31 @@ namespace TEAMModelOS.Controllers
             
             
             if (scope.ToString().Equals("school"))
             if (scope.ToString().Equals("school"))
             {
             {
+
+                var authData = HttpContext.GetAuthTokenKey("Roles");
+                object _roles = null, _permissions = null;
+                HttpContext?.Items.TryGetValue("Roles", out _roles);
+                HttpContext?.Items.TryGetValue("Permissions", out _permissions);
+                List<string> rolse = new List<string>();
+                if (_roles!= null)
+                {
+                    rolse= (List<string>)_roles;
+                }
+                List<string> permissions = new List<string>();
+                if (_permissions!= null)
+                {
+                    permissions= (List<string>)_permissions;
+                }
                 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");
                 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);
                 AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
+
+                //if (rolse.Contains("admin"))
+                //{
+                //   // cosmosDbQuery.QueryText= cosmosDbQuery.QueryText.Replace("where", $" where (( IS_DEFINED(c.secret) = false or  c.secret=0 )  or  c.secret=1 ) and  ");
+                //}
+                //else {
+                //    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  ");
+                //}
                 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  ");
                 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}") }))
                 await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<Paper>(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Paper-{code}") }))
                 {
                 {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7 - 23
TEAMModelOS/Controllers/System/WeChatPayController.cs