From 8cbfa0b7f56d7aa5dc9393e54507cc9a65bc7974 Mon Sep 17 00:00:00 2001 From: Argo Window10 Date: Sun, 10 Nov 2019 13:18:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E7=A8=8B=E5=BA=8F=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8E=A7=E5=88=B6=E5=99=A8=E5=A2=9E=E5=8A=A0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=8E=92=E5=BA=8F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bootstrap.Admin/Controllers/Api/ExceptionsController.cs | 4 ++-- src/admin/Bootstrap.DataAccess/Exceptions.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/admin/Bootstrap.Admin/Controllers/Api/ExceptionsController.cs b/src/admin/Bootstrap.Admin/Controllers/Api/ExceptionsController.cs index a61b9a40..870b7925 100644 --- a/src/admin/Bootstrap.Admin/Controllers/Api/ExceptionsController.cs +++ b/src/admin/Bootstrap.Admin/Controllers/Api/ExceptionsController.cs @@ -57,8 +57,8 @@ namespace Bootstrap.Admin.Controllers.Api var filePath = Path.Combine(AppContext.BaseDirectory, "Error"); var logName = $"{Path.Combine(filePath, exceptionFile.FileName)}.log"; if (!System.IO.File.Exists(logName)) return new JsonResult("无此日志文件"); - StringBuilder sb = new StringBuilder(); - using (StreamReader reader = new StreamReader(logName)) + var sb = new StringBuilder(); + using (var reader = new StreamReader(logName)) { while (!reader.EndOfStream) { diff --git a/src/admin/Bootstrap.DataAccess/Exceptions.cs b/src/admin/Bootstrap.DataAccess/Exceptions.cs index f6b85483..1f50a8fe 100644 --- a/src/admin/Bootstrap.DataAccess/Exceptions.cs +++ b/src/admin/Bootstrap.DataAccess/Exceptions.cs @@ -136,6 +136,7 @@ namespace Bootstrap.DataAccess /// public virtual Page RetrievePages(PaginationOption po, DateTime? startTime, DateTime? endTime) { + if (string.IsNullOrEmpty(po.Sort)) po.Sort = "LogTime"; var sql = new Sql("select * from Exceptions"); if (startTime.HasValue) sql.Append("where LogTime > @0", startTime.Value); if (endTime.HasValue) sql.Append("where LogTime < @0", endTime.Value.AddDays(1).AddSeconds(-1));