CommonUtil.cs 997 B

123456789101112131415161718192021222324252627282930313233343536
  1. using Furion;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. namespace Admin.NET.Core
  6. {
  7. /// <summary>
  8. /// 通用工具类
  9. /// </summary>
  10. public static class CommonUtil
  11. {
  12. /// <summary>
  13. /// 获取今天日期范围00:00:00 - 23:59:59
  14. /// </summary>
  15. /// <returns></returns>
  16. public static List<DateTime> GetTodayTimeList(DateTime time)
  17. {
  18. return new List<DateTime>
  19. {
  20. Convert.ToDateTime(time.ToString("D").ToString()),
  21. Convert.ToDateTime(time.AddDays(1).ToString("D").ToString()).AddSeconds(-1)
  22. };
  23. }
  24. /// <summary>
  25. /// 获取项目根目录文件内容
  26. /// </summary>
  27. /// <param name="path"></param>
  28. /// <returns></returns>
  29. public static string GetRootPathFileText(string path)
  30. {
  31. return File.ReadAllText(App.WebHostEnvironment.ContentRootPath + path);
  32. }
  33. }
  34. }