OnLineController.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. using Azure.Cosmos;
  2. using Azure.Storage.Blobs;
  3. using Azure.Storage.Blobs.Models;
  4. using Microsoft.AspNetCore.Http;
  5. using Microsoft.AspNetCore.Mvc;
  6. using StackExchange.Redis;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.IO;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Text.Json;
  13. using System.Threading.Tasks;
  14. using TEAMModelBI.Tool;
  15. using TEAMModelOS.SDK.Context.BI;
  16. using TEAMModelOS.SDK.Context.Constant;
  17. using TEAMModelOS.SDK.DI;
  18. using TEAMModelOS.SDK.Extension;
  19. using TEAMModelOS.SDK.Models;
  20. using TEAMModelOS.SDK.Models.Cosmos.BI;
  21. using TEAMModelOS.SDK.Models.Table;
  22. namespace TEAMModelBI.Controllers.BIHome
  23. {
  24. [Route("online")]
  25. [ApiController]
  26. public class OnLineController : ControllerBase
  27. {
  28. private readonly AzureCosmosFactory _azureCosmos;
  29. private readonly AzureStorageFactory _azureStorage;
  30. private readonly AzureRedisFactory _azureRedis;
  31. public OnLineController(AzureCosmosFactory azureCosmos, AzureStorageFactory azureStorage, AzureRedisFactory azureRedis)
  32. {
  33. _azureCosmos = azureCosmos;
  34. _azureStorage = azureStorage;
  35. _azureRedis = azureRedis;
  36. }
  37. /// <summary>
  38. /// 总数统计 //已对接
  39. /// </summary>
  40. /// <returns></returns>
  41. [ProducesDefaultResponseType]
  42. [HttpPost("get-count")]
  43. public async Task<IActionResult> GetCount(JsonElement jsonElement)
  44. {
  45. var cosmosClient = _azureCosmos.GetCosmosClient();
  46. var table = _azureStorage.GetCloudTableClient().GetTableReference("IESLogin");
  47. var blobClient = _azureStorage.GetBlobContainerClient($"0-public");
  48. jsonElement.TryGetProperty("site", out JsonElement site);
  49. if ($"{site}".Equals(BIConst.Global))
  50. {
  51. cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
  52. table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("IESLogin");
  53. blobClient = _azureStorage.GetBlobContainerClient($"0-public", BIConst.Global);
  54. }
  55. DateTimeOffset dateTime = DateTimeOffset.UtcNow;
  56. string cDay = dateTime.ToString("yyyyMMdd");
  57. var (daySt, dayEt) = TimeHelper.GetStartOrEnd(dateTime); //今天开始时间 13位
  58. var (daySf, dayEf) = TimeHelper.GetStartOrEnd(dateTime, dateLenth: false); //今天开始时间 10位
  59. var (lastDayS, lastdayE) = TimeHelper.GetStartOrEnd(dateTime.AddDays(-1)); //昨天开始时间
  60. var near7S = dateTime.AddDays(-7).ToUnixTimeMilliseconds(); //前七天的开始时间
  61. var near7E = dateTime.ToUnixTimeMilliseconds(); //当前结束时间
  62. long hour1 = dateTime.AddHours(-1).ToUnixTimeMilliseconds(); //一小时前时间戳
  63. int areaCnt = 0; //学区总数
  64. int scCnt = 0; //学校总数
  65. int tchCnt = 0; //教师总数
  66. int stuCnt = 0; //学生总数
  67. int apiCnt = 0; //当天接口访问总量
  68. int onStuCnt = 0; //学生在线人数
  69. int onTchCnt = 0; //教师在线人数
  70. int todayScCnt = 0; //今日新增学校数
  71. int todayTchCnt = 0; //今日新增教师
  72. int todayStuCnt = 0; //今日新增学生数
  73. string currentSql = "select value(count(c.id)) from c";
  74. areaCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Normal", currentSql, "Base-Area");
  75. scCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", currentSql, "Base");
  76. tchCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", currentSql, "Base");
  77. stuCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Student", "select value(count(c.id)) from c where c.pk='Base'");
  78. string addSql = $"select value(count(c.id)) from c where c.createTime >={daySt} and c.createTime <= {dayEt}";
  79. todayScCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", addSql, "Base");
  80. todayTchCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", addSql, "Base");
  81. todayStuCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Student", addSql, "Base");
  82. string onStuSql = $"select value(count(c.id)) from c join t in c.loginInfos where array_length(c.loginInfos) > 0 and t.expire > {hour1} and c.pk='Base'";
  83. onTchCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Teacher", onStuSql);
  84. onStuCnt = await CommonFind.GetSqlValueCount(cosmosClient, "Student", onStuSql);
  85. //接口访问量
  86. List<RecCnt> recCnts = new();
  87. await foreach (BlobItem blobItem in blobClient.GetBlobsAsync(BlobTraits.None, BlobStates.None, $"visitCnt/{cDay}"))
  88. {
  89. if(blobItem.Name.EndsWith(".json"))
  90. {
  91. BlobClient tempBlobClient = blobClient.GetBlobClient(blobItem.Name);
  92. if (await tempBlobClient.ExistsAsync())
  93. {
  94. using (var meomoryStream = new MemoryStream())
  95. {
  96. var response = blobClient.GetBlobClient($"{blobItem.Name}").DownloadTo(meomoryStream);
  97. RecCnt recCnt = Encoding.UTF8.GetString(meomoryStream.ToArray()).ToString().ToObject<RecCnt>();
  98. recCnts.Add(recCnt);
  99. }
  100. }
  101. }
  102. }
  103. apiCnt = recCnts.Select(x => x.apiCnt.Select(s => s.count).Sum()).Sum();
  104. return Ok(new { state = 200, areaCnt, scCnt, tchCnt, stuCnt, todayScCnt, todayTchCnt, todayStuCnt, onStuCnt, onTchCnt, apiCnt });
  105. }
  106. /// <summary>
  107. /// 在线人数趋势图 //已对接
  108. /// </summary>
  109. /// <returns></returns>
  110. [ProducesDefaultResponseType]
  111. [HttpPost("get-trend")]
  112. public async Task<IActionResult> GetTrend(JsonElement jsonElement)
  113. {
  114. var table = _azureStorage.GetCloudTableClient().GetTableReference("IESLogin");
  115. var redisClinet = _azureRedis.GetRedisClient(8);
  116. jsonElement.TryGetProperty("site", out JsonElement site);
  117. if ($"{site}".Equals(BIConst.Global))
  118. {
  119. table = _azureStorage.GetCloudTableClient(BIConst.Global).GetTableReference("IESLogin");
  120. redisClinet = _azureRedis.GetRedisClient(dbnum: 8, name: BIConst.Global);
  121. }
  122. DateTimeOffset dateTime = DateTimeOffset.UtcNow;
  123. var (daySt, dayEt) = TimeHelper.GetStartOrEnd(dateTime); //今天开始时间 13位
  124. var (strDaySt, strDayEt) = TimeHelper.GetUnixToDate(daySt, dayEt, "yyyyMMddHH");
  125. var dateDay = dateTime.ToString("yyyyMMdd"); //获取当天的日期
  126. //daySt.ToString("yyyyMMddHH");
  127. Dictionary<long, int> allDays = new(); //所有在线人数
  128. Dictionary<long, int> tchDays = new(); //教师在线人数
  129. Dictionary<long, int> stuDays = new(); //学生在线人数
  130. Dictionary<long, int> tmdDays = new(); //醍摩豆账户学生
  131. SortedSetEntry[] tchDay = redisClinet.SortedSetRangeByScoreWithScores($"Login:IES:teacher:{dateDay}");
  132. if (tchDay.Length > 0)
  133. {
  134. foreach (var item in tchDay)
  135. {
  136. int val = ((int)item.Score);
  137. int key = ((int)item.Element);
  138. //var utcTo = new DateTimeOffset(new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, key, 0, 0)).Hour;
  139. //var hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {key}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH"));
  140. tchDays.Add(key, val);
  141. if (allDays.ContainsKey(key))
  142. allDays[key] = (allDays[key] + val);
  143. else
  144. allDays.Add(key, val);
  145. }
  146. }
  147. else
  148. {
  149. string tableSqlTch = $"PartitionKey eq 'HourLogin' and RowKey ge '{strDaySt}' and RowKey le '{strDayEt}'";
  150. List<HourLogin> hourLoginsTch = await table.QueryWhereString<HourLogin>(tableSqlTch);
  151. if (hourLoginsTch.Count > 0)
  152. {
  153. foreach (var item in hourLoginsTch)
  154. {
  155. await redisClinet.SortedSetIncrementAsync($"Login:IES:teacher:{dateDay}", $"{item.Hour}", item.Teacher);//存一天24小时
  156. tchDays.Add(item.Hour, item.Teacher);
  157. if (allDays.ContainsKey(item.Hour))
  158. allDays[item.Hour] = (allDays[item.Hour] + item.Teacher);
  159. else
  160. allDays.Add(item.Hour, item.Teacher);
  161. }
  162. }
  163. }
  164. SortedSetEntry[] stuDay = redisClinet.SortedSetRangeByScoreWithScores($"Login:IES:student:{dateDay}");
  165. if (stuDay.Length > 0)
  166. {
  167. foreach (var item in stuDay)
  168. {
  169. int val = (int)item.Score;
  170. int key = (int)item.Element;
  171. stuDays.Add(key, val);
  172. if (allDays.ContainsKey(key))
  173. allDays[key] = (allDays[key] + val);
  174. else
  175. allDays.Add(key, val);
  176. }
  177. }
  178. else
  179. {
  180. string tableSqlStu = $"PartitionKey eq 'HourLogin' and RowKey ge '{strDaySt}' and RowKey le '{strDayEt}'";
  181. List<HourLogin> hourLoginsStu = await table.QueryWhereString<HourLogin>(tableSqlStu);
  182. //var hourStuCnt = hourLoginsStu.GroupBy(x => x.Hour).Select(k => new { key = int.Parse(k.Key.ToString().Substring(8, 2)), value = k.Count() }).ToList();
  183. if (hourLoginsStu.Count > 0)
  184. {
  185. foreach (var item in hourLoginsStu)
  186. {
  187. await redisClinet.SortedSetIncrementAsync($"Login:IES:student:{dateDay}", $"{item.Hour}", item.Student);//存一天24小时
  188. stuDays.Add(item.Hour, item.Student);
  189. if (allDays.ContainsKey(item.Hour))
  190. allDays[item.Hour] = (allDays[item.Hour] + item.Student);
  191. else
  192. allDays.Add(item.Hour, item.Student);
  193. }
  194. }
  195. }
  196. SortedSetEntry[] tmdDay = redisClinet.SortedSetRangeByScoreWithScores($"Login:IES:tmduser:{dateDay}");
  197. if (tmdDay.Length > 0)
  198. {
  199. foreach (var item in tmdDay)
  200. {
  201. int val = (int)item.Score;
  202. int key = (int)item.Element;
  203. tmdDays.Add(key, val);
  204. if (allDays.ContainsKey(key))
  205. allDays[key] = (allDays[key] + val);
  206. else
  207. allDays.Add(key, val);
  208. }
  209. }
  210. else
  211. {
  212. string tableSqlTmd = $"PartitionKey eq 'HourLogin' and RowKey ge '{strDaySt}' and RowKey le '{strDayEt}'";
  213. List<HourLogin> hourLoginsTmd = await table.QueryWhereString<HourLogin>(tableSqlTmd);
  214. //var hourTmdCnt = hourLoginsTmd.GroupBy(x => x.Hour).Select(k => new { key = int.Parse(k.Key.ToString().Substring(8, 2)), value = k.Count() }).ToList();
  215. if (hourLoginsTmd.Count > 0)
  216. {
  217. foreach (var item in hourLoginsTmd)
  218. {
  219. await redisClinet.SortedSetIncrementAsync($"Login:IES:tmduser:{dateDay}", $"{item.Hour}", item.TmdUser);//存一天24小时
  220. var utcTo = new DateTimeOffset(new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, item.Hour, 00, 00)).Hour;
  221. tmdDays.Add(utcTo, item.TmdUser);
  222. if (allDays.ContainsKey(utcTo))
  223. allDays[utcTo] = (allDays[utcTo] + item.TmdUser);
  224. else
  225. allDays.Add(utcTo, item.TmdUser);
  226. }
  227. }
  228. }
  229. return Ok(new { state = 200,allDays = allDays.OrderBy(o=>o.Key).ToList(), tchDays=tchDays.OrderBy(o => o.Key).ToList(), stuDays= stuDays.OrderBy(o => o.Key).ToList(), tmdDays= tmdDays.OrderBy(o => o.Key).ToList() });
  230. }
  231. /// <summary>
  232. /// 课例趋势图 //已对接
  233. /// </summary>
  234. /// <returns></returns>
  235. [ProducesDefaultResponseType]
  236. [HttpPost("get-lessontrend")]
  237. public async Task<IActionResult> GetLessonTrend(JsonElement jsonElement)
  238. {
  239. DateTimeOffset dateTime = DateTimeOffset.UtcNow;
  240. var cosmosClient = _azureCosmos.GetCosmosClient();
  241. jsonElement.TryGetProperty("site", out JsonElement site);
  242. if ($"{site}".Equals(BIConst.Global))
  243. {
  244. cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
  245. }
  246. int year = dateTime.Year; //当前年
  247. int month = dateTime.Month; //当前月
  248. int day = dateTime.Day; //当天
  249. var lestDate = dateTime.AddDays(-1); //昨天
  250. int hour = int.Parse(DateTime.SpecifyKind(Convert.ToDateTime($"{dateTime.Year}/{dateTime.Month}/{ dateTime.Day} {dateTime.Hour}:00:00"), DateTimeKind.Utc).ToLocalTime().ToString("HH")); //当前小时
  251. var (daySt, dayEt) = TimeHelper.GetStartOrEnd(dateTime); //今天开始时间 13位
  252. var (lastDayS, lastdayE) = TimeHelper.GetStartOrEnd(lestDate); //昨天开始时间
  253. var (monthDayS, monthDayE) = TimeHelper.GetStartOrEnd(lestDate, "monthDay"); //本月开始/结束时间
  254. var (yearS, yearE) = TimeHelper.GetStartOrEnd(lestDate, "yearMonth"); //本月开始/结束时间
  255. Dictionary<int, int> sdOpenLesn = new(); //今日开课
  256. Dictionary<int, int> sdUpdLesn = new(); //今日上传课例
  257. Dictionary<int, int> ydOpenLesn = new(); //昨日开课
  258. Dictionary<int, int> ydUpdLesn = new(); //昨日上传课例
  259. Dictionary<int, int> mthOpenLesn = new(); //本月开课
  260. Dictionary<int, int> mthUpdLesn = new(); //本月上传课例
  261. Dictionary<int, int> yrOpenLesn = new(); //本年开课
  262. Dictionary<int, int> yrUpdLesn = new(); //本年上传课例
  263. Dictionary<int, int> allOpenLesn = new(); //所有年开课
  264. Dictionary<int, int> allUpdLesn = new(); //所有年上传课例
  265. List<RecLesn> yearLeson = new();
  266. List<RecLesn> allLess = new();
  267. string allSql = "select c.id,c.name,c.code,c.school,c.scope,c.startTime from c where c.pk='LessonRecord'";
  268. //所有的课例
  269. allLess = await CommonFind.GetObject<RecLesn>(cosmosClient, new List<string>() { "School", "Teacher" }, allSql);
  270. if (allLess.Count > 0)
  271. {
  272. for (int i = 0; i < 24; i++)
  273. {
  274. if (hour >= i)
  275. {
  276. DateTimeOffset timeHour = new DateTime(year, month, day, i, 0, 0);
  277. var (hourS, hourE) = TimeHelper.GetStartOrEnd(timeHour, type: "hour");
  278. var openLesn1 = allLess.Where(item => item.startTime >= hourS && item.startTime <= hourE && item.upload == 0).Count();
  279. var openLesn = allLess.Where(item => item.startTime >= hourS && item.startTime <= hourE && item.upload == 0).ToList();
  280. sdOpenLesn.Add(i, openLesn.Count());
  281. var UpdLesn = allLess.Where(item => item.startTime >= hourS && item.startTime <= hourE && item.upload == 1).ToList();
  282. sdUpdLesn.Add(i, UpdLesn.Count());
  283. }
  284. DateTimeOffset yesterday = new DateTime(lestDate.Year, lestDate.Month, lestDate.Day, i, 0, 0);
  285. var (yHourS, yHourE) = TimeHelper.GetStartOrEnd(yesterday, type: "hour");
  286. var yOpenLesn = allLess.Where(item => item.startTime >= yHourS && item.startTime <= yHourE && item.upload == 0).ToList();
  287. ydOpenLesn.Add(i, yOpenLesn.Count);
  288. var yUpdLesn = allLess.Where(item => item.startTime >= yHourS && item.startTime <= yHourE && item.upload == 1).ToList();
  289. ydUpdLesn.Add(i, yUpdLesn.Count);
  290. }
  291. for (int i = 1; i <= day; i++)
  292. {
  293. DateTimeOffset timeDay = new DateTime(year, month, i, 0, 0, 0);
  294. var (dayS, dayE) = TimeHelper.GetStartOrEnd(timeDay); //本月开始/结束时间
  295. var openLesn = allLess.Where(item => item.startTime >= dayS && item.startTime <= dayE && item.upload == 0).ToList();
  296. mthOpenLesn.Add(i, openLesn.Count());
  297. var UpdLesn = allLess.Where(item => item.startTime >= dayS && item.startTime <= dayE && item.upload == 1).ToList();
  298. mthUpdLesn.Add(i, UpdLesn.Count());
  299. }
  300. for (int i = 1; i <= month; i++)
  301. {
  302. DateTimeOffset timeDay = DateTimeOffset.UtcNow;
  303. if (i == 2)
  304. {
  305. int tempDay = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? tempDay = 29 : tempDay = 28;
  306. timeDay = new DateTime(year, i, tempDay, 0, 0, 0);
  307. }
  308. var (monthS, monthE) = TimeHelper.GetStartOrEnd(timeDay, "month"); //本月开始/结束时间
  309. var openLesn = allLess.Where(item => item.startTime >= monthS && item.startTime <= monthE && item.upload == 0).ToList();
  310. yrOpenLesn.Add(i, openLesn.Count());
  311. var UpdLesn = allLess.Where(item => item.startTime >= monthS && item.startTime <= monthE && item.upload == 1).ToList();
  312. yrUpdLesn.Add(i, UpdLesn.Count());
  313. }
  314. yearLeson = allLess.Select(item => { item.startTime = TimeHelper.GetDateTime(item.startTime).Year; return item; }).ToList();
  315. List<RecLesn> oRecLess = yearLeson.Where(o => o.upload == 0).ToList();
  316. var allo = oRecLess.GroupBy(g => g.startTime).Select(s => new { key = s.Key, value = s.Count() }).ToList();
  317. if (allo.Count > 0)
  318. allo.ForEach(a => { allOpenLesn.Add((int)a.key, a.value); });
  319. List<RecLesn> uRecLesns = yearLeson.Where(o => o.upload == 1).ToList();
  320. var allu = uRecLesns.GroupBy(g => g.startTime).Select(s => new { key = s.Key, value = s.Count() }).ToList();
  321. if (allu.Count > 0)
  322. allu.ForEach(a => { allUpdLesn.Add((int)a.key, a.value); });
  323. }
  324. return Ok(new
  325. {
  326. state = RespondCode.Ok,
  327. hours = new { sdOpenLesn = sdOpenLesn.ToList(), sdUpdLesn = sdUpdLesn.ToList(), ydOpenLesn = ydOpenLesn.ToList(), ydUpdLesn = ydUpdLesn.ToList() },
  328. days = new { sdOpenLesn = mthOpenLesn.ToList(), sdUpdLesn = mthUpdLesn.ToList() },
  329. months = new { sdOpenLesn = yrOpenLesn.ToList(), sdUpdLesn = yrUpdLesn.ToList() },
  330. years = new { sdOpenLesn = allOpenLesn.ToList(), sdUpdLesn = allUpdLesn.ToList() }
  331. }) ;
  332. }
  333. /// <summary>
  334. /// 版本数量占比 //已对接
  335. /// </summary>
  336. /// <returns></returns>
  337. [ProducesDefaultResponseType]
  338. [HttpPost("get-edition")]
  339. public async Task<IActionResult> GetEdition(JsonElement jsonElement)
  340. {
  341. var cosmosClient = _azureCosmos.GetCosmosClient();
  342. jsonElement.TryGetProperty("site", out JsonElement site);
  343. if ($"{site}".Equals(BIConst.Global))
  344. {
  345. cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
  346. }
  347. int beCnt = 0; //基础班
  348. int seCnt = 0; //标准版
  349. int peCnt = 0; //专业版
  350. List<RecScEd> scEdCnt = new();
  351. var ScSql = $"select c.id,c.name,c.size,c.scale from c";
  352. await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<RecScEd>(queryText: ScSql, requestOptions:new QueryRequestOptions() { PartitionKey= new PartitionKey("Base")}))
  353. {
  354. scEdCnt.Add(item);
  355. }
  356. scEdCnt.ForEach(async scProCnt =>
  357. {
  358. var response = await cosmosClient.GetContainer("TEAMModelOS", "School").ReadItemStreamAsync(scProCnt.id, new PartitionKey("ProductSum"));
  359. if (response.Status == 200)
  360. {
  361. using var json = await JsonDocument.ParseAsync(response.ContentStream);
  362. SchoolProductSum ScProductSum = json.ToObject<SchoolProductSum>();
  363. //scProCnt.serial = ScProductSum.serial.Count();
  364. //scProCnt.service = ScProductSum.service.Count();
  365. //scProCnt.hard = ScProductSum.hard.Count();
  366. int pSeriCnt = ScProductSum.serial.Count();
  367. int pServCnt = ScProductSum.service.Count();
  368. int pHardCnt = ScProductSum.hard.Count();
  369. scProCnt.serial = pSeriCnt;
  370. scProCnt.service = pServCnt;
  371. scProCnt.hard = pHardCnt;
  372. if (scProCnt.scale >= 500 && (pSeriCnt > 0 || pServCnt > 0 || pHardCnt > 0)) peCnt += 1;
  373. }
  374. if (scProCnt.scale >= 500 && scProCnt.serial == 0 && scProCnt.service == 0 && scProCnt.hard == 0) seCnt += 1;
  375. if (scProCnt.scale == 0) beCnt += 1;
  376. });
  377. return Ok(new { state = 200, beCnt, seCnt, peCnt, scEdCnt });
  378. }
  379. /// <summary>
  380. /// 记录学校版本信息
  381. /// </summary>
  382. public record RecScEd
  383. {
  384. public string id { get; set; }
  385. public string name { get; set; }
  386. public int size { get; set; }
  387. public int scale { get; set; }
  388. public int serial { get; set; } = 0;//软体
  389. public int service { get; set; } = 0; //服务
  390. public int hard { get; set; } = 0; //硬体
  391. }
  392. /// <summary>
  393. /// 记录课例
  394. /// </summary>
  395. public record RecLesn
  396. {
  397. public string id { get; set; }
  398. public string name { get; set; }
  399. public string code { get; set; }
  400. public string school { get; set; }
  401. public string scope{get;set;}
  402. public long startTime { get; set; }
  403. public int upload { get; set; }
  404. }
  405. }
  406. }