Browse Source

移除抽奖代码

懒得勤快 5 years ago
parent
commit
d8abcc659a

+ 35 - 35
src/Masuit.MyBlogs.Core/Controllers/ActivityController.cs

@@ -1,39 +1,39 @@
-using Masuit.MyBlogs.Core.Extensions;
-using Masuit.Tools.Security;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using System;
+//using Masuit.MyBlogs.Core.Extensions;
+//using Masuit.Tools.Security;
+//using Microsoft.AspNetCore.Http;
+//using Microsoft.AspNetCore.Mvc;
+//using System;
 
-namespace Masuit.MyBlogs.Core.Controllers
-{
-    public class ActivityController : Controller
-    {
-        [HttpGet("sharecode")]
-        public IActionResult GetCode(string q)
-        {
-            if (string.IsNullOrEmpty(q))
-            {
-                throw new NotFoundException("联系方式不能为空");
-            }
+//namespace Masuit.MyBlogs.Core.Controllers
+//{
+//    public class ActivityController : Controller
+//    {
+//        [HttpGet("sharecode")]
+//        public IActionResult GetCode(string q)
+//        {
+//            if (string.IsNullOrEmpty(q))
+//            {
+//                throw new NotFoundException("联系方式不能为空");
+//            }
 
-            var enc = q.AESEncrypt();
-            Response.Cookies.Append("ShareCode", enc, new CookieOptions()
-            {
-                Expires = DateTime.Now.AddYears(1),
-                SameSite = SameSiteMode.Lax
-            });
-            return Content(enc);
-        }
+//            var enc = q.AESEncrypt();
+//            Response.Cookies.Append("ShareCode", enc, new CookieOptions()
+//            {
+//                Expires = DateTime.Now.AddYears(1),
+//                SameSite = SameSiteMode.Lax
+//            });
+//            return Content(enc);
+//        }
 
-        public IActionResult ViewCount(string email)
-        {
-            return Ok(RedisHelper.SMembers("Share:" + email).Length);
-        }
+//        public IActionResult ViewCount(string email)
+//        {
+//            return Ok(RedisHelper.SMembers("Share:" + email).Length);
+//        }
 
-        public ActionResult GetActivityUsers()
-        {
-            var keys = RedisHelper.Keys("Share:*");
-            return Json(keys);
-        }
-    }
-}
+//        public ActionResult GetActivityUsers()
+//        {
+//            var keys = RedisHelper.Keys("Share:*");
+//            return Json(keys);
+//        }
+//    }
+//}

+ 4 - 4
src/Masuit.MyBlogs.Core/Controllers/SubscribeController.cs

@@ -86,7 +86,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                     p.Category.Name
                 },
                 Link = new Uri(scheme + "://" + host + "/" + p.Id),
-                PublishDate = p.ModifyDate,
+                PublishDate = p.ModifyDate.ToUniversalTime(),
                 Title = p.Title,
                 Permalink = scheme + "://" + host + "/" + p.Id,
                 Guid = p.Id.ToString(),
@@ -132,7 +132,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                     p.Category.Name
                 },
                 Link = new Uri(scheme + "://" + host + "/" + p.Id),
-                PublishDate = p.ModifyDate,
+                PublishDate = p.ModifyDate.ToUniversalTime(),
                 Title = p.Title,
                 Permalink = scheme + "://" + host + "/" + p.Id,
                 Guid = p.Id.ToString(),
@@ -178,7 +178,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                     p.Category.Name
                 },
                 Link = new Uri(scheme + "://" + host + "/" + p.Id),
-                PublishDate = p.ModifyDate,
+                PublishDate = p.ModifyDate.ToUniversalTime(),
                 Title = p.Title,
                 Permalink = scheme + "://" + host + "/" + p.Id,
                 Guid = p.Id.ToString(),
@@ -223,7 +223,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                     c.Post.Title
                 },
                 Link = new Uri($"{scheme}://{host}/{post.Id}?cid={c.Id}#comment"),
-                PublishDate = c.CommentDate,
+                PublishDate = c.CommentDate.ToUniversalTime(),
                 Title = c.NickName,
                 Permalink = $"{scheme}://{host}/{post.Id}?cid={c.Id}#comment",
                 Guid = c.Id.ToString(),

+ 44 - 43
src/Masuit.MyBlogs.Core/Extensions/ActivityMiddleware.cs

@@ -1,48 +1,49 @@
-using Masuit.MyBlogs.Core.Common;
-using Masuit.Tools.Security;
-using Microsoft.AspNetCore.Http;
-using System;
-using System.Threading.Tasks;
+//using Masuit.MyBlogs.Core.Common;
+//using Masuit.Tools.Security;
+//using Microsoft.AspNetCore.Http;
+//using System;
+//using System.Threading.Tasks;
 
-namespace Masuit.MyBlogs.Core.Extensions
-{
-    /// <summary>
-    /// 请求拦截器
-    /// </summary>
-    public class ActivityMiddleware
-    {
-        private readonly RequestDelegate _next;
+//namespace Masuit.MyBlogs.Core.Extensions
+//{
+//    /// <summary>
+//    /// 请求拦截器
+//    /// </summary>
+//    public class ActivityMiddleware
+//    {
+//        private readonly RequestDelegate _next;
 
-        /// <summary>
-        /// 构造函数
-        /// </summary>
-        /// <param name="next"></param>
-        public ActivityMiddleware(RequestDelegate next)
-        {
-            _next = next;
-        }
+//        /// <summary>
+//        /// 构造函数
+//        /// </summary>
+//        /// <param name="next"></param>
+//        public ActivityMiddleware(RequestDelegate next)
+//        {
+//            _next = next;
+//        }
 
-        public async Task Invoke(HttpContext context)
-        {
-            var req = context.Request;
-            var share = req.Query["share"].ToString();
-            if (req.IsRobot() || string.IsNullOrEmpty(share) || share == req.Cookies["ShareCode"])
-            {
-                await _next.Invoke(context);
-                return;
-            }
+//        public async Task Invoke(HttpContext context)
+//        {
+//            var req = context.Request;
+//            var share = req.Query["share"].ToString();
+//            if (req.IsRobot() || string.IsNullOrEmpty(share) || share == req.Cookies["ShareCode"])
+//            {
+//                await _next.Invoke(context);
+//                return;
+//            }
 
-            var mail = share.AESDecrypt();
-            if (string.IsNullOrEmpty(mail))
-            {
-                await _next.Invoke(context);
-                return;
-            }
+//            var mail = share.AESDecrypt();
+//            if (string.IsNullOrEmpty(mail))
+//            {
+//                await _next.Invoke(context);
+//                return;
+//            }
 
-            var ip = context.Connection.RemoteIpAddress.MapToIPv4().ToString();
-            RedisHelper.SAddAsync("Share:" + mail, ip).ContinueWith(task => RedisHelper.Expire("Share:" + mail, TimeSpan.FromDays(30)));
-            //var query = req.Query.Where(x => x.Key != "share").Select(x => x.Key + "=" + x.Value).Join("&");
-            //context.Response.Redirect((req.Path + "?" + query).Trim('?'));
-        }
-    }
-}
+//            var ip = context.Connection.RemoteIpAddress.MapToIPv4().ToString();
+//            RedisHelper.SAddAsync("Share:" + mail, ip).ContinueWith(task => RedisHelper.Expire("Share:" + mail, TimeSpan.FromDays(30)));
+//            //var query = req.Query.Where(x => x.Key != "share").Select(x => x.Key + "=" + x.Value).Join("&");
+//            //context.Response.Redirect((req.Path + "?" + query).Trim('?'));
+//            await _next.Invoke(context);
+//        }
+//    }
+//}

+ 4 - 4
src/Masuit.MyBlogs.Core/Extensions/IApplicationBuilderExtensions.cs

@@ -8,9 +8,9 @@ namespace Masuit.MyBlogs.Core.Extensions
         {
             return builder.UseMiddleware<RequestInterceptMiddleware>();
         }
-        public static IApplicationBuilder UseActivity(this IApplicationBuilder builder)
-        {
-            return builder.UseMiddleware<ActivityMiddleware>();
-        }
+        //public static IApplicationBuilder UseActivity(this IApplicationBuilder builder)
+        //{
+        //    return builder.UseMiddleware<ActivityMiddleware>();
+        //}
     }
 }

+ 1 - 1
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj

@@ -24,7 +24,7 @@
     <ItemGroup>
         <PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.10.0" />
         <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
-        <PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="3.1.0" />
+        <PackageReference Include="AutoMapper.Extensions.ExpressionMapping" Version="3.1.1" />
         <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
         <PackageReference Include="CacheManager.Microsoft.Extensions.Caching.Memory" Version="2.0.0-beta-1629" />
         <PackageReference Include="CacheManager.Serialization.Json" Version="2.0.0-beta-1629" />

+ 1 - 1
src/Masuit.MyBlogs.Core/Startup.cs

@@ -194,7 +194,7 @@ namespace Masuit.MyBlogs.Core
                 ContentTypeProvider = new FileExtensionContentTypeProvider(MimeMapper.MimeTypes),
             });
             app.UseSession().UseCookiePolicy().UseMiniProfiler(); //注入Session
-            app.UseRequestIntercept().UseActivity(); //启用网站请求拦截
+            app.UseRequestIntercept(); //启用网站请求拦截
             app.UseStaticHttpContext(); //注入静态HttpContext对象
 
             app.UseHangfireServer().UseHangfireDashboard("/taskcenter", new DashboardOptions()