IESHttpTrigger.cs 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008
  1. using Azure.Cosmos;
  2. using Azure.Storage.Blobs.Models;
  3. using Azure.Storage.Sas;
  4. using HTEXLib.COMM.Helpers;
  5. using HTEXLib.Models;
  6. using Microsoft.AspNetCore.Components;
  7. using Microsoft.Azure.Cosmos.Table;
  8. using Microsoft.Azure.Functions.Worker;
  9. using Microsoft.Azure.Functions.Worker.Http;
  10. using OpenXmlPowerTools;
  11. using StackExchange.Redis;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Dynamic;
  15. using System.IO;
  16. using System.Linq;
  17. using System.Net;
  18. using System.Net.Http;
  19. using System.Net.Http.Json;
  20. using System.Reflection;
  21. using System.Security.Policy;
  22. using System.Text;
  23. using System.Text.Json;
  24. using System.Threading.Tasks;
  25. using System.Web;
  26. using TEAMModelOS.SDK;
  27. using TEAMModelOS.SDK.DI;
  28. using TEAMModelOS.SDK.Extension;
  29. using TEAMModelOS.SDK.Models;
  30. using TEAMModelOS.SDK.Models.Table;
  31. using static TEAMModelOS.SDK.Models.Teacher;
  32. namespace TEAMModelOS.FunctionV4
  33. {
  34. public class IESHttpTrigger
  35. {
  36. private readonly AzureCosmosFactory _azureCosmos;
  37. private readonly DingDing _dingDing;
  38. private readonly AzureStorageFactory _azureStorage;
  39. private readonly AzureRedisFactory _azureRedis;
  40. private readonly IHttpClientFactory _httpClient;
  41. public IESHttpTrigger( AzureCosmosFactory azureCosmos, DingDing dingDing, AzureStorageFactory azureStorage
  42. , AzureRedisFactory azureRedis, IHttpClientFactory httpClient)
  43. {
  44. _azureCosmos = azureCosmos;
  45. _dingDing = dingDing;
  46. _azureStorage = azureStorage;
  47. _azureRedis = azureRedis;
  48. _httpClient = httpClient;
  49. }
  50. /// <summary>
  51. /// </summary>
  52. /// <param name="req"></param>
  53. /// <param name="log"></param>
  54. /// <returns></returns>
  55. [Function("system-info-function")]
  56. public async Task<HttpResponseData> SystemInfo([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req)
  57. {
  58. var response = req.CreateResponse(HttpStatusCode.OK);
  59. Type attr = this.GetType();
  60. string currentDirectory = Path.GetDirectoryName(attr.Assembly.Location);
  61. Assembly assembly = Assembly.LoadFrom($"{currentDirectory}\\TEAMModelOS.FunctionV4.dll");
  62. var description = assembly.GetCustomAttribute<AssemblyDescriptionAttribute>().Description;
  63. //var v1 = Assembly.GetEntryAssembly().GetName().Version;
  64. //var v2 = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
  65. // var description = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyDescriptionAttribute>().Description;
  66. var version = Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
  67. long nowtime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
  68. //Console.WriteLine($"Assembly.GetEntryAssembly().GetName().Version: " +
  69. // $"{Assembly.GetEntryAssembly().GetName().Version}");5.2107.12.1
  70. //Console.WriteLine($"Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version:" +
  71. // $"{Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyFileVersionAttribute>().Version}");5.2107.12.1
  72. //Console.WriteLine($"Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion:" +
  73. // $"{Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion}");5.2107.12
  74. await response.WriteAsJsonAsync(new { version, description, nowtime });
  75. return response;
  76. }
  77. /// <summary>
  78. /// 区级艺术评价变更,异步同步已开启数据同步的学校。
  79. /// </summary>
  80. /// <param name="req"></param>
  81. /// <param name="log"></param>
  82. /// <returns></returns>
  83. [Function("area-artsetting-change")]
  84. public async Task<HttpResponseData> AreaArtSettingChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req) {
  85. var response = req.CreateResponse(HttpStatusCode.OK);
  86. try {
  87. string data = await new StreamReader(req.Body).ReadToEndAsync();
  88. var json = JsonDocument.Parse(data).RootElement;
  89. json.TryGetProperty("areaId", out JsonElement _areaId);
  90. string schoolSQL = $"select value c from c where c.areaId='{_areaId}'";
  91. List<School> schools = new List<School>();
  92. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School)
  93. .GetItemQueryIterator<School>(queryText: schoolSQL, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base") }))
  94. {
  95. schools.Add(item);
  96. }
  97. ArtSetting artSetting = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).ReadItemAsync<ArtSetting>($"{_areaId}", new PartitionKey("ArtSetting"));
  98. foreach (var school in schools)
  99. {
  100. List<Period> periods = new List<Period>();
  101. var hastype_period = school.period.Where(p => !string.IsNullOrWhiteSpace(p.periodType));
  102. if (hastype_period.Any())
  103. {
  104. periods.AddRange(hastype_period);
  105. }
  106. var nottype_period = school.period.Where(p => string.IsNullOrWhiteSpace(p.periodType));
  107. if (nottype_period.Any())
  108. {
  109. foreach (var period in nottype_period)
  110. {
  111. if (period.name.Contains("小学"))
  112. {
  113. period.periodType= "primary";
  114. }
  115. if (period.name.Contains("初中"))
  116. {
  117. period.periodType = "junior";
  118. }
  119. if (period.name.Contains("高中"))
  120. {
  121. period.periodType = "senior";
  122. }
  123. if (string.IsNullOrWhiteSpace(period.periodType) && school.period.Count == 1)
  124. {
  125. if (school.name.Contains("小学"))
  126. {
  127. period.periodType = "primary";
  128. }
  129. if (school.name.Contains("初中"))
  130. {
  131. period.periodType = "junior";
  132. }
  133. if (school.name.Contains("高中"))
  134. {
  135. period.periodType = "senior";
  136. }
  137. }
  138. if (!string.IsNullOrWhiteSpace(period.periodType))
  139. {
  140. periods.Add(period);
  141. }
  142. }
  143. }
  144. foreach (var period in periods)
  145. {
  146. var dimension = artSetting.dimensions.FindAll(x => x.type.Intersect(new List<string> { period.periodType }).Any());
  147. var bindIds = period.subjects.Where(s => !string.IsNullOrWhiteSpace(s.bindId)).Select(x => x.bindId);
  148. //该学段未同步学科的。
  149. var unBindIds = dimension.Where(z => !string.IsNullOrWhiteSpace(z.subjectBind)).Select(x => x.subjectBind).ToHashSet().Except(bindIds);
  150. if (unBindIds.Any())
  151. {
  152. //尝试寻找同名学科且没有设置bindId的
  153. foreach (var unBindId in unBindIds)
  154. {
  155. var subjects = artSetting.dimensions.FindAll(d => !string.IsNullOrWhiteSpace(d.subjectBind) && !string.IsNullOrWhiteSpace(d.subject) && d.subjectBind.Equals(unBindId))?.Select(m => m.subject);
  156. if (subjects != null)
  157. {
  158. foreach (var subject in subjects)
  159. {
  160. //获取同名学科,且没绑定的
  161. var sub = period.subjects.FindAll(sub => sub.name.Contains(subject) && string.IsNullOrWhiteSpace(sub.bindId));
  162. if (sub.IsNotEmpty())
  163. {
  164. sub[0].bindId = unBindId;
  165. }
  166. else
  167. {
  168. period.subjects.Add(new Subject { id = Guid.NewGuid().ToString(), name = subject, bindId = unBindId, type = 1 });
  169. }
  170. break;
  171. }
  172. }
  173. }
  174. }
  175. var period_subjects = period.subjects.Where(s => !string.IsNullOrWhiteSpace(s.bindId));
  176. foreach (var subject in period_subjects)
  177. {
  178. var dim = dimension.Where(x => x.subjectBind.Equals(subject.bindId));
  179. if (dim.Any())
  180. {
  181. Knowledge old = null;
  182. string sql = $"select value(c) from c where c.periodId = '{period.id}'";
  183. string pk = $"Knowledge-{school.id}-{subject.id}";
  184. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").
  185. GetItemQueryIterator<Knowledge>(queryText: sql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey(pk) }))
  186. {
  187. old = item;
  188. break;
  189. }
  190. //同步知识块。
  191. if (old != null)
  192. {
  193. bool change = false;
  194. //如果之前的是1 来源于区级,后面因区级删除,应该还原为0。
  195. var oldBlocks = old.blocks.Select(x => x.name).ToHashSet();
  196. var dimBlocks = dim.SelectMany(d => d.blocks);
  197. //增加的
  198. var addBlocks = dimBlocks.Except(oldBlocks);
  199. //减少的
  200. var cutBlocks = oldBlocks.Except(dimBlocks);
  201. foreach (var add in addBlocks)
  202. {
  203. old.blocks.Add(new Block { name = add, source = 1 });
  204. change = true;
  205. }
  206. //减少的还原为0
  207. if (cutBlocks.Any())
  208. {
  209. old.blocks.ForEach(ob => {
  210. if (cutBlocks.Contains(ob.name))
  211. {
  212. ob.source = 0;
  213. change = true;
  214. }
  215. });
  216. }
  217. if (change)
  218. {
  219. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(old, old.id, new PartitionKey(old.code));
  220. }
  221. var count = new { pcount = old.points != null ? old.points.Count : 0, bcount = old.blocks != null ? old.blocks.Count : 0 };
  222. //处理知识点,知识块计数问题
  223. await _azureRedis.GetRedisClient(8).HashSetAsync($"Knowledge:Count:{old.owner}-{old.subjectId}", old.periodId, count.ToJsonString());
  224. }
  225. else
  226. {
  227. var blocks = dim.SelectMany(x => x.blocks).Select(bs => new Block { name = bs, source = 1 });
  228. if (blocks.Any())
  229. {
  230. var _new = new Knowledge
  231. {
  232. id = Guid.NewGuid().ToString(),
  233. pk = "Knowledge",
  234. code = pk,
  235. owner = school.id,
  236. periodId = period.id,
  237. subjectId = subject.id,
  238. blocks = blocks.ToList()
  239. };
  240. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).CreateItemAsync(_new, new PartitionKey(_new.code));
  241. var count = new { pcount = _new.points != null ? _new.points.Count : 0, bcount = _new.blocks != null ? _new.blocks.Count : 0 };
  242. //处理知识点,知识块计数问题
  243. await _azureRedis.GetRedisClient(8).HashSetAsync($"Knowledge:Count:{_new.owner}-{_new.subjectId}", _new.periodId, count.ToJsonString());
  244. }
  245. }
  246. }
  247. }
  248. }
  249. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync(school, school.id, new PartitionKey(school.code));
  250. }
  251. return response;
  252. } catch (Exception ex) {
  253. await _dingDing.SendBotMsg($"area-artsetting-change,{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
  254. }
  255. return response;
  256. }
  257. /// <summary>
  258. /// 行政班,学生毕业状态变更。
  259. /// </summary>
  260. /// <param name="req"></param>
  261. /// <param name="log"></param>
  262. /// <returns></returns>
  263. [Function("graduate-change")]
  264. public async Task<HttpResponseData> GraduateChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req) {
  265. var response = req.CreateResponse(HttpStatusCode.OK);
  266. dynamic jsondata =new ExpandoObject() ;
  267. try {
  268. string data = await new StreamReader(req.Body).ReadToEndAsync();
  269. var json = JsonDocument.Parse(data).RootElement;
  270. jsondata = json;
  271. //await _dingDing.SendBotMsg( "毕业状态变更:"+json.ToJsonString(), GroupNames.成都开发測試群組);
  272. string schoolId = null;
  273. if (json.TryGetProperty("schoolId", out JsonElement _schoolId))
  274. {
  275. schoolId = $"{_schoolId}";
  276. }
  277. if (string.IsNullOrEmpty(schoolId))
  278. {
  279. return response;
  280. }
  281. //计算毕业的
  282. if (json.TryGetProperty("graduate_classes", out JsonElement _graduate_classes))
  283. {
  284. List<Class> graduate_classes = _graduate_classes.ToObject<List<Class>>();
  285. if (graduate_classes.IsNotEmpty())
  286. {
  287. var ids = graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
  288. List<Student> students = new List<Student>();
  289. string sql = $"select value c from c where (c.graduate = 0 or IS_DEFINED(c.graduate) = false) and c.classId in ({string.Join(",", ids)})";
  290. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
  291. .GetItemQueryIterator<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
  292. {
  293. item.graduate = 1;
  294. students.Add(item);
  295. }
  296. foreach (var item in students)
  297. {
  298. item.graduate = 1;
  299. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync<Student>(item, item.id, new PartitionKey($"Base-{schoolId}"));
  300. }
  301. foreach (var item in graduate_classes)
  302. {
  303. item.graduate = 1;
  304. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<Class>(item, item.id, new PartitionKey($"Class-{schoolId}"));
  305. }
  306. }
  307. }
  308. //未毕业的
  309. if (json.TryGetProperty("cancel_graduate_classes", out JsonElement _cancel_graduate_classes))
  310. {
  311. List<Class> cancel_graduate_classes = _cancel_graduate_classes.ToObject<List<Class>>();
  312. if (cancel_graduate_classes.IsNotEmpty())
  313. {
  314. var ids = cancel_graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
  315. List<Student> students = new List<Student>();
  316. string sql = $"select value c from c where c.graduate =1 and c.classId in ({string.Join(",", ids)})";
  317. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
  318. .GetItemQueryIterator<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
  319. {
  320. item.graduate = 0;
  321. students.Add(item);
  322. }
  323. foreach (var item in students)
  324. {
  325. item.graduate = 0;
  326. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync<Student>(item, item.id, new PartitionKey($"Base-{schoolId}"));
  327. }
  328. foreach (var item in cancel_graduate_classes)
  329. {
  330. item.graduate = 0;
  331. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<Class>(item, item.id, new PartitionKey($"Class-{schoolId}"));
  332. }
  333. }
  334. }
  335. } catch (Exception ex) {
  336. await _dingDing.SendBotMsg($"graduate-change,{ex.Message}\n{ex.StackTrace}\n{jsondata.ToJsonString()}",GroupNames.醍摩豆服務運維群組);
  337. }
  338. return response;
  339. }
  340. /// <summary>
  341. /// 数据推送接口
  342. /// </summary>
  343. /// <param name="req"></param>
  344. /// <param name="log"></param>
  345. /// <returns></returns>
  346. [Function("lesson-tag-change")]
  347. public async Task<HttpResponseData> LessonTagChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req) {
  348. var response = req.CreateResponse(HttpStatusCode.OK);
  349. string data = await new StreamReader(req.Body).ReadToEndAsync();
  350. var json = JsonDocument.Parse(data).RootElement;
  351. List<TagOldNew> old_new = null;
  352. string school = null;
  353. if (json.TryGetProperty("school", out JsonElement _school))
  354. {
  355. school = _school.GetString();
  356. }
  357. if (json.TryGetProperty("old_new", out JsonElement _old_new))
  358. {
  359. old_new = _old_new.ToObject<List<TagOldNew>>();
  360. }
  361. if (old_new.IsNotEmpty() && !string.IsNullOrWhiteSpace(school))
  362. {
  363. foreach (var on in old_new)
  364. {
  365. List<LessonRecord> lessonRecords = new List<LessonRecord>();
  366. string sql = $"select value(c) from c where array_contains(c.category,'{on._old}') ";
  367. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<LessonRecord>
  368. (queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"LessonRecord-{_school}") }))
  369. {
  370. lessonRecords.Add(item);
  371. }
  372. lessonRecords.ForEach(item =>
  373. {
  374. //修改标签
  375. if (!string.IsNullOrWhiteSpace(on._new))
  376. {
  377. for (int i = 0; i < item.category.Count; i++)
  378. {
  379. if (item.category[i].Equals(on._old))
  380. {
  381. item.category[i] = on._new;
  382. }
  383. }
  384. }
  385. else
  386. {
  387. //表示删除标签
  388. item.category.RemoveAll(x => x.Equals(on._old));
  389. }
  390. });
  391. foreach (var item in lessonRecords)
  392. {
  393. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(item, item.id, new PartitionKey(item.code));
  394. }
  395. }
  396. }
  397. await response.WriteAsJsonAsync(new { data = json });
  398. return response;
  399. }
  400. /// <summary>
  401. /// 数据推送接口
  402. /// </summary>
  403. /// <param name="req"></param>
  404. /// <param name="log"></param>
  405. /// <returns></returns>
  406. [Function("knowledge-change")]
  407. public async Task<HttpResponseData> KnowledgeChange([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req)
  408. {
  409. var response = req.CreateResponse(HttpStatusCode.OK);
  410. string data = await new StreamReader(req.Body).ReadToEndAsync();
  411. var json = JsonDocument.Parse(data).RootElement;
  412. List<TagOldNew> old_new = null;
  413. string school = null;
  414. if (json.TryGetProperty("school", out JsonElement _school))
  415. {
  416. school = _school.GetString();
  417. }
  418. if (json.TryGetProperty("old_new", out JsonElement _old_new))
  419. {
  420. old_new = _old_new.ToObject<List<TagOldNew>>();
  421. }
  422. if (old_new.IsNotEmpty() && !string.IsNullOrWhiteSpace(school))
  423. {
  424. foreach (var on in old_new)
  425. {
  426. List<ItemInfo> items = new List<ItemInfo>();
  427. string sql = $"select value(c) from c where array_contains(c.knowledge,'{on._old}') ";
  428. await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ItemInfo>
  429. (queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{_school}") }))
  430. {
  431. items.Add(item);
  432. }
  433. items.ForEach(item =>
  434. {
  435. //修改知识点
  436. if (!string.IsNullOrEmpty(on._new))
  437. {
  438. for (int i = 0; i < item.knowledge.Count; i++)
  439. {
  440. if (item.knowledge[i].Equals(on._old))
  441. {
  442. item.knowledge[i] = on._new;
  443. }
  444. }
  445. }
  446. else
  447. {
  448. //表示删除知识点
  449. item.knowledge.RemoveAll(x => x.Equals(on._old));
  450. }
  451. });
  452. foreach (var item in items)
  453. {
  454. ItemBlob itemBlob = null;
  455. try
  456. {
  457. BlobDownloadInfo blobDownloadResult = await _azureStorage.GetBlobContainerClient($"{school}").GetBlobClient($"/item/{item.id}/{item.id}.json").DownloadAsync();
  458. if (blobDownloadResult != null)
  459. {
  460. var blob = JsonDocument.Parse(blobDownloadResult.Content);
  461. itemBlob = blob.RootElement.ToObject<ItemBlob>();
  462. itemBlob.exercise.knowledge = item.knowledge;
  463. await _azureStorage.GetBlobContainerClient($"{school}").UploadFileByContainer(itemBlob.ToJsonString(), "item", $"{item.id}/{item.id}.json", true);
  464. }
  465. }
  466. catch (Exception ex)
  467. {
  468. itemBlob = null;
  469. }
  470. await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReplaceItemAsync(item, item.id, new PartitionKey(item.code));
  471. }
  472. }
  473. }
  474. await response.WriteAsJsonAsync(new { data = json });
  475. return response;
  476. }
  477. /// <summary>
  478. /// 在线人数记录
  479. /// </summary>
  480. /// <param name="msg"></param>
  481. /// <returns></returns>
  482. [Function("online-record")]
  483. public async Task<HttpResponseData> OnlineRecord([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req)
  484. {
  485. var response = req.CreateResponse(HttpStatusCode.OK);
  486. string data = await new StreamReader(req.Body).ReadToEndAsync();
  487. var json = JsonDocument.Parse(data).RootElement;
  488. try
  489. {
  490. string school = null;
  491. string scope = null;
  492. string id = null;
  493. string ip = null;
  494. int expire = 1;
  495. if (json.TryGetProperty("school", out JsonElement _school))
  496. school = _school.GetString();
  497. if (json.TryGetProperty("scope", out JsonElement _scope))
  498. scope = _scope.GetString();
  499. if (json.TryGetProperty("id", out JsonElement _id))
  500. id = _id.GetString();
  501. if (json.TryGetProperty("ip", out JsonElement _ip))
  502. ip = _ip.GetString();
  503. if (json.TryGetProperty("expire", out JsonElement _expire))
  504. expire = _expire.GetInt32();
  505. var table = _azureStorage.GetCloudTableClient().GetTableReference("IESLogin");
  506. var cosmosClient = _azureCosmos.GetCosmosClient();
  507. DateTimeOffset dateTime = DateTimeOffset.UtcNow;
  508. var dateHour = dateTime.ToString("yyyyMMddHH"); //获取当天的小时
  509. var dateDay = dateTime.ToString("yyyyMMdd"); //获取当天的日期
  510. var dateMonth = dateTime.ToString("yyyyMM");//获取当月的日期
  511. var currentHour = dateTime.Hour; //当前小时
  512. var currentDay = dateTime.Day; //当前天
  513. long Expire = dateTime.AddHours(expire).ToUnixTimeMilliseconds(); //token到期时间
  514. long now = dateTime.ToUnixTimeMilliseconds(); //当前时间戳
  515. DateTime hour = DateTime.UtcNow.AddHours(25); //25小时到期
  516. DateTime month = DateTime.UtcNow.AddDays(32); //一个月到期
  517. var delTbHour = dateTime.AddHours(-168).ToString("yyyyMMddHH"); //168小时前
  518. var delTbDay = dateTime.AddDays(-180).ToString("yyyyMMdd"); //180天前
  519. switch (scope)
  520. {
  521. case "teacher":
  522. try
  523. {
  524. Teacher teacher = await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<Teacher>(id, new PartitionKey("Base"));
  525. teacher.loginInfos = new List<LoginInfo>() { new LoginInfo { expire = Expire, ip = ip, time = now } };
  526. await cosmosClient.GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Teacher>(teacher, teacher.id, new PartitionKey("Base"));
  527. }
  528. catch { }
  529. break;
  530. case "student":
  531. try
  532. {
  533. Student student = await cosmosClient.GetContainer("TEAMModelOS", Constant.Student).ReadItemAsync<Student>(id, new PartitionKey($"Base-{school}"));
  534. student.loginInfos = new List<LoginInfo>() { new LoginInfo { expire = Expire, ip = ip, time = now } };
  535. await cosmosClient.GetContainer("TEAMModelOS", Constant.Student).ReplaceItemAsync<Student>(student, student.id, new PartitionKey($"Base-{school}"));
  536. }
  537. catch { }
  538. break;
  539. case "tmduser":
  540. try
  541. {
  542. TmdUser tmdUser = await cosmosClient.GetContainer("TEAMModelOS", Constant.Student).ReadItemAsync<TmdUser>(id, new PartitionKey("Base"));
  543. tmdUser.loginInfos = new List<LoginInfo>() { new LoginInfo { expire = Expire, ip = ip, time = now } };
  544. await cosmosClient.GetContainer("TEAMModelOS", Constant.Student).ReplaceItemAsync<TmdUser>(tmdUser, tmdUser.id, new PartitionKey("Base"));
  545. }
  546. catch { }
  547. break;
  548. }
  549. //天
  550. SortedSetEntry[] dayCnt = null;
  551. //月
  552. SortedSetEntry[] monthCnt = null;
  553. try
  554. {
  555. await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateDay}", $"{currentHour}", 1);//一天24小时 小时为单位
  556. await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:IES:{scope}:{dateMonth}", $"{currentDay}", 1); //一天的累计 天为单位
  557. var resDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateDay}");
  558. if (resDay == null)
  559. await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateDay}", hour); //设置到期时间
  560. var rspMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:IES:{scope}:{dateMonth}");
  561. if (rspMonth == null)
  562. await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:IES:{scope}:{dateMonth}", month); //设置到期时间
  563. //保存当前小时统计
  564. dayCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateDay}");
  565. //保存当前的统计数据
  566. monthCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:IES:{scope}:{dateMonth}");
  567. }
  568. catch { }
  569. if (dayCnt != null && dayCnt.Length > 0)
  570. {
  571. List<HourLogin> hourLogins = new();
  572. foreach (var dCnt in dayCnt)
  573. {
  574. if (((int)dCnt.Element) == currentHour)
  575. {
  576. var tphourLogins = await table.QueryWhereString<HourLogin>($"PartitionKey eq 'HourLogin' and RowKey eq '{dateHour}'");
  577. if (tphourLogins.Count > 0)
  578. {
  579. foreach (var hourLogin in tphourLogins)
  580. {
  581. if (scope.Equals("teacher"))
  582. hourLogin.Teacher = (int)dCnt.Score;
  583. else if (scope.Equals("student"))
  584. hourLogin.Student = (int)dCnt.Score;
  585. else
  586. hourLogin.TmdUser = (int)dCnt.Score;
  587. hourLogins.Add(hourLogin);
  588. }
  589. }
  590. else
  591. {
  592. HourLogin hourLogin = new() { PartitionKey = $"HourLogin", RowKey = dateHour, Hour = currentHour };
  593. if (scope.Equals("teacher"))
  594. {
  595. hourLogin.Teacher = 1;
  596. hourLogin.Student = 0;
  597. hourLogin.TmdUser = 0;
  598. }
  599. else if (scope.Equals("student"))
  600. {
  601. hourLogin.Teacher = 0;
  602. hourLogin.Student = 1;
  603. hourLogin.TmdUser = 0;
  604. }
  605. else
  606. {
  607. hourLogin.Teacher = 0;
  608. hourLogin.Student = 0;
  609. hourLogin.TmdUser = 1;
  610. }
  611. hourLogins.Add(hourLogin);
  612. }
  613. }
  614. }
  615. await table.SaveOrUpdateAll(hourLogins); //保存和更新保存当前小时登录次数
  616. }
  617. if (monthCnt != null && monthCnt.Length > 0)
  618. {
  619. List<DayLogin> dayLogins = new();
  620. foreach (var mCnt in monthCnt)
  621. {
  622. if (((int)mCnt.Element) == currentDay)
  623. {
  624. //保存当天的峰值
  625. var tbDays = await table.QueryWhereString<DayLogin>($"PartitionKey eq 'DayLogin' and RowKey eq '{dateDay}'");
  626. if (tbDays.Count > 0)
  627. {
  628. foreach (var dayLogin in tbDays)
  629. {
  630. if (scope.Equals("teacher"))
  631. dayLogin.Teacher = (int)mCnt.Score;
  632. else if (scope.Equals("student"))
  633. dayLogin.Student = (int)mCnt.Score;
  634. else
  635. dayLogin.TmdUser = (int)mCnt.Score;
  636. dayLogins.Add(dayLogin);
  637. }
  638. }
  639. else
  640. {
  641. //保存当月每天的峰值
  642. DayLogin dayLogin = new() { PartitionKey = $"DayLogin", RowKey = dateDay, Day = currentDay };
  643. if (scope.Equals("teacher"))
  644. {
  645. dayLogin.Teacher = 1;
  646. dayLogin.Student = 0;
  647. dayLogin.TmdUser = 0;
  648. }
  649. else if (scope.Equals("student"))
  650. {
  651. dayLogin.Teacher = 0;
  652. dayLogin.Student = 1;
  653. dayLogin.TmdUser = 0;
  654. }
  655. else
  656. {
  657. dayLogin.Teacher = 0;
  658. dayLogin.Student = 0;
  659. dayLogin.TmdUser = 1;
  660. }
  661. dayLogins.Add(dayLogin);
  662. }
  663. }
  664. }
  665. await table.SaveOrUpdateAll(dayLogins);// 保存当月每天在线数据
  666. }
  667. string tbHourSql = $"PartitionKey eq 'HourLogin' and RowKey le '{delTbHour}'";
  668. string tbDaySql = $"PartitionKey eq 'DayLogin' and RowKey le '{delTbDay}'";
  669. try
  670. {
  671. await table.DeleteStringWhere<HourLogin>(rowKey: tbHourSql); //删除168小时前的数据
  672. await table.DeleteStringWhere<DayLogin>(rowKey: tbDaySql); //删除180天前的数据
  673. }
  674. catch { }
  675. if (!string.IsNullOrWhiteSpace(school))
  676. {
  677. //天
  678. SortedSetEntry[] scDayCnt = null;
  679. //月
  680. SortedSetEntry[] scMonthCnt = null;
  681. try
  682. {
  683. await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:School:{school}:{scope}:{dateDay}", $"{currentHour}", 1);//当天当前小时在线人加1
  684. await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Login:School:{school}:{scope}:{dateMonth}", $"{currentDay}", 1); //当天的在线加1
  685. var reScDay = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateDay}");
  686. if (reScDay == null)
  687. await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:School:{school}:{scope}:{dateDay}", hour); //设置到期时间
  688. var reScMonth = await _azureRedis.GetRedisClient(8).KeyTimeToLiveAsync($"Login:School:{school}:{scope}:{dateMonth}");
  689. if (reScMonth == null)
  690. await _azureRedis.GetRedisClient(8).KeyExpireAsync($"Login:School:{school}:{scope}:{dateMonth}", month); //设置到期时间
  691. //保存学校当天每小时的
  692. scDayCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateDay}");
  693. //学校天峰值
  694. scMonthCnt = _azureRedis.GetRedisClient(8).SortedSetRangeByScoreWithScores($"Login:School:{school}:{scope}:{dateMonth}");
  695. }
  696. catch { }
  697. if (scDayCnt != null && scDayCnt.Length > 0)
  698. {
  699. List<HourLoginSchool> hourLoginSchools = new();
  700. foreach (var scDCnt in scDayCnt)
  701. {
  702. if (((int)scDCnt.Element) == currentHour)
  703. {
  704. var tmpHour = await table.QueryWhereString<HourLoginSchool>($"PartitionKey eq 'HourLogin-{school}' and RowKey eq '{dateHour}'");
  705. if (tmpHour.Count > 0)
  706. {
  707. foreach (var hLoginSc in tmpHour)
  708. {
  709. if (scope.Equals("teacher"))
  710. hLoginSc.Teacher = (int)scDCnt.Score;
  711. else if (scope.Equals("student"))
  712. hLoginSc.Student = (int)scDCnt.Score;
  713. else
  714. hLoginSc.TmdUser = (int)scDCnt.Score;
  715. hourLoginSchools.Add(hLoginSc);
  716. }
  717. }
  718. else
  719. {
  720. //学校小时峰值
  721. HourLoginSchool hourLoginSc = new() { PartitionKey = $"HourLogin-{school}", RowKey = dateHour, Hour = currentHour, School = school };
  722. if (scope.Equals("teacher"))
  723. {
  724. hourLoginSc.Teacher = 1;
  725. hourLoginSc.Student = 0;
  726. hourLoginSc.TmdUser = 0;
  727. }
  728. else if (scope.Equals("student"))
  729. {
  730. hourLoginSc.Teacher = 0;
  731. hourLoginSc.Student = 1;
  732. hourLoginSc.TmdUser = 0;
  733. }
  734. else
  735. {
  736. hourLoginSc.Teacher = 0;
  737. hourLoginSc.Student = 0;
  738. hourLoginSc.TmdUser = 1;
  739. }
  740. hourLoginSchools.Add(hourLoginSc);
  741. }
  742. }
  743. }
  744. await table.SaveOrUpdateAll(hourLoginSchools);
  745. }
  746. if (scMonthCnt != null && scMonthCnt.Length > 0)
  747. {
  748. List<DayLoginSchool> DayLoginSchools = new();
  749. foreach (var scMCnt in scMonthCnt)
  750. {
  751. if (((int)scMCnt.Element) == currentDay)
  752. {
  753. var tempDays = await table.QueryWhereString<DayLoginSchool>($"PartitionKey eq 'DayLogin-{school}' and RowKey eq '{dateDay}'");
  754. if (tempDays.Count > 0)
  755. {
  756. foreach (var dLoginSc in tempDays)
  757. {
  758. if (scope.Equals("teacher"))
  759. dLoginSc.Teacher = (int)scMCnt.Score;
  760. else if (scope.Equals("student"))
  761. dLoginSc.Student = (int)scMCnt.Score;
  762. else
  763. dLoginSc.TmdUser = (int)scMCnt.Score;
  764. DayLoginSchools.Add(dLoginSc);
  765. }
  766. }
  767. else
  768. {
  769. //学校天峰值
  770. DayLoginSchool dayLoginSc = new() { PartitionKey = $"DayLogin-{school}", RowKey = dateDay, Day = currentDay, School = school };
  771. if (scope.Equals("teacher"))
  772. {
  773. dayLoginSc.Teacher = 1;
  774. dayLoginSc.Student = 0;
  775. dayLoginSc.TmdUser = 0;
  776. }
  777. else if (scope.Equals("student"))
  778. {
  779. dayLoginSc.Teacher = 0;
  780. dayLoginSc.Student = 1;
  781. dayLoginSc.TmdUser = 0;
  782. }
  783. else
  784. {
  785. dayLoginSc.Teacher = 0;
  786. dayLoginSc.Student = 0;
  787. dayLoginSc.TmdUser = 1;
  788. }
  789. DayLoginSchools.Add(dayLoginSc);
  790. }
  791. }
  792. }
  793. await table.SaveOrUpdateAll(DayLoginSchools);//保存学校当月在线数据
  794. }
  795. string tbScHourSql = $"PartitionKey eq 'HourLogin-{school}' and RowKey le '{delTbHour}'";
  796. List<HourLogin> scHourLog = await table.QueryWhereString<HourLogin>(tbScHourSql);
  797. if (scHourLog.Count > 0)
  798. try
  799. {
  800. //await table.DeleteStringWhere<HourLogin>(tbScHourSql); //删除学校168小时前的数据
  801. await table.DeleteAll(scHourLog);
  802. }
  803. catch { }
  804. string tbScDaySql = $"PartitionKey eq 'DayLogin-{school}' and RowKey le '{delTbDay}'";
  805. List<DayLogin> scDayLog = await table.QueryWhereString<DayLogin>(tbScDaySql);
  806. if (scDayLog.Count > 0)
  807. try
  808. {
  809. //await table.DeleteStringWhere<DayLogin>(tbScDaySql); //删除学校180天前的数据
  810. await table.DeleteAll(scDayLog);
  811. }
  812. catch { }
  813. }
  814. await response.WriteAsJsonAsync(new { data = json });
  815. return response;
  816. }
  817. catch (Exception ex)
  818. {
  819. await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-online-record 人数记录异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
  820. await response.WriteAsJsonAsync(new { data = json });
  821. return response;
  822. }
  823. }
  824. /// <summary>
  825. /// 艺术评测报告生成
  826. /// </summary>
  827. /// <param name="msg"></param>
  828. /// <returns></returns>
  829. //[Function("gen-art-pdf")]
  830. public async Task<HttpResponseData> GenArtPDF([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req) {
  831. var response = req.CreateResponse(HttpStatusCode.OK);
  832. try {
  833. string data = await new StreamReader(req.Body).ReadToEndAsync();
  834. var json = JsonDocument.Parse(data).RootElement;
  835. json.TryGetProperty("studentPdfs", out JsonElement _studentPdfs);
  836. json.TryGetProperty("artResults", out JsonElement _artResults);
  837. json.TryGetProperty("schoolCode", out JsonElement _schoolCode);
  838. List<ArtStudentPdf> studentPdfs = _studentPdfs.Deserialize<List<ArtStudentPdf>>();
  839. List<StudentArtResult> artResults = _artResults.Deserialize<List<StudentArtResult>>();
  840. List<Task<string>> uploads = new List<Task<string>>();
  841. studentPdfs.ForEach(x => {
  842. x.blob = $"art/{x.artId}/report/{x.studentId}.json";
  843. uploads.Add(_azureStorage.GetBlobContainerClient($"{_schoolCode}").UploadFileByContainer(x.ToJsonString(), "art", $"{x.artId}/report/{x.studentId}.json", true));
  844. });
  845. var uploadJsonUrls = await Task.WhenAll(uploads);
  846. var list = uploadJsonUrls.ToList();
  847. List<string> urls = new List<string>();
  848. (string uri, string sas) = _azureStorage.GetBlobContainerSAS($"{_schoolCode}", Azure.Storage.Sas.BlobContainerSasPermissions.Read);
  849. studentPdfs.ForEach(x => {
  850. string atrUrl = "https://teammodelos.blob.core.chinacloudapi.cn/0-public/art-report-template/report.html";
  851. var s = _azureStorage.GetBlobSAS($"{_schoolCode}", x.blob, BlobSasPermissions.Read);
  852. s = $"{HttpUtility.UrlEncode($"{s}", Encoding.UTF8)}";
  853. string url = $"{atrUrl}?url={s}&pdfpath={x.artId}/report/{x.studentId}";
  854. urls.Add(url);
  855. //var a = list.Find(l => l.Contains(x.studentId));
  856. //if (a != null) {
  857. // a = $"{HttpUtility.UrlEncode($"{a}?{sas}", Encoding.UTF8)}";
  858. // string url = $"{atrUrl}?url={a}&pdfpath={x.artId}/report/{x.studentId}";
  859. // urls.Add(url);
  860. //}
  861. });
  862. string env = "release";
  863. if (Environment.GetEnvironmentVariable("Option:Location").Contains("Test", StringComparison.CurrentCultureIgnoreCase) ||
  864. Environment.GetEnvironmentVariable("Option:Location").Contains("Dep", StringComparison.CurrentCultureIgnoreCase))
  865. {
  866. env = "develop";
  867. }
  868. int psize = 20;
  869. List<string> resUrls = new List<string>();
  870. if (urls.Count <= psize)
  871. {
  872. var screenshot = new ScreenshotDto
  873. {
  874. width = 1080,
  875. height = 1920,
  876. urls = urls,
  877. fileNameKey = "pdfpath",
  878. cnt = $"{_schoolCode}",
  879. root = "art",
  880. pagesize = 5,
  881. env = env
  882. };
  883. var st = screenshot.ToJsonString();
  884. await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
  885. var httpResponse = await _httpClient.CreateClient().PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
  886. screenshot
  887. );
  888. if (httpResponse.StatusCode == HttpStatusCode.OK)
  889. {
  890. JsonElement json_res = await httpResponse.Content.ReadFromJsonAsync<JsonElement>();
  891. resUrls = json_res.GetProperty("urls").Deserialize<List<string>>();
  892. await UpdatePdfBlob(artResults, resUrls);
  893. }
  894. }
  895. else {
  896. int pages = (urls.Count + psize) / psize;
  897. for (int i = 0; i < pages; i++) {
  898. var lists = urls.Skip((i) * psize).Take(psize).ToList();
  899. var screenshot = new ScreenshotDto
  900. {
  901. width = 1080,
  902. height = 1920,
  903. urls = lists,
  904. fileNameKey = "pdfpath",
  905. cnt = $"{_schoolCode}",
  906. root = "art",
  907. pagesize = 5,
  908. env = env
  909. };
  910. var st = screenshot.ToJsonString();
  911. // await _dingDing.SendBotMsg($"艺术评测报告生成中:\n{st}", GroupNames.成都开发測試群組);
  912. var httpResponse = await _httpClient.CreateClient().PostAsJsonAsync("http://cdhabook.teammodel.cn:8805/screen/screenshot-pdf",
  913. screenshot
  914. );
  915. if (httpResponse.StatusCode == HttpStatusCode.OK)
  916. {
  917. JsonElement json_res = await httpResponse.Content.ReadFromJsonAsync<JsonElement>();
  918. resUrls = json_res.GetProperty("urls").Deserialize<List<string>>();
  919. await UpdatePdfBlob(artResults, resUrls);
  920. }
  921. }
  922. }
  923. await response.WriteAsJsonAsync(new { data = new { count = studentPdfs.Count, resUrls } });
  924. } catch (Exception ex) {
  925. await _dingDing.SendBotMsg($"{ex.Message}{ex.StackTrace}", GroupNames.成都开发測試群組);
  926. }
  927. return response;
  928. }
  929. //https://teammodeltest.blob.core.chinacloudapi.cn/hbcn/art/e864a924-e644-42dc-87c4-e970e6185065/report/202201001.pdf
  930. private async Task UpdatePdfBlob(List<StudentArtResult> studentArts ,List<string> urls)
  931. {
  932. List<Task<ItemResponse<StudentArtResult>>> artResults =new List<Task<ItemResponse<StudentArtResult>>>();
  933. urls.ForEach(z => {
  934. var res = studentArts.FindAll(x => z.Contains(x.artId) && z.Contains($"{x.studentId}"));
  935. if (res.Any()) {
  936. if (string.IsNullOrWhiteSpace(res[0].blob)) {
  937. res[0].blob = $"art/{res[0].artId}/report/{res[0].studentId}.pdf";
  938. artResults.Add(_azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync(res[0], res[0].id, new PartitionKey(res[0].code)));
  939. }
  940. }
  941. });
  942. if (artResults.Any())
  943. {
  944. await Task.WhenAll(artResults);
  945. }
  946. }
  947. public class ScreenshotDto
  948. {
  949. public int width { get; set; } = 1920;
  950. public int height { get; set; } = 1080;
  951. public string? url { get; set; }
  952. /// <summary>
  953. /// 批量地址
  954. /// </summary>
  955. public List<string> urls { get; set; } = new List<string>();
  956. /// <summary>
  957. /// 提取参数的唯一id作为文件名
  958. /// </summary>
  959. public string? fileNameKey { get; set; }
  960. /// <summary>
  961. /// 存在哪个容器里
  962. /// </summary>
  963. public string? cnt { get; set; }
  964. public int delay { get; set; }
  965. public int pagesize { get; set; } = 5;
  966. public string? root { get; set; }
  967. public string? env { get; set; } = "release";
  968. public string? msgId { get; set; }
  969. }
  970. }
  971. }