IESHttpTrigger.cs 55 KB

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