From ea32f209841866696add6bbf16138cdaecedbc10 Mon Sep 17 00:00:00 2001 From: home-mhg Date: Mon, 5 Apr 2021 22:42:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E4=B8=AD=E7=9A=84=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dtos/Output/Sys/UserOutput.cs | 8 ++---- .../ShenNius.Layui.Admin/Common/HttpHelper.cs | 3 +- .../ShenNius.Layui.Admin/Common/LogHelper.cs | 28 +++++++++++-------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/ShenNius.Share.Models/Dtos/Output/Sys/UserOutput.cs b/src/ShenNius.Share.Models/Dtos/Output/Sys/UserOutput.cs index 25aa18e..d1d3c17 100644 --- a/src/ShenNius.Share.Models/Dtos/Output/Sys/UserOutput.cs +++ b/src/ShenNius.Share.Models/Dtos/Output/Sys/UserOutput.cs @@ -6,9 +6,7 @@ namespace ShenNius.Share.Models.Dtos.Input { public class UserOutput { - /// - /// 唯一编号 - /// + //public int Id { get; set; } /// @@ -32,9 +30,7 @@ namespace ShenNius.Share.Models.Dtos.Input /// public string Mobile { get; set; } - /// - /// 状态 1=整除 0=不允许登录 - /// + //public bool Status { get; set; } /// diff --git a/src/client/ShenNius.Layui.Admin/Common/HttpHelper.cs b/src/client/ShenNius.Layui.Admin/Common/HttpHelper.cs index 7a430ad..b54e18b 100644 --- a/src/client/ShenNius.Layui.Admin/Common/HttpHelper.cs +++ b/src/client/ShenNius.Layui.Admin/Common/HttpHelper.cs @@ -50,7 +50,8 @@ namespace ShenNius.Layui.Admin.Common } catch (Exception ex) { - // WebHelper.WriteLog($"\r\n{DateTime.Now}:{ex}"); + + LogHelper.WriteLog($"\r\n{DateTime.Now}:{ex}"); return default; } diff --git a/src/client/ShenNius.Layui.Admin/Common/LogHelper.cs b/src/client/ShenNius.Layui.Admin/Common/LogHelper.cs index 778c822..3d8264b 100644 --- a/src/client/ShenNius.Layui.Admin/Common/LogHelper.cs +++ b/src/client/ShenNius.Layui.Admin/Common/LogHelper.cs @@ -1,6 +1,7 @@ using System; using System.IO; using System.Text; +using System.Threading.Tasks; namespace ShenNius.Layui.Admin.Common { @@ -8,21 +9,24 @@ namespace ShenNius.Layui.Admin.Common { public static void WriteLog(string msg) { - var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log"); - if (!Directory.Exists(path)) + Task.Run(() => { - Directory.CreateDirectory(path); - } - var newFileName = DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; - var logFile = Path.Combine(path, newFileName); - using (FileStream fs = new FileStream(logFile, FileMode.Append, FileAccess.Write)) - { - if (!string.IsNullOrEmpty(msg)) + var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log"); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + var newFileName = DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; + var logFile = Path.Combine(path, newFileName); + using (FileStream fs = new FileStream(logFile, FileMode.Append, FileAccess.Write)) { - byte[] data = Encoding.Default.GetBytes(msg); - fs.Write(data, 0, data.Length); + if (!string.IsNullOrEmpty(msg)) + { + byte[] data = Encoding.Default.GetBytes(msg); + fs.Write(data, 0, data.Length); + } } - } + }); } } } -- Gitee