TriggerStuActivity.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. using Azure;
  2. using Azure.Cosmos;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Text.Json;
  9. using System.Threading.Tasks;
  10. using TEAMModelOS.SDK.DI;
  11. using TEAMModelOS.SDK.Extension;
  12. using TEAMModelOS.SDK;
  13. using TEAMModelOS.SDK.Models;
  14. using TEAMModelOS.SDK.Models.Cosmos.Common;
  15. using TEAMModelOS.SDK.Models.Service;
  16. using HTEXLib.COMM.Helpers;
  17. namespace TEAMModelFunction
  18. {
  19. public class TriggerStuActivity
  20. {
  21. public static async Task RefreshStuActivity(CosmosClient client, DingDing _dingDing, string id, string code)
  22. {
  23. MQActivity activity = null;
  24. try
  25. {
  26. var aactivity = await client.GetContainer(Constant.TEAMModelOS, "Common").ReadItemStreamAsync(id, new Azure.Cosmos.PartitionKey(code));
  27. using var da = await JsonDocument.ParseAsync(aactivity.ContentStream);
  28. activity = da.ToObject<MQActivity>();
  29. }
  30. catch (CosmosException ex)
  31. {
  32. }
  33. if (activity != null)
  34. {
  35. List<string> classes = ExamService.getClasses(activity.classes, activity.stuLists);
  36. (List<TmdInfo> tmdids, List<StuInfo> students,List<ClassListInfo> classLists) = await GetStuList(client, _dingDing, classes, activity.school);
  37. if (tmdids.IsNotEmpty())
  38. {
  39. foreach (TmdInfo tmdid in tmdids)
  40. {
  41. var stucourse = new StuActivity
  42. {
  43. id = activity.id,
  44. scode = activity.code,
  45. name = activity.name,
  46. code = $"Activity-{tmdid.id}",
  47. scope = activity.scope,
  48. school = activity.school,
  49. creatorId = activity.creatorId,
  50. pk = "Activity",
  51. type = activity.pk,
  52. subjects = activity.pk.ToLower().Equals("exam") && activity.subjects.IsNotEmpty() ? new List<string>() { activity.subjects[0].id } : new List<string>() { "" },
  53. startTime = activity.startTime,
  54. endTime = activity.endTime,
  55. blob = activity.blob,
  56. owner = activity.owner,
  57. createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
  58. taskStatus = -1,
  59. classIds = classes
  60. };
  61. await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
  62. }
  63. }
  64. if (students.IsNotEmpty())
  65. {
  66. foreach (StuInfo student in students)
  67. {
  68. var stucourse = new StuActivity
  69. {
  70. id = activity.id,
  71. scode = activity.code,
  72. name = activity.name,
  73. code = $"Activity-{activity.school}-{student.id}",
  74. scope = activity.scope,
  75. school = activity.school,
  76. creatorId = activity.creatorId,
  77. pk = "Activity",
  78. type = activity.pk,
  79. subjects = activity.pk.ToLower().Equals("exam") && activity.subjects.IsNotEmpty() ? new List<string>() { activity.subjects[0].id } : new List<string>() { "" },
  80. startTime = activity.startTime,
  81. endTime = activity.endTime,
  82. blob = activity.blob,
  83. owner = activity.owner,
  84. createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
  85. taskStatus = -1,
  86. classIds = classes
  87. };
  88. await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(stucourse, new PartitionKey(stucourse.code));
  89. }
  90. }
  91. }
  92. }
  93. public static async Task<string> SaveStuActivity(CosmosClient client, DingDing _dingDing, List<StuActivity> stuActivities,List<StuActivity> tmdActivities) {
  94. try {
  95. if (stuActivities.IsNotEmpty())
  96. {
  97. foreach (var x in stuActivities)
  98. {
  99. await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(x, new PartitionKey(x.code));
  100. }
  101. }
  102. if (tmdActivities.IsNotEmpty())
  103. {
  104. foreach (var x in tmdActivities)
  105. {
  106. await client.GetContainer(Constant.TEAMModelOS, "Student").UpsertItemAsync(x, new PartitionKey(x.code));
  107. }
  108. }
  109. } catch (Exception ex) {
  110. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-OS,TriggerStuActivity-SaveStuActivity\n{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
  111. }
  112. return "";
  113. }
  114. /// <summary>
  115. /// 获取行政班接口
  116. /// </summary>
  117. /// <param name="client"></param>
  118. /// <param name="_dingDing"></param>
  119. /// <param name="classes"></param>
  120. /// <param name="school"></param>
  121. /// <returns></returns>
  122. public static async Task<List<ClassInfo>> GetClassInfo(CosmosClient client, DingDing _dingDing, List<string> classes, string school)
  123. {
  124. try {
  125. List<ClassInfo> classInfos = new List<ClassInfo>();
  126. if (classes.IsNotEmpty()) {
  127. List<string> sqlList = new List<string>();
  128. classes.ForEach(x => { sqlList.Add($" '{x}' "); });
  129. string sql = string.Join(" , ", sqlList);
  130. if (!string.IsNullOrEmpty(school))
  131. {
  132. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name ,c.periodId,c.year from c where c.id in ({sql})",
  133. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{school}") }))
  134. {
  135. classInfos.Add(item);
  136. }
  137. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
  138. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
  139. {
  140. //item.from = "SchStuList";
  141. classInfos.Add(item);
  142. }
  143. }
  144. List<StuList> tchLists = new List<StuList>();
  145. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
  146. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
  147. {
  148. // item.from = "TchStuList";
  149. classInfos.Add(item);
  150. }
  151. classInfos = classInfos.GroupBy(c => c.id).Select(s => s.First()).ToList();
  152. }
  153. return classInfos;
  154. } catch (Exception ex) {
  155. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-OS,TriggerStuActivity-GetClassInfo\n{ex.Message}\n{ex.StackTrace}\n class{classes.ToJsonString()},{school}", GroupNames.醍摩豆服務運維群組);
  156. throw new Exception(ex.Message, ex);
  157. }
  158. }
  159. public static async Task<(List<TmdInfo> tmdinfos, List<StuInfo> students, List<ClassListInfo> classInfo)> GetStuListInStu(CosmosClient client, DingDing _dingDing, List<string> claes, string school)
  160. {
  161. try
  162. {
  163. List<string> classes = new List<string>();
  164. foreach (string ss in claes)
  165. {
  166. classes.Add(ss);
  167. }
  168. List<TmdInfo> tmdinfos = new List<TmdInfo>();
  169. List<Students> studentss = new List<Students>();
  170. List<string> tmdids = new List<string>();
  171. List<StuInfo> stuInfos = new List<StuInfo>();
  172. if (!classes.IsNotEmpty()) { return (tmdinfos, new List<StuInfo>(), null); }
  173. List<string> sqlList = new List<string>();
  174. classes.ForEach(x => { sqlList.Add($" '{x}' "); });
  175. string sql = string.Join(" , ", sqlList);
  176. List<StuList> schList = new List<StuList>();
  177. List<Student> students = new List<Student>();
  178. if (!string.IsNullOrEmpty(school))
  179. {
  180. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
  181. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
  182. {
  183. schList.Add(item);
  184. }
  185. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
  186. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
  187. {
  188. students.Add(item);
  189. }
  190. }
  191. List<StuList> tchLists = new List<StuList>();
  192. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
  193. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
  194. {
  195. tchLists.Add(item);
  196. }
  197. foreach (var x in schList)
  198. {
  199. if (x.students.IsNotEmpty())
  200. {
  201. studentss.AddRange(x.students);
  202. }
  203. if (x.tmids.IsNotEmpty())
  204. {
  205. tmdids.AddRange(x.tmids);
  206. }
  207. classes.Remove(x.id);
  208. }
  209. foreach (var x in tchLists)
  210. {
  211. if (x.students.IsNotEmpty())
  212. {
  213. studentss.AddRange(x.students);
  214. }
  215. if (x.tmids.IsNotEmpty())
  216. {
  217. tmdids.AddRange(x.tmids);
  218. }
  219. classes.Remove(x.id);
  220. }
  221. if (tmdids.IsNotEmpty())
  222. {
  223. List<TmdInfo> infos = new List<TmdInfo>();
  224. List<string> inids = new List<string>();
  225. tmdids.ForEach(x => { inids.Add($"'{x}'"); });
  226. var insql = string.Join(",", inids);
  227. var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
  228. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
  229. {
  230. infos.Add(item);
  231. }
  232. tmdinfos.AddRange(infos);
  233. }
  234. if (studentss.IsNotEmpty())
  235. {
  236. var stuGroups = studentss.GroupBy(x => x.code).ToList().Select(x => new { key = x.Key, list = x.ToList() }) ;
  237. foreach (var gp in stuGroups) {
  238. List<string> inidstus = new List<string>();
  239. gp.list.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
  240. PartitionKey partitionKey = new PartitionKey($"Base-{gp.key.Replace("Base-", "")}");
  241. var insqlstu = string.Join(",", inidstus);
  242. var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.groupId,c.groupName,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
  243. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey= partitionKey }))
  244. {
  245. stuInfos.Add(item);
  246. }
  247. }
  248. }
  249. students.ForEach(x =>
  250. {
  251. if (!stuInfos.Select(y => y.classId).ToList().Contains(x.id))
  252. {
  253. stuInfos.Add(new StuInfo { id = x.id, code = x.code, schoolId = x.schoolId, classId = x.classId, name = x.name, picture = x.picture, year = x.year,groupId = x.groupId,groupName=x.groupName,no=x.no });
  254. }
  255. });
  256. List<ClassListInfo> classInfo = new List<ClassListInfo>();
  257. schList.ForEach(x => {
  258. ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
  259. if (x.students.IsNotEmpty())
  260. {
  261. x.students.ForEach(y => {
  262. var stuinfo = stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
  263. if (stuinfo != null)
  264. {
  265. classListInfo.stuInfos.Add(stuinfo);
  266. }
  267. });
  268. }
  269. if (x.tmids.IsNotEmpty())
  270. {
  271. x.tmids.ForEach(y => {
  272. var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
  273. if (tmdinfo != null)
  274. {
  275. classListInfo.tmdInfos.Add(tmdinfo);
  276. }
  277. });
  278. }
  279. classInfo.Add(classListInfo);
  280. });
  281. tchLists.ForEach(x => {
  282. ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
  283. if (x.students.IsNotEmpty())
  284. {
  285. x.students.ForEach(y => {
  286. var stuinfo = stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
  287. if (stuinfo != null)
  288. {
  289. classListInfo.stuInfos.Add(stuinfo);
  290. }
  291. });
  292. }
  293. if (x.tmids.IsNotEmpty())
  294. {
  295. x.tmids.ForEach(y => {
  296. var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
  297. if (tmdinfo != null)
  298. {
  299. classListInfo.tmdInfos.Add(tmdinfo);
  300. }
  301. });
  302. }
  303. classInfo.Add(classListInfo);
  304. });
  305. //var classeids= students.GroupBy(x => x.classId).Select(x => x.Key).ToList();
  306. List<ClassInfo> classInfos = await GetClassInfo(client, _dingDing, classes, school);
  307. classInfos.ForEach(x =>
  308. {
  309. ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
  310. var list = students.Where(y => y.classId .Equals(x.id)).ToList();
  311. list.ForEach(z => { classListInfo.stuInfos.Add(new StuInfo { id = z.id, code = z.code, schoolId = z.schoolId, classId = z.classId, name = z.name, picture = z.picture, year = z.year,groupId=z.groupId,groupName=z.groupName,no=z.no }); });
  312. classInfo.Add(classListInfo);
  313. });
  314. return (tmdinfos, stuInfos, classInfo);
  315. }
  316. catch (Exception ex)
  317. {
  318. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-OS,TriggerStuActivity-GetStuList\n{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
  319. }
  320. return (null, null, null);
  321. }
  322. public static async Task<(List<TmdInfo> tmdinfos, List<StuInfo> students,List<ClassListInfo>classInfo)> GetStuList(CosmosClient client, DingDing _dingDing, List<string> claes, string school)
  323. {
  324. try {
  325. List<string> classes = new List<string>();
  326. foreach (string ss in claes)
  327. {
  328. classes.Add(ss);
  329. }
  330. List<TmdInfo> tmdinfos = new List<TmdInfo>();
  331. List<Students> studentss = new List<Students>();
  332. List<string> tmdids = new List<string>();
  333. List<StuInfo> stuInfos = new List<StuInfo>();
  334. if (!classes.IsNotEmpty()) { return (tmdinfos, new List<StuInfo>(),null); }
  335. List<string> sqlList = new List<string>();
  336. classes.ForEach(x => { sqlList.Add($" '{x}' "); });
  337. string sql = string.Join(" , ", sqlList);
  338. List<StuList> schList = new List<StuList>();
  339. List<Student> students = new List<Student>();
  340. if (!string.IsNullOrEmpty(school)) {
  341. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
  342. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
  343. {
  344. schList.Add(item);
  345. }
  346. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
  347. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
  348. {
  349. students.Add(item);
  350. }
  351. }
  352. List<StuList> tchLists = new List<StuList>();
  353. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
  354. requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
  355. {
  356. tchLists.Add(item);
  357. }
  358. foreach (var x in schList) {
  359. if (x.students.IsNotEmpty())
  360. {
  361. studentss.AddRange(x.students);
  362. }
  363. if (x.tmids.IsNotEmpty())
  364. {
  365. tmdids.AddRange(x.tmids);
  366. }
  367. classes.Remove(x.id);
  368. }
  369. foreach (var x in tchLists)
  370. {
  371. if (x.students.IsNotEmpty()) {
  372. studentss.AddRange(x.students);
  373. }
  374. if (x.tmids.IsNotEmpty())
  375. {
  376. tmdids.AddRange(x.tmids);
  377. }
  378. classes.Remove(x.id);
  379. }
  380. if (tmdids.IsNotEmpty()) {
  381. List<TmdInfo> infos = new List<TmdInfo>();
  382. List<string> inids = new List<string>();
  383. tmdids.ForEach(x => { inids.Add($"'{x}'"); });
  384. var insql = string.Join(",", inids);
  385. var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
  386. //合并代码/
  387. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
  388. {
  389. infos.Add(item);
  390. }
  391. tmdinfos.AddRange(infos);
  392. }
  393. if (studentss.IsNotEmpty()) {
  394. List<string> inidstus = new List<string>();
  395. foreach (Students stu in studentss) {
  396. var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id = '{stu.id}'";
  397. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{stu.code}") }))
  398. {
  399. stuInfos.Add(item);
  400. }
  401. }
  402. /*studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
  403. var insqlstu = string.Join(",", inidstus);
  404. var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
  405. await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
  406. {
  407. stuInfos.Add(item);
  408. }*/
  409. }
  410. students.ForEach(x =>
  411. {
  412. if (!stuInfos.Select(y => y.classId).ToList().Contains(x.id)) {
  413. stuInfos.Add(new StuInfo { id = x.id, code = x.code, schoolId = x.schoolId, classId = x.classId, name = x.name, picture = x.picture, year = x.year,groupId=x.groupId,groupName=x.groupName,no=x.no });
  414. }
  415. });
  416. List<ClassListInfo> classInfo = new List<ClassListInfo>();
  417. schList.ForEach(x => {
  418. ClassListInfo classListInfo = new ClassListInfo {id=x.id,name=x.name };
  419. if (x.students.IsNotEmpty()) {
  420. x.students.ForEach(y => {
  421. var stuinfo= stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
  422. if (stuinfo != null) {
  423. classListInfo.stuInfos.Add(stuinfo);
  424. }
  425. });
  426. }
  427. if (x.tmids.IsNotEmpty())
  428. {
  429. x.tmids.ForEach(y => {
  430. var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
  431. if (tmdinfo != null)
  432. {
  433. classListInfo.tmdInfos.Add(tmdinfo);
  434. }
  435. });
  436. }
  437. classInfo.Add(classListInfo);
  438. });
  439. tchLists.ForEach(x => {
  440. ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
  441. if (x.students.IsNotEmpty())
  442. {
  443. x.students.ForEach(y => {
  444. var stuinfo = stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
  445. if (stuinfo != null)
  446. {
  447. classListInfo.stuInfos.Add(stuinfo);
  448. }
  449. });
  450. }
  451. if (x.tmids.IsNotEmpty())
  452. {
  453. x.tmids.ForEach(y => {
  454. var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
  455. if (tmdinfo != null)
  456. {
  457. classListInfo.tmdInfos.Add(tmdinfo);
  458. }
  459. });
  460. }
  461. classInfo.Add(classListInfo);
  462. });
  463. //var classeids= students.GroupBy(x => x.classId).Select(x => x.Key).ToList();
  464. List<ClassInfo> classInfos= await GetClassInfo(client, _dingDing, classes, school);
  465. classInfos.ForEach(x =>
  466. {
  467. ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
  468. var list= students.Where(y => y.classId .Equals(x.id)).ToList();
  469. list.ForEach(z => { classListInfo.stuInfos.Add(new StuInfo { id = z.id, code = z.code, schoolId = z.schoolId, classId = z.classId, name = z.name, picture = z.picture, year = z.year ,groupId=z.groupId,groupName=z.groupName,no=z.no}); });
  470. classInfo.Add(classListInfo);
  471. });
  472. return (tmdinfos, stuInfos, classInfo) ;
  473. }
  474. catch (Exception ex)
  475. {
  476. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-OS,TriggerStuActivity-GetStuList\n{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
  477. }
  478. return (null, null,null);
  479. }
  480. }
  481. public class ClassListInfo
  482. {
  483. public string id { get; set; }
  484. public string name { get; set; }
  485. // public string from { get; set; }
  486. public List<StuInfo> stuInfos { get; set; } = new List<StuInfo>();
  487. public List<TmdInfo> tmdInfos { get; set; } = new List<TmdInfo>();
  488. }
  489. }