AzureStorageBlobExtensions.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. using System.Threading.Tasks;
  2. using Azure.Storage;
  3. using Azure.Storage.Blobs;
  4. using Azure.Storage.Blobs.Models;
  5. using System;
  6. using System.IO;
  7. using Azure.Storage.Blobs.Specialized;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using Azure.Core;
  12. using Azure;
  13. using TEAMModelOS.SDK;
  14. using TEAMModelOS.SDK.Extension;
  15. using System.Text.Encodings.Web;
  16. using TEAMModelOS.SDK.Models.Table;
  17. using Microsoft.AspNetCore.Http;
  18. using TEAMModelOS.Models;
  19. using Microsoft.Azure.Cosmos;
  20. using static TEAMModelOS.SDK.CoreAPIHttpService;
  21. using Microsoft.Azure.Cosmos.Table;
  22. namespace TEAMModelOS.SDK.DI
  23. {
  24. public static class AzureStorageBlobExtensions
  25. {
  26. /// <summary>
  27. /// 取得指定前置詞的 Blob 名稱的總大小(Bytes),例如指定目錄名稱為前置詞
  28. /// </summary>
  29. /// <param name="prefix">篩選開頭名稱,Null代表容器總大小</param>
  30. /// <returns>總大小(Bytes),如果為Null代表查無前置詞或者發生錯誤</returns>
  31. public static async Task<long?> GetBlobsSize(this BlobContainerClient client, string prefix = null)
  32. {
  33. long? size = 0;
  34. try
  35. {
  36. await foreach (BlobItem item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix))
  37. {
  38. if (item.Name.StartsWith("res/", StringComparison.OrdinalIgnoreCase) && item.Name.EndsWith(".htex", StringComparison.OrdinalIgnoreCase))
  39. { continue; }
  40. if (!prefix.Equals(item.Name))
  41. {
  42. //避免操作(1111) /1111/1111.json /1111111/11111.json
  43. if (!prefix.EndsWith("/"))
  44. {
  45. if (item.Name.StartsWith(prefix + "/"))
  46. {
  47. size += item.Properties.ContentLength;
  48. }
  49. }
  50. }
  51. else
  52. {
  53. size += item.Properties.ContentLength;
  54. }
  55. };
  56. return size;
  57. }
  58. catch
  59. {
  60. return size;
  61. }
  62. }
  63. public static async Task<List<string>> List(this BlobContainerClient client, string prefix = null) {
  64. try
  65. {
  66. List<string> items = new List<string>();
  67. await foreach (BlobItem item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix)) {
  68. items.Add(item.Name);
  69. }
  70. return items;
  71. }
  72. catch
  73. {
  74. return null;
  75. }
  76. }
  77. /// <summary>
  78. /// 取得指定前置詞的 Blob 名稱的總大小(Bytes),例如指定目錄名稱為前置詞
  79. /// </summary>
  80. /// <param name="prefix">篩選開頭名稱,Null代表容器總大小</param>
  81. /// <returns>總大小(Bytes),如果為Null代表查無前置詞或者發生錯誤</returns>
  82. public static async Task<(long?, Dictionary<string, double?>)> GetBlobsCatalogSize(this BlobContainerClient client, string prefix = null)
  83. {
  84. long? size = 0;
  85. Dictionary<string, double?> dict = new Dictionary<string, double?>();
  86. try
  87. {
  88. List<KeyValuePair<string, double?>> foderSize = new List<KeyValuePair<string, double?>>();
  89. await foreach (BlobItem item in client.GetBlobsAsync(BlobTraits.None, BlobStates.None, prefix))
  90. {
  91. var len = item.Properties.ContentLength;
  92. foderSize.Add(new KeyValuePair<string, double?>(item.Name.Split("/")[0], len));
  93. size += item.Properties.ContentLength;
  94. };
  95. foderSize.Select(x => new { x.Key, x.Value }).GroupBy(y=>y.Key).ToList().ForEach(g=> {
  96. var gpsize = g.Select(m => m.Value).Sum();
  97. dict[g.Key] = gpsize;
  98. });
  99. return (size, dict);
  100. }
  101. catch
  102. {
  103. return (size, dict);
  104. }
  105. }
  106. public class OptUrl
  107. {
  108. public string url { get; set; }
  109. public long size { get; set; }
  110. }
  111. /// <summary>
  112. /// 取得指定前置詞的 Blob 名稱的總大小(Bytes),例如指定目錄名稱為前置詞
  113. /// </summary>
  114. /// <param name="urls">多个文件的连接/param>
  115. /// <returns>總大小(Bytes),如果為Null代表查無前置詞或者發生錯誤</returns>
  116. public static async Task<List<OptUrl>> GetBlobsSize(this BlobContainerClient client, List<string> urls)
  117. {
  118. List<OptUrl> optUrls = new List<OptUrl>();
  119. try
  120. {
  121. if (urls != null) {
  122. foreach (var url in urls)
  123. {
  124. OptUrl optUrl = new OptUrl { url = url, size = 0 };
  125. var eurl = System.Web.HttpUtility.UrlDecode(url, Encoding.UTF8);
  126. var blob = client.GetBlobClient(eurl);
  127. if (blob.Exists())
  128. {
  129. var props = await blob.GetPropertiesAsync();
  130. var size = props.Value.ContentLength;
  131. optUrl.size = size;
  132. }
  133. optUrls.Add(optUrl);
  134. }
  135. }
  136. return optUrls;
  137. }
  138. catch
  139. {
  140. return optUrls;
  141. }
  142. }
  143. /// <summary>
  144. ///prefixs多个文件或文件夹路径删除
  145. ///prefixs 或者按前缀文件夹删除
  146. ///
  147. /// </summary>
  148. /// <param name="prefix">篩選開頭名稱,Null代表容器</param>
  149. public static async Task<bool> DeleteBlobs(this BlobServiceClient client,DingDing _dingDing, string blobContainerName, List<string> prefixs )
  150. {
  151. if (!prefixs.IsNotEmpty()) return false;
  152. try
  153. {
  154. BlobContainerClient bcc = client.GetBlobContainerClient(blobContainerName.ToLower());
  155. BlobBatchClient bbc = client.GetBlobBatchClient();
  156. List<Uri> blobs = new List<Uri>();
  157. List<Task<Azure.Response<bool>>> list = new List<Task<Azure.Response<bool>>>();
  158. foreach (var prefix in prefixs) {
  159. string px = prefix;
  160. if (prefix.StartsWith("/")) {
  161. px= prefix.Substring(1);
  162. }
  163. //目录必须有两层以上,避免删除根目录所有的。
  164. var pxlen= px.Split("/");
  165. if (pxlen.Length >=2) {
  166. var items = bcc.GetBlobsAsync(BlobTraits.None, BlobStates.None, px);
  167. await foreach (var item in items)
  168. {
  169. var urib = new UriBuilder(bcc.Uri);
  170. if (!prefix.Equals(item.Name))
  171. {
  172. //避免操作(1111) /1111/1111.json /1111111/11111.json
  173. if (!prefix.EndsWith("/"))
  174. {
  175. if (item.Name.StartsWith(prefix + "/"))
  176. {
  177. string path = $"{urib.Uri.AbsoluteUri}/{item.Name}";
  178. list.Add(bcc.GetBlobClient(item.Name).DeleteIfExistsAsync());
  179. if (item.Name.StartsWith("res/") && item.Name.EndsWith("/index.json"))
  180. {
  181. list.Add(bcc.GetBlobClient($"{prefix}.htex").DeleteIfExistsAsync());
  182. list.Add(bcc.GetBlobClient($"{prefix}.HTEX").DeleteIfExistsAsync());
  183. }
  184. blobs.Add(new Uri(path));
  185. }
  186. }
  187. }
  188. else
  189. {
  190. string path = $"{urib.Uri.AbsoluteUri}/{item.Name}";
  191. list.Add(bcc.GetBlobClient(item.Name).DeleteIfExistsAsync());
  192. blobs.Add(new Uri(path));
  193. }
  194. };
  195. }
  196. }
  197. if (list.Count > 0) {
  198. if (list.Count <= 256)
  199. {
  200. await Task.WhenAll(list);
  201. }
  202. else
  203. {
  204. int pages = (list.Count + 255) / 256; //256是批量操作最大值,pages = (total + max -1) / max;
  205. for (int i = 0; i < pages; i++)
  206. {
  207. List<Task<Azure.Response<bool>>> lists = list.Skip((i) * 256).Take(256).ToList();
  208. await Task.WhenAll(lists);
  209. }
  210. }
  211. }
  212. return true;
  213. /*
  214. if (blobs.Count <= 256)
  215. {
  216. if (blobs.Count > 0) {
  217. try {
  218. ResponseMessage[] ass = await bbc.DeleteBlobsAsync(blobs);
  219. }
  220. catch (AggregateException ex)
  221. {
  222. //删除多个时会,如果其中一个文件不存在 或者其中一个删除失败会引发该异常
  223. return true;
  224. }
  225. catch (RequestFailedException ex)
  226. {
  227. await _dingDing.SendBotMsg($"/{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
  228. return true;
  229. }
  230. catch (Exception ex)
  231. {
  232. return true;
  233. }
  234. }
  235. return true;
  236. }
  237. else
  238. {
  239. int pages = (blobs.Count + 255) / 256; //256是批量操作最大值,pages = (total + max -1) / max;
  240. for (int i = 0; i < pages; i++)
  241. {
  242. List<Uri> lists = blobs.Skip((i) * 256).Take(256).ToList();
  243. try { ResponseMessage[] ass = await bbc.DeleteBlobsAsync(lists); }
  244. catch (AggregateException ex)
  245. {
  246. //删除多个时会,如果其中一个文件不存在 或者其中一个删除失败会引发该异常
  247. return true;
  248. }
  249. catch (RequestFailedException ex)
  250. {
  251. return true;
  252. }
  253. catch (Exception ex)
  254. {
  255. return true;
  256. }
  257. }
  258. return true;
  259. }
  260. */
  261. }
  262. catch(Exception ex )
  263. {
  264. await _dingDing.SendBotMsg($"文件删除异常{ex.Message}\n{ex.StackTrace}{prefixs.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
  265. return false;
  266. }
  267. }
  268. /// <summary>
  269. /// 保存操作记录
  270. /// </summary>
  271. /// <param name="azureStorage"></param>
  272. /// <param name="type"></param>
  273. /// <param name="msg"></param>
  274. /// <param name="dingDing"></param>
  275. /// <param name="scope"></param>
  276. /// <param name="bizId"></param>
  277. /// <param name="option"></param>
  278. /// <param name="httpContext"></param>
  279. /// <returns></returns>
  280. public static async Task SaveLog(this AzureStorageFactory azureStorage, string type, string msg,DingDing dingDing, string scope = null, string bizId = null, Option option = null, HttpContext httpContext = null)
  281. {
  282. var table = azureStorage.GetCloudTableClient().GetTableReference("IESOptLog");
  283. OptLog log = new() { RowKey = Guid.NewGuid().ToString() };
  284. try
  285. {
  286. object id = null, school = null, name = null, website = null ;
  287. httpContext?.Items.TryGetValue("ID", out id);
  288. httpContext?.Items.TryGetValue("School", out school);
  289. httpContext?.Items.TryGetValue("Name", out name);
  290. httpContext?.Items.TryGetValue("Website", out website);
  291. log.tmdId = id != null ? $"{id}" : log.tmdId;
  292. log.name = name != null ? $"{name}" : log.name;
  293. string host = httpContext?.Request?.Host.Value;
  294. log.school = school != null ? $"{school}" : log.school;
  295. log.PartitionKey = type != null ? $"Log-{type}" : "Log-Default";
  296. log.RowKey = bizId != null ? bizId : log.RowKey;
  297. log.platform = website!=null? $"{website}" : "Default";
  298. log.msg = msg;
  299. log.type = type;
  300. log.scope = scope;
  301. host = !string.IsNullOrWhiteSpace($"{host}") ? $"{host}" : option?.Location != null ? $"{host}" : "Default";
  302. log.url =$"{host}{httpContext?.Request.Path}" ;
  303. if (!string.IsNullOrWhiteSpace(msg) && msg.Length > 256)
  304. {
  305. log.saveMod = 1;
  306. log.jsonfile = $"/0-public/optlog/{log.RowKey}-{log.PartitionKey}.json";
  307. await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(log.ToJsonString(), "optlog", $"{log.RowKey}-{log.PartitionKey}.json");
  308. log.msg = null;
  309. await table.SaveOrUpdate<OptLog>(log);
  310. }
  311. else {
  312. await table.SaveOrUpdate<OptLog>(log);
  313. }
  314. }
  315. catch (Exception ex)
  316. {
  317. _ = dingDing.SendBotMsg($"日志保存失败:{ex.Message}\n{ex.StackTrace},,{log.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
  318. }
  319. }
  320. /// <summary>
  321. /// 保存日志文件
  322. /// </summary>
  323. /// <param name="azureStorage"></param>
  324. /// <param name="type"></param>
  325. /// <param name="rootPath"></param>
  326. /// <param name="replaceData"></param>
  327. /// <param name="dingDing"></param>
  328. /// <param name="scope"></param>
  329. /// <param name="bizId"></param>
  330. /// <param name="option"></param>
  331. /// <param name="httpContext"></param>
  332. /// <returns></returns>
  333. public static async Task SaveLogLang(this AzureStorageFactory azureStorage, string type,string rootPath, Dictionary<string, object> replaceData, DingDing dingDing, string scope = null, string bizId = null, Option option = null, HttpContext httpContext = null)
  334. {
  335. string msg = FileWay.FileValue(rootPath, "zh-cn", type, replaceData);
  336. var table = azureStorage.GetCloudTableClient().GetTableReference("IESOptLog");
  337. OptLog log = new() { RowKey = Guid.NewGuid().ToString() };
  338. try
  339. {
  340. object id = null, school = null, name = null, website = null;
  341. httpContext?.Items.TryGetValue("ID", out id);
  342. httpContext?.Items.TryGetValue("School", out school);
  343. httpContext?.Items.TryGetValue("Name", out name);
  344. httpContext?.Items.TryGetValue("Website", out website);
  345. log.tmdId = id != null ? $"{id}" : log.tmdId;
  346. log.name = name != null ? $"{name}" : log.name;
  347. string host = httpContext?.Request?.Host.Value;
  348. log.school = school != null ? $"{school}" : log.school;
  349. log.PartitionKey = type != null ? $"Log-{type}" : "Log-Default";
  350. log.RowKey = bizId != null ? bizId : log.RowKey;
  351. log.platform = website != null ? $"{website}" : "Default";
  352. log.msg = msg;
  353. log.tmsg = FileWay.FileValue(rootPath, "zh-tw", type, replaceData);
  354. log.emsg = FileWay.FileValue(rootPath, "en-us", type, replaceData);
  355. log.type = type;
  356. log.scope = scope;
  357. host = !string.IsNullOrWhiteSpace($"{host}") ? $"{host}" : option?.Location != null ? $"{host}" : "Default";
  358. log.url = $"{host}{httpContext?.Request.Path}";
  359. if (!string.IsNullOrWhiteSpace(msg) && msg.Length > 256)
  360. {
  361. log.saveMod = 1;
  362. log.jsonfile = $"/0-public/optlog/{log.RowKey}-{log.PartitionKey}.json";
  363. await azureStorage.GetBlobContainerClient("0-public").UploadFileByContainer(log.ToJsonString(), "optlog", $"{log.RowKey}-{log.PartitionKey}.json");
  364. log.msg = null;
  365. await table.SaveOrUpdate<OptLog>(log);
  366. }
  367. else
  368. {
  369. await table.SaveOrUpdate<OptLog>(log);
  370. }
  371. }
  372. catch (Exception ex)
  373. {
  374. _ = dingDing.SendBotMsg($"日志保存失败:{ex.Message}\n{ex.StackTrace},,{log.ToJsonString()}", GroupNames.醍摩豆服務運維群組);
  375. }
  376. }
  377. /// <summary>
  378. /// 系统管理员 资源,题目关联,htex关联,学习活动学生上传文件关联,基本信息关联,教室平面图关联,评测冷数据关联
  379. /// "system": [ "res", "item", "htex", "task", "info", "room", "exam" ],
  380. /// 资源,题目关联,htex关联,学习活动学生上传文件关联,基本信息关联,教室平面图关联,评测冷数据关联
  381. /// "school": [ "res", "item", "htex", "task", "info", "room", "exam" ],
  382. /// 资源,题目关联,htex关联,学习活动关联,教师基本信息关联
  383. /// "teacher": [ "res", "item", "htex", "task", "info" ],
  384. /// 答案及学习活动上传的文件,学生基本信息关联
  385. ///"student": [ "stu/{studentId}/ans", "stu/{studentId}/task" ]
  386. /// </summary>
  387. /// <param name="name">容器名称</param>
  388. /// <param name="json">文件内容的流</param>
  389. /// <param name="folder">业务文件夹</param>
  390. /// <param name="fileName">文件名</param>
  391. /// <param name="contentTypeDefault">是否存放文件后缀对应的contentType</param>
  392. /// <returns></returns>
  393. public static async Task<string> UploadFileByContainer(this BlobContainerClient blobContainer, string json, string root, string blobpath, bool contentTypeDefault = true)
  394. {
  395. // string groupName =folder;
  396. //BlobContainerClient blobContainer = azureStorage.GetBlobContainerClient(name.ToLower().Replace("#", "")); //blobClient.GetContainerReference(groupName);
  397. var blockBlob = blobContainer.GetBlobClient($"{root}/{blobpath}");
  398. string content_type = "application/octet-stream";
  399. if (!contentTypeDefault)
  400. {
  401. string fileext = blobpath.Substring(blobpath.LastIndexOf(".") > 0 ? blobpath.LastIndexOf(".") : 0);
  402. ContentTypeDict.dict.TryGetValue(fileext, out string contenttype);
  403. if (!string.IsNullOrEmpty(contenttype))
  404. {
  405. content_type = contenttype;
  406. }
  407. }
  408. byte[] bytes = System.Text.Encoding.Default.GetBytes(json);
  409. Stream streamBlob = new MemoryStream(bytes);
  410. await blockBlob.UploadAsync(streamBlob, true);
  411. blockBlob.SetHttpHeaders(new BlobHttpHeaders { ContentType = content_type });
  412. return blockBlob.Uri.ToString();
  413. }
  414. /// <summary>
  415. /// 系统管理员 资源,题目关联,htex关联,学习活动学生上传文件关联,基本信息关联,教室平面图关联,评测冷数据关联
  416. /// "system": [ "res", "item", "htex", "task", "info", "room", "exam" ],
  417. /// 资源,题目关联,htex关联,学习活动学生上传文件关联,基本信息关联,教室平面图关联,评测冷数据关联
  418. /// "school": [ "res", "item", "htex", "task", "info", "room", "exam" ],
  419. /// 资源,题目关联,htex关联,学习活动关联,教师基本信息关联
  420. /// "teacher": [ "res", "item", "htex", "task", "info" ],
  421. /// 答案及学习活动上传的文件,学生基本信息关联
  422. ///"student": [ "stu/{studentId}/ans", "stu/{studentId}/task" ]
  423. /// </summary>
  424. /// <param name="name">容器名称</param>
  425. /// <param name="stream">文件内容的流</param>
  426. /// <param name="folder">业务文件夹</param>
  427. /// <param name="fileName">文件名</param>
  428. /// <param name="contentTypeDefault">是否存放文件后缀对应的contentType</param>
  429. /// <returns></returns>
  430. public static async Task<string> UploadFileByContainer(this BlobContainerClient blobContainer, Stream stream, string root, string blobpath, bool contentTypeDefault = true)
  431. {
  432. //BlobContainerClient blobContainer = azureStorage.GetBlobContainerClient(name.ToLower().Replace("#", "")); //blobClient.GetContainerReference(groupName);
  433. Uri url = blobContainer.Uri;
  434. var blockBlob = blobContainer.GetBlobClient($"{root}/{blobpath}");
  435. string content_type = "application/octet-stream";
  436. if (!contentTypeDefault)
  437. {
  438. string fileext = blobpath.Substring(blobpath.LastIndexOf(".") > 0 ? blobpath.LastIndexOf(".") : 0);
  439. ContentTypeDict.dict.TryGetValue(fileext, out string contenttype);
  440. if (!string.IsNullOrEmpty(contenttype))
  441. {
  442. content_type = contenttype;
  443. }
  444. }
  445. await blockBlob.UploadAsync(stream, true);
  446. blockBlob.SetHttpHeaders(new BlobHttpHeaders { ContentType = content_type });
  447. return blockBlob.Uri.ToString();
  448. }
  449. /// <summary>
  450. /// BI保存操作记录
  451. /// </summary>
  452. /// <param name="azureStorage"></param>
  453. /// <param name="type"></param>
  454. /// <param name="msg"></param>
  455. /// <param name="dingDing"></param>
  456. /// <param name="scope"></param>
  457. /// <param name="option"></param>
  458. /// <param name="httpContext"></param>
  459. /// <returns></returns>
  460. public static async Task SaveBILog(BlobContainerClient blobContainer, CloudTableClient tableClient, string type, string msg, DingDing dingDing, string tid = null, string tname = null, string twebsite = null, string scope = null, Option option = null, HttpContext httpContext = null)
  461. {
  462. var table = tableClient.GetTableReference("BIOptLog");
  463. BIOptLog biLog = new() { RowKey = Guid.NewGuid().ToString() };
  464. try
  465. {
  466. object id = null, name = null, ddid = null, ddname = null, website = null;
  467. httpContext?.Items.TryGetValue("ID", out id);
  468. httpContext?.Items.TryGetValue("Name", out name);
  469. httpContext?.Items.TryGetValue("DDId", out ddid);
  470. httpContext?.Items.TryGetValue("DDName", out ddname);
  471. httpContext?.Items.TryGetValue("Website", out website);
  472. string site = twebsite != null ? twebsite : $"{website}";
  473. biLog.tmdId = id != null ? $"{id}" : tid;
  474. biLog.name = name != null ? $"{name}" : tname;
  475. biLog.PartitionKey = type != null ? $"{site}-Log-{type}" : $"{site}-Log-Default";
  476. biLog.platform = site != null ? site : "Default";
  477. biLog.msg = msg;
  478. biLog.type = type;
  479. biLog.scope = scope;
  480. string host = httpContext?.Request?.Host.Value;
  481. host = !string.IsNullOrWhiteSpace($"{host}") ? $"{host}" : option?.Location != null ? $"{host}" : "Default";
  482. biLog.url = $"{host}{httpContext?.Request.Path}";
  483. if (!string.IsNullOrWhiteSpace(msg) && msg.Length > 255)
  484. {
  485. biLog.saveMod = 1;
  486. biLog.jsonfile = $"/0-public/BIOptLog/{biLog.PartitionKey}-{biLog.RowKey}.json";
  487. await UploadFileByContainer(blobContainer, biLog.ToJsonString(), "BIOptLog", $"{biLog.PartitionKey}-{biLog.RowKey}.json");
  488. biLog.msg = null;
  489. await table.SaveOrUpdate<BIOptLog>(biLog);
  490. }
  491. else await table.SaveOrUpdate<BIOptLog>(biLog);
  492. }
  493. catch (Exception ex)
  494. {
  495. _ = dingDing.SendBotMsg($"BI日志保存失败:{ex.Message}\n{ex.StackTrace},,{biLog.ToJsonString()}", GroupNames.成都开发測試群組);
  496. }
  497. }
  498. }
  499. }