浏览代码

评论须知

懒得勤快 5 年之前
父节点
当前提交
38bfc06b3e

+ 10 - 0
src/Masuit.MyBlogs.Core/Controllers/MiscController.cs

@@ -87,6 +87,16 @@ namespace Masuit.MyBlogs.Core.Controllers
             return View();
         }
 
+        /// <summary>
+        /// 评论及留言须知
+        /// </summary>
+        /// <returns></returns>
+        [Route("agreement"), ResponseCache(Duration = 600, VaryByHeader = "Cookie")]
+        public ActionResult Agreement()
+        {
+            return View();
+        }
+
         /// <summary>
         /// 声明
         /// </summary>

+ 2 - 0
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj

@@ -64,6 +64,8 @@
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.0" />
     <PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="3.1.0" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.0" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.0" />
+    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
     <PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.1.0" />
     <PackageReference Include="MiniProfiler.EntityFrameworkCore" Version="4.1.0" />
     <PackageReference Include="PanGu.HighLight" Version="1.0.0" />

+ 18 - 2
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.xml

@@ -985,6 +985,12 @@
             </summary>
             <returns></returns>
         </member>
+        <member name="M:Masuit.MyBlogs.Core.Controllers.MiscController.Agreement">
+            <summary>
+            评论及留言须知
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:Masuit.MyBlogs.Core.Controllers.MiscController.Disclaimer">
             <summary>
             声明
@@ -4970,6 +4976,11 @@
             操作系统版本
             </summary>
         </member>
+        <member name="P:Masuit.MyBlogs.Core.Models.DTO.CommentInputDto.Agree">
+            <summary>
+            是否已接受条款
+            </summary>
+        </member>
         <member name="T:Masuit.MyBlogs.Core.Models.DTO.CommentOutputDto">
             <summary>
             文章评论输出模型
@@ -5100,6 +5111,11 @@
             操作系统版本
             </summary>
         </member>
+        <member name="P:Masuit.MyBlogs.Core.Models.DTO.LeaveMessageInputDto.Agree">
+            <summary>
+            是否已接受条款
+            </summary>
+        </member>
         <member name="T:Masuit.MyBlogs.Core.Models.DTO.LeaveMessageOutputDto">
             <summary>
             留言板输出模型
@@ -6840,9 +6856,9 @@
             id
             </summary>
         </member>
-        <member name="T:Masuit.MyBlogs.Core.Models.Validation.IsEmailAttribute">
+        <member name="T:Masuit.MyBlogs.Core.Models.Validation.AssignTrueAttribute">
             <summary>
-            邮箱格式验证
+            强制true检查
             </summary>
         </member>
         <member name="T:Masuit.MyBlogs.Core.Models.Validation.SubmitCheckAttribute">

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/DTO/BroadcastInputDto.cs

@@ -1,6 +1,6 @@
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System;
 
 namespace Masuit.MyBlogs.Core.Models.DTO

+ 7 - 0
src/Masuit.MyBlogs.Core/Models/DTO/CommentInputDto.cs

@@ -1,6 +1,7 @@
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System.ComponentModel.DataAnnotations;
 
 namespace Masuit.MyBlogs.Core.Models.DTO
@@ -60,5 +61,11 @@ namespace Masuit.MyBlogs.Core.Models.DTO
         /// </summary>
         [StringLength(255)]
         public string OperatingSystem { get; set; }
+
+        /// <summary>
+        /// 是否已接受条款
+        /// </summary>
+        [AssignTrue(ErrorMessage = "请先同意接受本站的《评论须知》")]
+        public bool Agree { get; set; }
     }
 }

+ 7 - 0
src/Masuit.MyBlogs.Core/Models/DTO/LeaveMessageInputDto.cs

@@ -1,6 +1,7 @@
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System.ComponentModel.DataAnnotations;
 
 namespace Masuit.MyBlogs.Core.Models.DTO
@@ -54,5 +55,11 @@ namespace Masuit.MyBlogs.Core.Models.DTO
         /// </summary>
         [StringLength(255)]
         public string OperatingSystem { get; set; }
+
+        /// <summary>
+        /// 是否已接受条款
+        /// </summary>
+        [AssignTrue(ErrorMessage = "请先同意接受本站的《留言须知》")]
+        public bool Agree { get; set; }
     }
 }

+ 1 - 0
src/Masuit.MyBlogs.Core/Models/DTO/PostInputDto.cs

@@ -1,6 +1,7 @@
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System.ComponentModel.DataAnnotations;
 
 namespace Masuit.MyBlogs.Core.Models.DTO

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/DTO/PostMergeRequestInputDto.cs

@@ -1,4 +1,4 @@
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System.ComponentModel.DataAnnotations;
 
 namespace Masuit.MyBlogs.Core.Models.DTO

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/Entity/Broadcast.cs

@@ -1,5 +1,5 @@
 using Masuit.MyBlogs.Core.Models.Enum;
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System;
 using System.ComponentModel.DataAnnotations.Schema;
 

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/Entity/Comment.cs

@@ -1,5 +1,5 @@
 using Masuit.MyBlogs.Core.Models.Enum;
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;

+ 1 - 0
src/Masuit.MyBlogs.Core/Models/Entity/LeaveMessage.cs

@@ -1,5 +1,6 @@
 using Masuit.MyBlogs.Core.Models.Enum;
 using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/Entity/PostHistoryVersion.cs

@@ -1,5 +1,5 @@
 using Masuit.MyBlogs.Core.Models.Enum;
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;

+ 1 - 1
src/Masuit.MyBlogs.Core/Models/Entity/UserInfo.cs

@@ -1,4 +1,4 @@
-using Masuit.MyBlogs.Core.Models.Validation;
+using Masuit.Tools.Core.Validator;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.ComponentModel.DataAnnotations;

+ 15 - 0
src/Masuit.MyBlogs.Core/Models/Validation/AssignTrueAttribute.cs

@@ -0,0 +1,15 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Masuit.MyBlogs.Core.Models.Validation
+{
+    /// <summary>
+    /// 强制true检查
+    /// </summary>
+    public class AssignTrueAttribute : ValidationAttribute
+    {
+        public override bool IsValid(object value)
+        {
+            return (bool)value;
+        }
+    }
+}

+ 0 - 39
src/Masuit.MyBlogs.Core/Models/Validation/IsEmailAttribute.cs

@@ -1,39 +0,0 @@
-using Masuit.Tools;
-using System.ComponentModel.DataAnnotations;
-
-namespace Masuit.MyBlogs.Core.Models.Validation
-{
-    /// <summary>
-    /// 邮箱格式验证
-    /// </summary>
-    public class IsEmailAttribute : ValidationAttribute
-    {
-        public override bool IsValid(object value)
-        {
-            if (value == null)
-            {
-                ErrorMessage = "邮箱不能为空!";
-                return false;
-            }
-
-            var email = value as string;
-            if (email.Length < 6)
-            {
-                ErrorMessage = "您输入的邮箱格式不正确!";
-                return false;
-            }
-
-            if (email.Length > 256)
-            {
-                ErrorMessage = "邮箱长度最大允许255个字符!";
-                return false;
-            }
-            if (email.MatchEmail())
-            {
-                return true;
-            }
-            ErrorMessage = "您输入的邮箱格式不正确!";
-            return false;
-        }
-    }
-}

+ 67 - 0
src/Masuit.MyBlogs.Core/Views/Misc/Agreement.cshtml

@@ -0,0 +1,67 @@
+@{
+    ViewBag.Title = "评论及留言须知";
+    Layout = "~/Views/Shared/_Layout.cshtml";
+}
+
+<div class="container">
+    <ol class="cd-breadcrumb triangle">
+        <li>@Html.ActionLink("首页", "Index", "Home")</li>
+        <li class="current"><em>@ViewBag.Title</em></li>
+    </ol>
+</div>
+<div class="container">
+    <p>
+        1. 尊重网上道德,严禁发表侮辱、诽谤、教唆、淫秽内容;
+    </p>
+    <p>
+        2. 您在本站评论发表的言论,本站有权在网站内保留、转载、引用或者删除(被判为垃圾评论);
+    </p>
+    <p>
+        3. <span style="color: rgb(255, 0, 0);">请务必使用真实的邮箱地址参与回复</span>,非有效邮箱的回复不论内容,一律删除;
+    </p>
+    <p>
+        4. <span style="color: rgb(255, 0, 0);">本站有反垃圾机制</span>,请保证每一次回复的内容质量,垃圾评论评判标准(包括但不仅限于):
+    </p>
+    <p style=" text-indent: 2em;">
+        昵称:商业推广信息(如带SEO、店铺字眼)、不文明、有攻击他人嫌疑的、不和谐的;
+    </p>
+    <p style=" text-indent: 2em;">
+        邮件地址:很明显无效的邮件地址;
+    </p>
+    <p style=" text-indent: 2em;">
+        链接:SEO、广告推广类网址一律视为垃圾评论处理;
+    </p>
+    <p style=" text-indent: 2em;">
+        评论内容:包含广告内容,政治影射内容;
+    </p>
+    <p style=" text-indent: 2em;">
+        提及、发表容易引起争论的言论或者观点(如:争论强度),虽然您的发言本质上并没有带有恶意,但可能因为观点的问题引起带有负面情绪的讨论。出现带有负面情绪的讨论时,为维持留言区的秩序,会被管理员删除相关发言。
+    </p>
+    <p>
+        5. 多次发表垃圾评论将会被封禁账户或IP;封禁标准:
+    </p>
+    <p style="text-indent: 2em;">
+        对于初次产生留言问题的用户,原则上不作直接封禁,直接删除问题发言内容;
+    </p>
+    <p style="text-indent: 2em;">
+        用户发言不当,应该以删除为主管理,除非该用户多次或管理员提醒后,仍发表同类言论,则实施封禁;
+    </p>
+    <p style="text-indent: 2em;">
+        初次封禁应适当从轻,一般不超过3天以上,初犯外的情况下,禁言天数不得大于上次被禁言天数的3倍;
+    </p>
+    <p style="text-indent: 2em;">
+        包括但不限于 政治敏感、色情、暴力、人身攻击其他用户,现实人物,英灵从者与管理员、广告、刷屏等不良行为将被严厉封禁;
+    </p>
+    <p style="text-indent: 2em;">
+        具体封禁操作取决于管理员的自行判断,所以具体标准以及期限请管理员自行斟酌。
+    </p>
+    <p>
+        6. <span style="color: rgb(255, 0, 0);">为节省您的时间,请尽量不要评论诸如“会不会...”、“是不是...”这样的能够自己一试便知的问题;</span>
+    </p>
+    <p>
+        7. 本站不接受任何的个性化需求的求助类咨询,任何有关个性化需求的求助类问题一律不予回复,诸如“求...资源”等问题;
+    </p>
+    <p>
+        8. 参与本站评论即表明您已经阅读并接受上述条款,对以上规则本站保留最终解释权。
+    </p>
+</div>

+ 2 - 0
src/Masuit.MyBlogs.Core/Views/Msg/Index.cshtml

@@ -45,6 +45,7 @@
         <div class="form-group overlay animated fadeInDown" style="margin-bottom: 0px !important;">
             <textarea class="layui-textarea" id="layedit" name="Content" style="height: 200px"></textarea>
         </div>
+        <input type="checkbox" checked="checked" name="Agree" id="aggrement1" value="true" /><label for="aggrement1">我已接受<a asp-controller="Misc" asp-action="agreement" target="_blank">《留言须知》</a></label>
         <div class="form-group">
             <div class="col-xs-12">
                 <button type="submit" class="btn btn-info btn-lg">
@@ -89,6 +90,7 @@
             <div class="form-group overlay">
                 <textarea class="layui-textarea" id="layedit2" name="Content" style="height: 80px"></textarea>
             </div>
+            <input type="checkbox" checked="checked" name="Agree" id="aggrement2" value="true" /><label for="aggrement2">我已接受<a asp-controller="Misc" asp-action="agreement" target="_blank">《留言须知》</a></label>
             <div class="form-group">
                 <div class="col-xs-12">
                     <div class="btn-group">

+ 2 - 0
src/Masuit.MyBlogs.Core/Views/Msg/Index_Admin.cshtml

@@ -24,6 +24,7 @@
         <div class="form-group overlay animated fadeInDown" style="margin-bottom: 0px !important;">
             <textarea class="layui-textarea" id="layedit" name="Content" style="height: 200px"></textarea>
         </div>
+        <input type="hidden" name="Agree" value="true" />
         <div class="form-group">
             <div class="col-xs-12">
                 <button type="submit" class="btn btn-info btn-lg">
@@ -53,6 +54,7 @@
             <div class="form-group overlay animated fadeInDown">
                 <textarea class="layui-textarea" id="layedit2" name="Content" style="height: 80px"></textarea>
             </div>
+            <input type="hidden" name="Agree" value="true" />
             <div class="form-group">
                 <div class="col-xs-12">
                     <div class="btn-group">

+ 2 - 0
src/Masuit.MyBlogs.Core/Views/Post/Details.cshtml

@@ -288,6 +288,7 @@
                                 <div class="form-group overlay animated fadeInDown" style="margin-bottom: 0px !important;">
                                     <textarea class="layui-textarea" id="layedit" name="Content" style="height: 100px"></textarea>
                                 </div>
+                                <input type="checkbox" checked="checked" name="Agree" id="aggrement" value="true" /><label for="aggrement">我已接受<a asp-controller="Misc" asp-action="agreement" target="_blank">《评论须知》</a></label>
                                 <div class="form-group">
                                     <div class="col-xs-12">
                                         <button type="submit" class="btn btn-info btn-lg">提交</button>
@@ -344,6 +345,7 @@
             <div class="form-group overlay animated fadeInDown">
                 <textarea class="layui-textarea" id="layedit2" name="Content" style="height: 80px"></textarea>
             </div>
+            <input type="checkbox" checked="checked" name="Agree" id="aggrement2" value="true" /><label for="aggrement2">我已接受<a asp-controller="Misc" asp-action="agreement" target="_blank">《评论须知》</a></label>
             <div class="form-group">
                 <div class="col-xs-12">
                     <div class="btn-group">

+ 2 - 0
src/Masuit.MyBlogs.Core/Views/Post/Details_Admin.cshtml

@@ -248,6 +248,7 @@
                             <div class="form-group overlay animated fadeInDown" style="margin-bottom: 0px !important;">
                                 <textarea class="layui-textarea" id="layedit" name="Content" style="height: 100px"></textarea>
                             </div>
+                            <input type="hidden" name="Agree" value="true" />
                             <div class="form-group">
                                 <div class="col-xs-12">
                                     <button type="submit" class="btn btn-info btn-lg">提交</button>
@@ -288,6 +289,7 @@
             <div class="form-group overlay animated fadeInDown">
                 <textarea class="layui-textarea" id="layedit2" name="Content" style="height: 80px"></textarea>
             </div>
+            <input type="hidden" name="Agree" value="true" />
             <div class="form-group">
                 <div class="col-xs-12">
                     <div class="btn-group">