From d5d7c62d0b3f6386a6571b9162afa10040de9cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=87=92=E5=BE=97=E5=8B=A4=E5=BF=AB?= Date: Thu, 2 Dec 2021 13:26:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=90=9C=E7=B4=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PostController.cs | 2 +- .../Controllers/SystemController.cs | 2 +- .../Extensions/Hangfire/HangfireBackJob.cs | 3 +-- .../Extensions/Hangfire/IHangfireBackJob.cs | 2 +- .../Models/Entity/PostVisitRecord.cs | 2 -- .../Views/Post/PostVisitRecordInsight.cshtml | 19 +------------------ .../Views/Search/Search.cshtml | 3 --- .../Views/Shared/_Layout.cshtml | 2 +- 8 files changed, 6 insertions(+), 29 deletions(-) diff --git a/src/Masuit.MyBlogs.Core/Controllers/PostController.cs b/src/Masuit.MyBlogs.Core/Controllers/PostController.cs index 10f18a00..9ea3baf1 100644 --- a/src/Masuit.MyBlogs.Core/Controllers/PostController.cs +++ b/src/Masuit.MyBlogs.Core/Controllers/PostController.cs @@ -99,7 +99,7 @@ public async Task Details(int id, string kw) if (!HttpContext.Request.IsRobot() && string.IsNullOrEmpty(HttpContext.Session.Get("post" + id))) { - HangfireHelper.CreateJob(typeof(IHangfireBackJob), nameof(HangfireBackJob.RecordPostVisit), args: new dynamic[] { id, ClientIP, Request.Headers[HeaderNames.Referer].ToString(), HttpUtility.UrlDecode(Request.Scheme + "://" + Request.Host + Request.Path + Request.QueryString), Request.Headers.ToJsonString() }); + HangfireHelper.CreateJob(typeof(IHangfireBackJob), nameof(HangfireBackJob.RecordPostVisit), args: new dynamic[] { id, ClientIP, Request.Headers[HeaderNames.Referer].ToString(), HttpUtility.UrlDecode(Request.Scheme + "://" + Request.Host + Request.Path + Request.QueryString) }); HttpContext.Session.Set("post" + id, id.ToString()); } diff --git a/src/Masuit.MyBlogs.Core/Controllers/SystemController.cs b/src/Masuit.MyBlogs.Core/Controllers/SystemController.cs index a1e6dcda..f94c4efe 100644 --- a/src/Masuit.MyBlogs.Core/Controllers/SystemController.cs +++ b/src/Masuit.MyBlogs.Core/Controllers/SystemController.cs @@ -107,7 +107,7 @@ public async Task Save(string sets) var dic = settings.ToDictionary(s => s.Name, s => s.Value); //同步设置 foreach (var (key, value) in dic) { - CommonHelper.SystemSettings.AddOrUpdate(key, value); + CommonHelper.SystemSettings[key]= value; } return ResultData(null, b, b ? "设置保存成功!" : "设置保存失败!"); diff --git a/src/Masuit.MyBlogs.Core/Extensions/Hangfire/HangfireBackJob.cs b/src/Masuit.MyBlogs.Core/Extensions/Hangfire/HangfireBackJob.cs index ca1b981a..c8e0e14b 100644 --- a/src/Masuit.MyBlogs.Core/Extensions/Hangfire/HangfireBackJob.cs +++ b/src/Masuit.MyBlogs.Core/Extensions/Hangfire/HangfireBackJob.cs @@ -112,7 +112,7 @@ public void PublishPost(Post p) /// /// /// - public void RecordPostVisit(int pid, string ip, string refer, string url, string headers) + public void RecordPostVisit(int pid, string ip, string refer, string url) { var time = DateTime.Now.AddMonths(-3); _recordService.GetQuery(b => b.Time < time).DeleteFromQuery(); @@ -130,7 +130,6 @@ public void RecordPostVisit(int pid, string ip, string refer, string url, string Referer = refer, Location = ip.GetIPLocation(), Time = DateTime.Now, - RequestHeader = headers, RequestUrl = url, PostId = pid }); diff --git a/src/Masuit.MyBlogs.Core/Extensions/Hangfire/IHangfireBackJob.cs b/src/Masuit.MyBlogs.Core/Extensions/Hangfire/IHangfireBackJob.cs index 7e458bec..c4ba9e12 100644 --- a/src/Masuit.MyBlogs.Core/Extensions/Hangfire/IHangfireBackJob.cs +++ b/src/Masuit.MyBlogs.Core/Extensions/Hangfire/IHangfireBackJob.cs @@ -30,7 +30,7 @@ public interface IHangfireBackJob /// /// /// - void RecordPostVisit(int pid, string ip, string refer, string url, string headers); + void RecordPostVisit(int pid, string ip, string refer, string url); /// /// 每日任务 diff --git a/src/Masuit.MyBlogs.Core/Models/Entity/PostVisitRecord.cs b/src/Masuit.MyBlogs.Core/Models/Entity/PostVisitRecord.cs index 4e88bdb0..8b7d702a 100644 --- a/src/Masuit.MyBlogs.Core/Models/Entity/PostVisitRecord.cs +++ b/src/Masuit.MyBlogs.Core/Models/Entity/PostVisitRecord.cs @@ -15,8 +15,6 @@ public class PostVisitRecord : BaseEntity public string RequestUrl { get; set; } - public string RequestHeader { get; set; } - public DateTime Time { get; set; } } } diff --git a/src/Masuit.MyBlogs.Core/Views/Post/PostVisitRecordInsight.cshtml b/src/Masuit.MyBlogs.Core/Views/Post/PostVisitRecordInsight.cshtml index 95592eb2..997e80aa 100644 --- a/src/Masuit.MyBlogs.Core/Views/Post/PostVisitRecordInsight.cshtml +++ b/src/Masuit.MyBlogs.Core/Views/Post/PostVisitRecordInsight.cshtml @@ -13,7 +13,6 @@ -