소스 검색

班级学生名单id信息

CrazyIter_Bin 3 년 전
부모
커밋
a2067d31c4

+ 7 - 7
TEAMModelFunction/ActivityHttpTrigger.cs

@@ -70,7 +70,7 @@ namespace TEAMModelFunction
                     {
                         if (!string.IsNullOrEmpty(sc.stulist))
                         {
-                            (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string>() { sc.stulist }, course.school);
+                            (List<TmdInfo> tmdids, List<StuInfo> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string>() { sc.stulist }, course.school);
                             foreach (var addStu in studentss)
                             {
                                 var stuCourse = new StuCourse
@@ -148,7 +148,7 @@ namespace TEAMModelFunction
                     {
                         sub.Add(subject.id);
                     }
-                    (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
+                    (List<TmdInfo> tmdids, List<StuInfo> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
                     List<StuActivity> stuActivities = new List<StuActivity>();
                     List<StuActivity> tmdActivities = new List<StuActivity>();
                     if (tmdids.IsNotEmpty())
@@ -158,7 +158,7 @@ namespace TEAMModelFunction
                             {
                                 pk = "Activity",
                                 id = info.id,
-                                code = $"Activity-{x}",
+                                code = $"Activity-{x.tmdid}",
                                 type = "exam",
                                 name = info.name,
                                 startTime = info.startTime,
@@ -242,7 +242,7 @@ namespace TEAMModelFunction
                         continue;
                     }
                    
-                    (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
+                    (List<TmdInfo> tmdids, List<StuInfo> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
                     List<StuActivity> stuActivities = new List<StuActivity>();
                     List<StuActivity> tmdActivities = new List<StuActivity>();
                     if (tmdids.IsNotEmpty())
@@ -252,7 +252,7 @@ namespace TEAMModelFunction
                             {
                                 pk = "Activity",
                                 id = info.id,
-                                code = $"Activity-{x}",
+                                code = $"Activity-{x.tmdid}",
                                 type = "vote",
                                 name = info.name,
                                 startTime = info.startTime,
@@ -335,7 +335,7 @@ namespace TEAMModelFunction
                     {
                         continue;
                     }
-                    (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
+                    (List<TmdInfo> tmdids, List<StuInfo> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
                     List<StuActivity> stuActivities = new List<StuActivity>();
                     List<StuActivity> tmdActivities = new List<StuActivity>();
                     if (tmdids.IsNotEmpty())
@@ -345,7 +345,7 @@ namespace TEAMModelFunction
                             {
                                 pk = "Activity",
                                 id = info.id,
-                                code = $"Activity-{x}",
+                                code = $"Activity-{x.tmdid}",
                                 type = "survey",
                                 name = info.name,
                                 startTime = info.startTime,

+ 17 - 16
TEAMModelFunction/CourseServiceBus.cs

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelFunction
@@ -43,7 +44,7 @@ namespace TEAMModelFunction
                     return;
                 }
                 foreach (var cls in courseChange.addClass) {
-                    (List<string> addTmdidsCls, List<Students> addStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing,new List<string> { cls}, courseChange.school);
+                    (List<TmdInfo> addTmdidsCls, List<Students> addStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing,new List<string> { cls}, courseChange.school);
                     foreach (var stu in addStudentsCls) {
                         try
                         {
@@ -77,12 +78,12 @@ namespace TEAMModelFunction
                     {
                         try
                         {
-                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             if (!stuCourse.Value.classId.Contains(cls))
                             {
                                 stuCourse.Value.classId.Add(cls);
                             }
-                            await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                            await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                         }
                         catch (CosmosException ex)
                         {
@@ -93,7 +94,7 @@ namespace TEAMModelFunction
                                     id = courseChange.id,
                                     scode = courseChange.code,
                                     name = courseChange.name,
-                                    code = $"StuCourse-{tmd}",
+                                    code = $"StuCourse-{tmd.tmdid}",
                                     scope = courseChange.scope,
                                     school = courseChange.school,
                                     creatorId = courseChange.creatorId,
@@ -108,7 +109,7 @@ namespace TEAMModelFunction
 
                 foreach (var list in courseChange.addList)
                 {
-                    (List<string> addTmdidsCls, List<Students> addStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { list }, courseChange.school);
+                    (List<TmdInfo> addTmdidsCls, List<Students> addStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { list }, courseChange.school);
                     foreach (var stu in addStudentsCls)
                     {
                         try
@@ -144,11 +145,11 @@ namespace TEAMModelFunction
                     {
                         try
                         {
-                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             if (!stuCourse.Value.stulist.Contains(list))
                             {
                                 stuCourse.Value.stulist.Add(list);
-                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             }
                             
                         }
@@ -161,7 +162,7 @@ namespace TEAMModelFunction
                                     id = courseChange.id,
                                     scode = courseChange.code,
                                     name = courseChange.name,
-                                    code = $"StuCourse-{tmd}",
+                                    code = $"StuCourse-{tmd.tmdid}",
                                     scope = courseChange.scope,
                                     school = courseChange.school,
                                     creatorId = courseChange.creatorId,
@@ -175,7 +176,7 @@ namespace TEAMModelFunction
                 }
 
                 foreach (var delCls in courseChange.delClass) {
-                    (List<string> delTmdidsCls, List<Students> delStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { delCls }, courseChange.school);
+                    (List<TmdInfo> delTmdidsCls, List<Students> delStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { delCls }, courseChange.school);
                     foreach (var stu in delStudentsCls)
                     {
                         try
@@ -206,7 +207,7 @@ namespace TEAMModelFunction
                     {
                         try
                         {
-                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
 
                             if (stuCourse.Value.classId.Contains(delCls))
                             {
@@ -216,11 +217,11 @@ namespace TEAMModelFunction
                             if (!stuCourse.Value.classId.IsNotEmpty() && !stuCourse.Value.stulist.IsNotEmpty())
                             {
                                 //当两个列表都不存在时则直接删除
-                                await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                                await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             }
                             else
                             {
-                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             }
 
                         }
@@ -232,7 +233,7 @@ namespace TEAMModelFunction
                 }
                 foreach (var delList in courseChange.delList)
                 {
-                    (List<string> delTmdidsCls, List<Students> delStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { delList }, courseChange.school);
+                    (List<TmdInfo> delTmdidsCls, List<Students> delStudentsCls) = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { delList }, courseChange.school);
                     foreach (var stu in delStudentsCls)
                     {
                         try
@@ -264,7 +265,7 @@ namespace TEAMModelFunction
                     {
                         try
                         {
-                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                            ItemResponse<StuCourse> stuCourse = await client.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
 
                             if (stuCourse.Value.stulist.Contains(delList))
                             {
@@ -274,11 +275,11 @@ namespace TEAMModelFunction
                             if (!stuCourse.Value.classId.IsNotEmpty() && !stuCourse.Value.stulist.IsNotEmpty())
                             {
                                 //当两个列表都不存在时则直接删除
-                                await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                                await client.GetContainer("TEAMModelOS", "Teacher").DeleteItemAsync<StuCourse>(courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             }
                             else
                             {
-                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd}"));
+                                await client.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<StuCourse>(stuCourse, courseChange.id, new PartitionKey($"StuCourse-{tmd.tmdid}"));
                             }
 
                         }

+ 144 - 144
TEAMModelFunction/NoticeServiceBus.cs

@@ -1,151 +1,151 @@
-using System;
-using System.Collections.Generic;
-using System.Text.Json;
-using System.Threading.Tasks;
-using Azure.Cosmos;
-using Azure.Messaging.ServiceBus;
-using Microsoft.Azure.WebJobs;
-using Microsoft.Azure.WebJobs.Host;
-using Microsoft.Extensions.Logging;
-using StackExchange.Redis;
-using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.Extension;
-using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
-using TEAMModelOS.SDK.Models;
-using TEAMModelOS.SDK.Models.Cosmos.Common;
-namespace TEAMModelFunction
-{
-    public class NoticeServiceBus
-    {
-        private readonly AzureCosmosFactory _azureCosmos;
-        private readonly DingDing _dingDing;
-        private readonly AzureStorageFactory _azureStorage;
-        private readonly AzureRedisFactory _azureRedis;
-        private readonly AzureServiceBusFactory _serviceBus;
-        public NoticeServiceBus(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus)
-        {
-            _azureCosmos = azureCosmos;
-            _dingDing = dingDing;
-            _azureStorage = azureStorage;
-            _azureRedis = azureRedis;
-            _serviceBus = serviceBus;
-        }
-        [FunctionName("Notice")]
-        public async Task Notice([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "notice", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
-        {
-            var client = _azureRedis.GetRedisClient(8);
-            try
-            {
+//using System;
+//using System.Collections.Generic;
+//using System.Text.Json;
+//using System.Threading.Tasks;
+//using Azure.Cosmos;
+//using Azure.Messaging.ServiceBus;
+//using Microsoft.Azure.WebJobs;
+//using Microsoft.Azure.WebJobs.Host;
+//using Microsoft.Extensions.Logging;
+//using StackExchange.Redis;
+//using TEAMModelOS.SDK.DI;
+//using TEAMModelOS.SDK.Extension;
+//using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
+//using TEAMModelOS.SDK.Models;
+//using TEAMModelOS.SDK.Models.Cosmos.Common;
+//namespace TEAMModelFunction
+//{
+//    public class NoticeServiceBus
+//    {
+//        private readonly AzureCosmosFactory _azureCosmos;
+//        private readonly DingDing _dingDing;
+//        private readonly AzureStorageFactory _azureStorage;
+//        private readonly AzureRedisFactory _azureRedis;
+//        private readonly AzureServiceBusFactory _serviceBus;
+//        public NoticeServiceBus(AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus)
+//        {
+//            _azureCosmos = azureCosmos;
+//            _dingDing = dingDing;
+//            _azureStorage = azureStorage;
+//            _azureRedis = azureRedis;
+//            _serviceBus = serviceBus;
+//        }
+//        [FunctionName("Notice")]
+//        public async Task Notice([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "notice", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
+//        {
+//            var client = _azureRedis.GetRedisClient(8);
+//            try
+//            {
 
-                // List<Task<string>> tasks = new List<Task<string>>();
-                //List<Task> sessionTasks = new List<Task>();
-                var jsonMsg = JsonDocument.Parse(msg);
-                Notice notice = msg.ToObject<Notice>();
-                var blobcntr = "";
-                if (notice.scope.Equals("school"))
-                {
-                    blobcntr = notice.school;
-                }
-                else
-                {
-                    blobcntr = notice.creatorId;
-                }
-                if (string.IsNullOrEmpty(blobcntr))
-                {
-                    return;
-                }
-#if DEBUG
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice:\n发起通知{msg}", GroupNames.成都开发測試群組);
-#endif
-                long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                long day30 = 2592000L;
-                //处理过期时间大于30天
-                if (notice.expire - now > day30) {
-                    notice.expire = now + day30;
-                }
-                //通知的主体内容
-                var urlNotice = $"{notice.msgId}.json";
-                var blobNotice = new
-                {
-                    notice.type,
-                    notice.priority,
-                    notice.from,
-                    notice.toservice,
-                    notice.creation,//创建时间
-                    notice.expire,//到期时间
-                    notice.msgId,
-                    notice.creatorId,
-                    notice.school,
-                    notice.scope,
-                    notice.body,
-                };
-                //通知的接收人的集合信息
-                await _azureStorage.UploadFileByContainer(blobcntr, blobNotice.ToJsonString(), "notice", urlNotice);
-                var urlReceiver = $"{notice.msgId}_receiver.json";
-                var blobReceiver = new
-                {
-                    notice.stuids,
-                    notice.tmdids
-                };
-                await _azureStorage.UploadFileByContainer(blobcntr, blobReceiver.ToJsonString(), "notice", urlReceiver);
+//                // List<Task<string>> tasks = new List<Task<string>>();
+//                //List<Task> sessionTasks = new List<Task>();
+//                var jsonMsg = JsonDocument.Parse(msg);
+//                Notice notice = msg.ToObject<Notice>();
+//                var blobcntr = "";
+//                if (notice.scope.Equals("school"))
+//                {
+//                    blobcntr = notice.school;
+//                }
+//                else
+//                {
+//                    blobcntr = notice.creatorId;
+//                }
+//                if (string.IsNullOrEmpty(blobcntr))
+//                {
+//                    return;
+//                }
+//#if DEBUG
+//                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice:\n发起通知{msg}", GroupNames.成都开发測試群組);
+//#endif
+//                long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
+//                long day30 = 2592000L;
+//                //处理过期时间大于30天
+//                if (notice.expire - now > day30) {
+//                    notice.expire = now + day30;
+//                }
+//                //通知的主体内容
+//                var urlNotice = $"{notice.msgId}.json";
+//                var blobNotice = new
+//                {
+//                    notice.type,
+//                    notice.priority,
+//                    notice.from,
+//                    notice.toservice,
+//                    notice.creation,//创建时间
+//                    notice.expire,//到期时间
+//                    notice.msgId,
+//                    notice.creatorId,
+//                    notice.school,
+//                    notice.scope,
+//                    notice.body,
+//                };
+//                //通知的接收人的集合信息
+//                await _azureStorage.UploadFileByContainer(blobcntr, blobNotice.ToJsonString(), "notice", urlNotice);
+//                var urlReceiver = $"{notice.msgId}_receiver.json";
+//                var blobReceiver = new
+//                {
+//                    notice.stuids,
+//                    notice.tmdids
+//                };
+//                await _azureStorage.UploadFileByContainer(blobcntr, blobReceiver.ToJsonString(), "notice", urlReceiver);
 
-                //发送通知给用户
+//                //发送通知给用户
                
-                // "ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200)
+//                // "ttl":2592000,不能超过30天(2592000),一天(3600),一周(25200)
 
-                if (notice.stuids.IsNotEmpty())
-                {
-                    //  List<Receiver> receivers = new List<Receiver>();
-                    foreach (var stu in notice.stuids)
-                    {
-                        Receiver receiver = new Receiver
-                        {
-                            id = notice.msgId,
-                            status = 0,
-                            ctime = now,
-                            urlNotice = $"/notice/{urlNotice}",
-                        };
-                        var url = $"{stu.id}/receive/{notice.msgId}.json";
-                        await client.HashSetAsync($"Notice:Receiver:{stu.schoolId}-{stu.id}", notice.msgId, $"/student/{url}");
-                        // await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver,new Azure.Cosmos.PartitionKey(receiver.code));
-                        //  /student/{stuid}/receive/{notice.sid}.json
-                        //存放通知到学生容器空间
+//                if (notice.stuids.IsNotEmpty())
+//                {
+//                    //  List<Receiver> receivers = new List<Receiver>();
+//                    foreach (var stu in notice.stuids)
+//                    {
+//                        Receiver receiver = new Receiver
+//                        {
+//                            id = notice.msgId,
+//                            status = 0,
+//                            ctime = now,
+//                            urlNotice = $"/notice/{urlNotice}",
+//                        };
+//                        var url = $"{stu.id}/receive/{notice.msgId}.json";
+//                        await client.HashSetAsync($"Notice:Receiver:{stu.schoolId}-{stu.id}", notice.msgId, $"/student/{url}");
+//                        // await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver,new Azure.Cosmos.PartitionKey(receiver.code));
+//                        //  /student/{stuid}/receive/{notice.sid}.json
+//                        //存放通知到学生容器空间
 
-                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "student", url);
-                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{stu.schoolId}-{stu.id}" };
-                        // messageBlob.ApplicationProperties.Add("name", "Receiver");
-                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
-                    }
-                }
-                if (notice.tmdids.IsNotEmpty())
-                {
-                    foreach (var tmdid in notice.tmdids)
-                    {
-                        Receiver receiver = new Receiver
-                        {
-                            id = notice.msgId,
-                            status = 0,
-                            ctime = now,
-                            urlNotice = $"/notice/{urlNotice}",
-                        };
-                        var url = $"{notice.msgId}.json";
-                        await client.HashSetAsync($"Notice:Receiver:{tmdid}", notice.msgId, receiver.ToJsonString());
-                        //await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver, new Azure.Cosmos.PartitionKey(receiver.code));
-                        //  /student/{stuid}/receive/{notice.sid}.json
-                        //存放通知到学生容器空间
+//                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "student", url);
+//                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{stu.schoolId}-{stu.id}" };
+//                        // messageBlob.ApplicationProperties.Add("name", "Receiver");
+//                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
+//                    }
+//                }
+//                if (notice.tmdids.IsNotEmpty())
+//                {
+//                    foreach (var tmdid in notice.tmdids)
+//                    {
+//                        Receiver receiver = new Receiver
+//                        {
+//                            id = notice.msgId,
+//                            status = 0,
+//                            ctime = now,
+//                            urlNotice = $"/notice/{urlNotice}",
+//                        };
+//                        var url = $"{notice.msgId}.json";
+//                        await client.HashSetAsync($"Notice:Receiver:{tmdid}", notice.msgId, receiver.ToJsonString());
+//                        //await client.GetContainer("TEAMModelOS", "Common").UpsertItemAsync<Receiver>(receiver, new Azure.Cosmos.PartitionKey(receiver.code));
+//                        //  /student/{stuid}/receive/{notice.sid}.json
+//                        //存放通知到学生容器空间
 
-                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "receive", url);
-                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{tmdid}" };
-                        //messageBlob.ApplicationProperties.Add("name", "Receiver");
-                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice\n{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
-            }
-        }
+//                        await _azureStorage.UploadFileByContainer(blobcntr, receiver.ToJsonString(), "receive", url);
+//                        var messageBlob = new ServiceBusMessage(receiver.ToJsonString()) { SessionId = $"{tmdid}" };
+//                        //messageBlob.ApplicationProperties.Add("name", "Receiver");
+//                        await _serviceBus.GetServiceBusClient().SendMessageAsync("notice-task", messageBlob);
+//                    }
+//                }
+//            }
+//            catch (Exception ex)
+//            {
+//                await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-NoticeServiceBus-Notice\n{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
+//            }
+//        }
 
-    }
-}
+//    }
+//}

+ 17 - 17
TEAMModelFunction/TriggerExam.cs

@@ -92,7 +92,7 @@ namespace TEAMModelFunction
                         }
                         break;
                     case "going":
-                        (List<string> tmdids, List<Students> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
+                        (List<TmdInfo> tmdids, List<StuInfo> studentss) = await TriggerStuActivity.GetStuList(client, _dingDing, info.classes, info.school);
                         List<StuActivity> stuActivities = new List<StuActivity>();
                         List<StuActivity> tmdActivities = new List<StuActivity>();
                         try
@@ -105,7 +105,7 @@ namespace TEAMModelFunction
                                     {
                                         pk = "Activity",
                                         id = info.id,
-                                        code = $"Activity-{x}",
+                                        code = $"Activity-{x.tmdid}",
                                         type = "Exam",
                                         name = info.name,
                                         startTime = info.startTime,
@@ -147,22 +147,22 @@ namespace TEAMModelFunction
                             await TriggerStuActivity.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities);
                             //向学生或醍摩豆账号发起通知
                             #region
-                            Notice notice = new Notice()
-                            {
-                                msgId = info.id,
-                                creation = info.startTime,
-                                expire = info.endTime,
-                                creatorId = info.creatorId,
-                                stuids = studentss,
-                                tmdids = tmdids,
-                                type = "notice",//评测参加通知
-                                priority = "normal",
-                                school = info.school,
-                                scope = info.scope,
-                                //data = new { }.ToJsonString()
-                                body = new Body { sid = info.id, scode = info.code, spk = info.pk, biztype = "exam-join" }
+                            //Notice notice = new Notice()
+                            //{
+                            //    msgId = info.id,
+                            //    creation = info.startTime,
+                            //    expire = info.endTime,
+                            //    creatorId = info.creatorId,
+                            //    stuids = studentss,
+                            //    tmdids = tmdids,
+                            //    type = "notice",//评测参加通知
+                            //    priority = "normal",
+                            //    school = info.school,
+                            //    scope = info.scope,
+                            //    //data = new { }.ToJsonString()
+                            //    body = new Body { sid = info.id, scode = info.code, spk = info.pk, biztype = "exam-join" }
 
-                            };
+                            //};
                             //var messageBlob = new ServiceBusMessage(notice.ToJsonString());
                             //messageBlob.ApplicationProperties.Add("name", "Notice");
                             //await _serviceBus.GetServiceBusClient().SendMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageBlob);

+ 17 - 17
TEAMModelFunction/TriggerSurvey.cs

@@ -73,7 +73,7 @@ namespace TEAMModelFunction
                             }
                             break;
                         case "going":
-                            (List<string> tmdids, List<Students> students) = await TriggerStuActivity.GetStuList(client, _dingDing, survey.classes, survey.school);
+                            (List<TmdInfo> tmdids, List<StuInfo> students) = await TriggerStuActivity.GetStuList(client, _dingDing, survey.classes, survey.school);
 #if DEBUG
                             await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}问卷调查{tdata.id}写入学生表作为活动列表!", GroupNames.成都开发測試群組);
 #endif
@@ -86,7 +86,7 @@ namespace TEAMModelFunction
                                     {
                                         pk = "Activity",
                                         id = survey.id,
-                                        code = $"Activity-{x}",
+                                        code = $"Activity-{x.tmdid}",
                                         type = "Survey",
                                         name = survey.name,
                                         startTime = survey.startTime,
@@ -127,22 +127,22 @@ namespace TEAMModelFunction
                             await TriggerStuActivity.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities);
                             //向学生或醍摩豆账号发起通知
                             #region
-                            Notice notice = new Notice()
-                            {
-                                creation = survey.startTime,
-                                expire = survey.endTime,
-                                creatorId = survey.creatorId,
-                                stuids = students,
-                                tmdids = tmdids,
-                                type = "notice",//问卷参加参加通知
-                                priority = "normal",
-                                //data = new { }.ToJsonString()
-                                msgId = survey.id,
-                                school = survey.school,
-                                scope = survey.scope,
-                                body = new Body { sid = survey.id, scode = survey.code, spk = survey.pk, biztype = "survey-join" }
+                            //Notice notice = new Notice()
+                            //{
+                            //    creation = survey.startTime,
+                            //    expire = survey.endTime,
+                            //    creatorId = survey.creatorId,
+                            //    stuids = students,
+                            //    tmdids = tmdids,
+                            //    type = "notice",//问卷参加参加通知
+                            //    priority = "normal",
+                            //    //data = new { }.ToJsonString()
+                            //    msgId = survey.id,
+                            //    school = survey.school,
+                            //    scope = survey.scope,
+                            //    body = new Body { sid = survey.id, scode = survey.code, spk = survey.pk, biztype = "survey-join" }
 
-                            };
+                            //};
                             //var messageBlob = new ServiceBusMessage(notice.ToJsonString());
                             //messageBlob.ApplicationProperties.Add("name", "Notice");
                             //await _serviceBus.GetServiceBusClient().SendMessageAsync(Environment.GetEnvironmentVariable("Azure:ServiceBus:ActiveTask"), messageBlob);

+ 17 - 17
TEAMModelFunction/TriggerVote.cs

@@ -71,10 +71,10 @@ namespace TEAMModelFunction
                         break;
                     case "going":
                         
-                        (List<string> tmdids, List<Students> students) = await TriggerStuActivity.GetStuList(client, _dingDing, vote.classes, vote.school);
+                        (List<TmdInfo> tmdids, List<StuInfo> students) = await TriggerStuActivity.GetStuList(client, _dingDing, vote.classes, vote.school);
                         List<string> tmds = vote.tmdids.IsNotEmpty() ? vote.tmdids : new List<string>() ;
                         if (tmdids.IsNotEmpty()) {
-                            tmds.AddRange(tmdids);
+                            tmds.AddRange(tmdids.Select(x=>x.tmdid).ToList());
                         }
                         List<StuActivity> stuActivities = new List<StuActivity>();
                         List<StuActivity> tmdActivities = new List<StuActivity>();
@@ -125,23 +125,23 @@ namespace TEAMModelFunction
                         await TriggerStuActivity.SaveStuActivity(client, _dingDing, stuActivities, tmdActivities);
                         //向学生或醍摩豆账号发起通知
                         #region
-                        Notice notice = new Notice()
-                        {
+                        //Notice notice = new Notice()
+                        //{
                            
-                            creation = vote.startTime,
-                            expire = vote.endTime,
-                            creatorId = vote.creatorId,
-                            stuids = students,
-                            tmdids = tmdids,
-                            type = "notice",//问卷参加参加通知
-                            priority = "normal",
-                            msgId=vote.id,
-                            school = vote.school,
-                            scope = vote.scope,
-                            //data = new { }.ToJsonString()
-                            body = new Body { sid = vote.id, scode = vote.code, spk = vote.pk,  biztype = "vote-join" }
+                        //    creation = vote.startTime,
+                        //    expire = vote.endTime,
+                        //    creatorId = vote.creatorId,
+                        //    stuids = students,
+                        //    tmdids = tmdids,
+                        //    type = "notice",//问卷参加参加通知
+                        //    priority = "normal",
+                        //    msgId=vote.id,
+                        //    school = vote.school,
+                        //    scope = vote.scope,
+                        //    //data = new { }.ToJsonString()
+                        //    body = new Body { sid = vote.id, scode = vote.code, spk = vote.pk,  biztype = "vote-join" }
 
-                        };
+                        //};
 
                         //var messageBlob = new ServiceBusMessage(notice.ToJsonString());
                         //messageBlob.ApplicationProperties.Add("name", "Notice");

+ 57 - 57
TEAMModelOS.SDK/Models/Cosmos/Common/Notice.cs

@@ -38,64 +38,64 @@ namespace TEAMModelOS.SDK.Models
     ///             stuid:/student/stuid/receiver/xxxx时间戳排序.json
     ///             tmdid:/receiver/xxxx时间戳排序.json
     /// </summary>
-    public class Notice
-    { 
-        /// <summary>
-        ///  訊息種類 message:訊息,收取會另存至儲存體(blob or table) notice:通知,收取後不另存 
-        /// XXXX通知的业务类型,做什么事情用,具体业务类型再定义。 vote-join 
-        /// </summary>
-        public string type { get; set; }
-        /// <summary>
-        /// 重要等级 emergency、high、normal、low 1置顶,2非常重要,3重要,4普通消息,5不重要
-        /// </summary>
-        public string priority { get; set; }
-        /// <summary>
-        /// 發信源服務  IES5
-        /// </summary>
-        public string from { get; set; } = "IES5";
-        /// <summary>
-        /// 服務收信對象 若任一服務皆可收,則不填;指定某服務才收,則填服務名稱 例:HiT
-        /// </summary>
-        public string toservice { get; set; }
-        /// <summary>
-        /// 到期时间,发给接收者的cosmosDB ttl是从当前时间到结束时间为止
-        /// </summary>
-        public long expire { get; set; }
-        /// <summary>
-        /// 创建时间
-        /// </summary>
-        public long creation { get; set; }
-        /// <summary>
-        /// 消息id 
-        /// </summary>
-        public string msgId { get; set; }
-        /// <summary>
-        /// 正文內容
-        /// </summary>
-        public Body body { get; set; }
-        /// <summary>
-        /// 创建者
-        /// </summary>
-        public string creatorId { get; set; }
-        /// <summary>
-        /// 源数据的学校编码
-        /// </summary>
-        public string school { get; set; }
-        /// <summary>
-        /// 源数据的scope
-        /// </summary>
-        public string scope { get; set; }
-        /// 通知主体的被通知人存放位置:  /notice/{业务id}_receiver.json
-        /// <summary>
-        /// 被通知的醍摩豆账号
-        /// </summary>
-        public List<string> tmdids { get; set; }
-        /// <summary>
-        /// 被通知的学校学生账号
-        /// </summary>
-        public List<Students> stuids { get; set; }
+    //public class Notice
+    //{ 
+    //    /// <summary>
+    //    ///  訊息種類 message:訊息,收取會另存至儲存體(blob or table) notice:通知,收取後不另存 
+    //    /// XXXX通知的业务类型,做什么事情用,具体业务类型再定义。 vote-join 
+    //    /// </summary>
+    //    public string type { get; set; }
+    //    /// <summary>
+    //    /// 重要等级 emergency、high、normal、low 1置顶,2非常重要,3重要,4普通消息,5不重要
+    //    /// </summary>
+    //    public string priority { get; set; }
+    //    /// <summary>
+    //    /// 發信源服務  IES5
+    //    /// </summary>
+    //    public string from { get; set; } = "IES5";
+    //    /// <summary>
+    //    /// 服務收信對象 若任一服務皆可收,則不填;指定某服務才收,則填服務名稱 例:HiT
+    //    /// </summary>
+    //    public string toservice { get; set; }
+    //    /// <summary>
+    //    /// 到期时间,发给接收者的cosmosDB ttl是从当前时间到结束时间为止
+    //    /// </summary>
+    //    public long expire { get; set; }
+    //    /// <summary>
+    //    /// 创建时间
+    //    /// </summary>
+    //    public long creation { get; set; }
+    //    /// <summary>
+    //    /// 消息id 
+    //    /// </summary>
+    //    public string msgId { get; set; }
+    //    /// <summary>
+    //    /// 正文內容
+    //    /// </summary>
+    //    public Body body { get; set; }
+    //    /// <summary>
+    //    /// 创建者
+    //    /// </summary>
+    //    public string creatorId { get; set; }
+    //    /// <summary>
+    //    /// 源数据的学校编码
+    //    /// </summary>
+    //    public string school { get; set; }
+    //    /// <summary>
+    //    /// 源数据的scope
+    //    /// </summary>
+    //    public string scope { get; set; }
+    //    /// 通知主体的被通知人存放位置:  /notice/{业务id}_receiver.json
+    //    /// <summary>
+    //    /// 被通知的醍摩豆账号
+    //    /// </summary>
+    //    public List<string> tmdids { get; set; }
+    //    /// <summary>
+    //    /// 被通知的学校学生账号
+    //    /// </summary>
+    //    public List<Students> stuids { get; set; }
        
-    }
+    //}
 
     /// <summary>
     /// 传输数据josn

+ 0 - 2
TEAMModelOS.SDK/Models/Cosmos/Common/StuList.cs

@@ -23,8 +23,6 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         public string id { get; set; }
         public string code { get; set; }
         public string schoolId { get; set; }
-        public string name { get; set; }
-        public string picture { get; set; }
     }
     //public class CourseInfo
     //{

+ 11 - 0
TEAMModelOS.SDK/Models/Cosmos/Common/TmdInfo.cs

@@ -8,5 +8,16 @@ namespace TEAMModelOS.SDK.Models
     {
         public string tmdid { get; set; }
         public string tmdname { get; set; }
+        public string picture { get; set; }
+    }
+    public class StuInfo
+    {
+        public string id { get; set; }
+        public string code { get; set; }
+        public string name { get; set; }
+        public string picture { get; set; }
+        public string classId { get; set; }
+        public int year { get; set; }
+        public string schoolId { get; set; }
     }
 }

+ 67 - 15
TEAMModelOS.SDK/Models/Service/TriggerStuActivity.cs

@@ -31,17 +31,17 @@ namespace TEAMModelFunction
             }
             if (activity != null)
             {
-                (List<string> tmdids, List<Students> students) = await GetStuList(client, _dingDing, activity.classes, activity.school);
+                (List<TmdInfo> tmdids, List<StuInfo> students) = await GetStuList(client, _dingDing, activity.classes, activity.school);
                 if (tmdids.IsNotEmpty())
                 {
-                    foreach (string tmdid in tmdids)
+                    foreach (TmdInfo tmdid in tmdids)
                     {
                         var stucourse = new StuActivity
                         {
                             id = activity.id,
                             scode = activity.code,
                             name = activity.name,
-                            code = $"Activity-{tmdid}",
+                            code = $"Activity-{tmdid.tmdid}",
                             scope = activity.scope,
                             school = activity.school,
                             creatorId = activity.creatorId,
@@ -58,7 +58,7 @@ namespace TEAMModelFunction
                 }
                 if (students.IsNotEmpty())
                 {
-                    foreach (Students student in students)
+                    foreach (StuInfo student in students)
                     {
                         var stucourse = new StuActivity
                         {
@@ -105,11 +105,38 @@ namespace TEAMModelFunction
             return ""; 
         }
 
-        public static async Task<(List<string> tmdids, List<Students> studentss)> GetStuList(CosmosClient client, DingDing _dingDing, List<string> classes, string school) {
+        public static async Task<List<ClassInfo>> GetClassInfo(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
+        {
+            List<ClassInfo> classInfos = new List<ClassInfo>();
+            List<string> sqlList = new List<string>();
+            classes.ForEach(x => { sqlList.Add($" '{x}' "); });
+            string sql = string.Join(" , ", sqlList);
+            if (!string.IsNullOrEmpty(school)) {
+                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                   requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
+                {
+                    classInfos.Add(item);
+                }
+                await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                  requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
+                {
+                    classInfos.Add(item);
+                }
+            }
+            List<StuList> tchLists = new List<StuList>();
+            await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
+                requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
+            {
+                classInfos.Add(item);
+            }
+            return classInfos;
+        }
+            public static async Task<(List<TmdInfo> tmdids, List<StuInfo> students)> GetStuList(CosmosClient client, DingDing _dingDing, List<string> classes, string school) {
             try {
-                List<string> tmdids = new List<string>();
+                List<TmdInfo> tmdids = new List<TmdInfo>();
                 List<Students> studentss = new List<Students>();
-                if (!classes.IsNotEmpty()) { return (tmdids, studentss); }
+                List<StuInfo> stuInfos = new List<StuInfo>();
+                if (!classes.IsNotEmpty()) { return (tmdids, new List<StuInfo>()); }
                 List<string> sqlList = new List<string>();
                 classes.ForEach(x => { sqlList.Add($" '{x}' "); });
                 string sql = string.Join(" , ", sqlList);
@@ -136,30 +163,55 @@ namespace TEAMModelFunction
                     tchLists.Add(item);
                 }
 
-                schList.ForEach(x => {
+                foreach(var x  in schList) {
                     if (x.students.IsNotEmpty())
                     {
                         studentss.AddRange(x.students);
                     }
                     if (x.tmids.IsNotEmpty())
                     {
-                        tmdids.AddRange(x.tmids);
+                        List<TmdInfo> infos = new List<TmdInfo>();
+                        List<string> inids = new List<string>();
+                        x.tmids.ForEach(x => { inids.Add($"'{x}'"); });
+                        var insql = string.Join(",", inids);
+                        var queryslt = $"SELECT  value(c) FROM c where c.id in ({insql})";
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") })) {
+                            infos.Add(item);
+                        }
+                        tmdids.AddRange(infos);
                     }
-                });
-                tchLists.ForEach(x =>
+                }
+                foreach (var x in tchLists) 
                 {
                     if (x.students.IsNotEmpty()) {
                         studentss.AddRange(x.students);
                     }
                     if (x.tmids.IsNotEmpty())
                     {
-                        tmdids.AddRange(x.tmids);
+                        List<TmdInfo> infos = new List<TmdInfo>();
+                        List<string> inids = new List<string>();
+                        x.tmids.ForEach(x => { inids.Add($"'{x}'"); });
+                        var insql = string.Join(",", inids);
+                        var queryslt = $"SELECT  value(c) FROM c where c.id in ({insql})";
+                        await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
+                        {
+                            infos.Add(item);
+                        }
+                        tmdids.AddRange(infos);
                     }
-                });
+                }
                 students.ForEach(x => {
-                    studentss.Add(new Students { id = x.id, code = x.code, schoolId = x.schoolId,name=x.name,picture=x.picture });
+                    studentss.Add(new Students { id = x.id, code = x.code, schoolId = x.schoolId });
                 });
-                return (tmdids, studentss);
+                List<string> inidstus = new List<string>();
+                studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
+                var insqlstu = string.Join(",", inidstus);
+                var querystu = $"SELECT  c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
+                await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
+                {
+                    stuInfos.Add(item);
+                }
+                return (tmdids, stuInfos);
             }
             catch (Exception ex)
             {

+ 4 - 4
TEAMModelOS/Controllers/Client/HiScanController.cs

@@ -186,7 +186,7 @@ namespace TEAMModelOS.Controllers.Core
                     if (exam != null) {
                         foreach (var cls in exam.classes)
                         {
-                            (List<string> tmdids, List<Students> students) stulist = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { cls }, code);
+                            (List<TmdInfo> tmdids, List<StuInfo> students) stulist = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { cls }, code);
                             classes.Add(new ExamClass { classId = cls, tmdids = stulist.tmdids, stulist = stulist.students });
                         }
                         corrects.Add(new   { exam = new { name= exam.name, school =exam.school,
@@ -210,7 +210,7 @@ namespace TEAMModelOS.Controllers.Core
                     List<ExamClass> classes = new List<ExamClass>();
                     foreach (var cls in exam.classes)
                     {
-                        (List<string> tmdids, List<Students> students) stulist = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { cls }, code);
+                        (List<TmdInfo> tmdids, List<StuInfo> students) stulist = await TriggerStuActivity.GetStuList(client, _dingDing, new List<string> { cls }, code);
                         classes.Add(new ExamClass { classId = cls, tmdids = stulist.tmdids, stulist = stulist.students });
                     }
                     corrects.Add(new
@@ -255,7 +255,7 @@ namespace TEAMModelOS.Controllers.Core
    
     public class ExamClass {
         public string classId { get; set; }
-        public List<string> tmdids { get; set; }
-        public List<Students> stulist { get; set; }
+        public List<TmdInfo> tmdids { get; set; }
+        public List<StuInfo> stulist { get; set; }
     }
 }

+ 23 - 1
TEAMModelOS/Controllers/Common/CommonController.cs

@@ -15,6 +15,7 @@ using TEAMModelFunction;
 using TEAMModelOS.Filter;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK.DI;
+using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 
@@ -112,7 +113,28 @@ namespace TEAMModelOS.Controllers.Common
                 return BadRequest(); 
             }
         }
-
+        //立即结束某个活动
+        [ProducesDefaultResponseType]
+       // [AuthToken(Roles = "teacher,admin")]
+        [HttpPost("get-class-info")]
+        public async Task<IActionResult> GetClassInfo(JsonElement element)
+        {
+            //var (id, school) = HttpContext.GetAuthTokenInfo();
+            try
+            {
+                var client = _azureCosmos.GetCosmosClient();
+                if (!element.TryGetProperty("classes", out JsonElement _classes)) return BadRequest();
+                if (!element.TryGetProperty("school", out JsonElement _school)) return BadRequest();
+                List<string> classes = _classes.ToObject<List<string>>();
+               var classInfos=await TriggerStuActivity.GetClassInfo(client, _dingDing, classes, $"{_school}");
+                return Ok(new { classInfos ,code = 200 });
+            }
+            catch (Exception ex)
+            {
+                await _dingDing.SendBotMsg($"OS,{_option.Location},common/get-class-info\n{ex.Message}{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
+                return BadRequest();
+            }
+        }
         //立即结束某个活动
         [ProducesDefaultResponseType]
         [AuthToken(Roles = "teacher,admin")]