Browse Source

文章修改记录IP

懒得勤快 4 years ago
parent
commit
09e8378623

+ 1 - 1
src/Masuit.MyBlogs.Core/Controllers/PostController.cs

@@ -461,7 +461,7 @@ namespace Masuit.MyBlogs.Core.Controllers
                 merge.SubmitTime = DateTime.Now;
                 post.PostMergeRequests.Add(merge);
             }
-
+            merge.IP = ClientIP;
             var b = await PostService.SaveChangesAsync() > 0;
             if (!b)
             {

+ 5 - 0
src/Masuit.MyBlogs.Core/Models/DTO/PostMergeRequestDtoBase.cs

@@ -42,5 +42,10 @@ namespace Masuit.MyBlogs.Core.Models.DTO
         /// Ìύʱ¼ä
         /// </summary>
         public DateTime SubmitTime { get; set; }
+
+        /// <summary>
+        /// Ìá½»ÈËIP
+        /// </summary>
+        public string IP { get; set; }
     }
 }

+ 5 - 0
src/Masuit.MyBlogs.Core/Models/Entity/PostMergeRequest.cs

@@ -47,5 +47,10 @@ namespace Masuit.MyBlogs.Core.Models.Entity
 
         [ForeignKey("PostId")]
         public virtual Post Post { get; set; }
+
+        /// <summary>
+        /// Ìá½»ÈËIP
+        /// </summary>
+        public string IP { get; set; }
     }
 }

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

@@ -128,17 +128,17 @@
                             </button>
                         </div>
                     </div>
-                    <div class="col-xs-6 text-right">
-                        @if (Model.Rss) {
+                    @if (Model.Rss) {
+                        <div class="col-xs-6 text-right">
                             <div class="btn-group">
                                 <a class="btn btn-danger btn-lg" asp-controller="Subscribe" asp-action="PostRss" asp-route-id="@Model.Id" target="_blank">
                                     <i class="icon-rss4"></i><span>订阅本文更新</span>
                                 </a>
                             </div>
-                        }
-                    </div>
-                    <div class="col-xs-6">
-                        <p class="text-red">如果你喜欢这篇文章,欢迎点赞分享本文!</p>
+                        </div>
+                    }
+                    <div class="col-xs-12">
+                        <p class="text-red">如果你喜欢这篇文章,欢迎点赞、评论、分享本文!</p>
                     </div>
                 </section>
                 <section class="wow fadeInUp row size16">

+ 0 - 30
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/analysis.js

@@ -92,34 +92,4 @@
 			}, function() {
 			}).catch(swal.noop);
 		}
-		$scope.addToBlackList = function(ip) {
-			swal({
-				title: "确认添加黑名单吗?",
-				text: "将"+ip+"添加到黑名单",
-				showCancelButton: true,
-				confirmButtonColor: "#DD6B55",
-				confirmButtonText: "确定",
-				cancelButtonText: "取消",
-				animation: true,
-				allowOutsideClick: false,
-				showLoaderOnConfirm: true,
-				preConfirm: function () {
-					return new Promise(function (resolve, reject) {
-						$http.post("/system/AddToBlackList", {ip}, {
-							'Content-Type': 'application/x-www-form-urlencoded'
-						}).then(function(res) {
-							resolve(res.data);
-						}, function() {
-							reject("请求服务器失败!");
-						});
-					});
-				}
-			}).then(function (data) {
-				if (data.Success) {
-					swal("添加成功",'','success');
-				} else {
-					swal("添加失败",'','error');
-				}
-			}).catch(swal.noop);
-		}
 	}]);

+ 61 - 0
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/main.js

@@ -436,6 +436,67 @@
 		}).catch(swal.noop);
 	}
 	
+	$scope.addToBlackList = function(ip) {
+		swal({
+			title: "确认添加黑名单吗?",
+			text: "将"+ip+"添加到黑名单",
+			showCancelButton: true,
+			confirmButtonColor: "#DD6B55",
+			confirmButtonText: "确定",
+			cancelButtonText: "取消",
+			animation: true,
+			allowOutsideClick: false,
+			showLoaderOnConfirm: true,
+			preConfirm: function () {
+				return new Promise(function (resolve, reject) {
+					$http.post("/system/AddToBlackList", {ip}, {
+						'Content-Type': 'application/x-www-form-urlencoded'
+					}).then(function(res) {
+						resolve(res.data);
+					}, function() {
+						reject("请求服务器失败!");
+					});
+				});
+			}
+		}).then(function (data) {
+			if (data.Success) {
+				swal("添加成功",'','success');
+			} else {
+				swal("添加失败",'','error');
+			}
+		}).catch(swal.noop);
+	}
+
+	$scope.addToWhiteList= function(ip) {
+		swal({
+			title: "确认添加白名单吗?",
+			text: "将"+ip+"添加到白名单",
+			showCancelButton: true,
+			confirmButtonColor: "#DD6B55",
+			confirmButtonText: "确定",
+			cancelButtonText: "取消",
+			animation: true,
+			allowOutsideClick: false,
+			showLoaderOnConfirm: true,
+			preConfirm: function () {
+				return new Promise(function (resolve, reject) {
+					$http.post("/system/AddToWhiteList", {ip}, {
+						'Content-Type': 'application/x-www-form-urlencoded'
+					}).then(function(res) {
+						resolve(res.data);
+					}, function() {
+						reject("请求服务器失败!");
+					});
+				});
+			}
+		}).then(function (data) {
+			if (data.Success) {
+				swal("添加成功",'','success');
+			} else {
+				swal("添加失败",'','error');
+			}
+		}).catch(swal.noop);
+	}
 }]);
 
 function getFile(obj, inputName) {

+ 0 - 91
src/Masuit.MyBlogs.Core/wwwroot/ng-views/controllers/system.js

@@ -473,67 +473,6 @@ myApp.controller("firewall", ["$scope", "$http","NgTableParams","$timeout", func
 		}).catch(swal.noop);
 	}
 
-	$scope.addToWhiteList= function(ip) {
-		swal({
-			title: "确认添加白名单吗?",
-			text: "将"+ip+"添加到白名单",
-			showCancelButton: true,
-			confirmButtonColor: "#DD6B55",
-			confirmButtonText: "确定",
-			cancelButtonText: "取消",
-			animation: true,
-			allowOutsideClick: false,
-			showLoaderOnConfirm: true,
-			preConfirm: function () {
-				return new Promise(function (resolve, reject) {
-					$http.post("/system/AddToWhiteList", {ip}, {
-						'Content-Type': 'application/x-www-form-urlencoded'
-					}).then(function(res) {
-						resolve(res.data);
-					}, function() {
-						reject("请求服务器失败!");
-					});
-				});
-			}
-		}).then(function (data) {
-			if (data.Success) {
-				swal("添加成功",'','success');
-			} else {
-				swal("添加失败",'','error');
-			}
-		}).catch(swal.noop);
-	}
-	$scope.addToBlackList = function(ip) {
-		swal({
-			title: "确认添加黑名单吗?",
-			text: "将"+ip+"添加到黑名单",
-			showCancelButton: true,
-			confirmButtonColor: "#DD6B55",
-			confirmButtonText: "确定",
-			cancelButtonText: "取消",
-			animation: true,
-			allowOutsideClick: false,
-			showLoaderOnConfirm: true,
-			preConfirm: function () {
-				return new Promise(function (resolve, reject) {
-					$http.post("/system/AddToBlackList", {ip}, {
-						'Content-Type': 'application/x-www-form-urlencoded'
-					}).then(function(res) {
-						resolve(res.data);
-					}, function() {
-						reject("请求服务器失败!");
-					});
-				});
-			}
-		}).then(function (data) {
-			if (data.Success) {
-				swal("添加成功",'','success');
-			} else {
-				swal("添加失败",'','error');
-			}
-		}).catch(swal.noop);
-	}
-
 	$scope.detail= function(text) {
         layer.open({
           type: 1,
@@ -549,34 +488,4 @@ myApp.controller("sendbox", ["$scope", "$http", function ($scope, $http) {
 	$http.post("/system/sendbox").then(function (res) {
 		$scope.Mails = res.data;
 	});
-	$scope.addToBlackList = function(ip) {
-			swal({
-				title: "确认添加黑名单吗?",
-				text: "将"+ip+"添加到黑名单",
-				showCancelButton: true,
-				confirmButtonColor: "#DD6B55",
-				confirmButtonText: "确定",
-				cancelButtonText: "取消",
-				animation: true,
-				allowOutsideClick: false,
-				showLoaderOnConfirm: true,
-				preConfirm: function () {
-					return new Promise(function (resolve, reject) {
-						$http.post("/system/AddToBlackList", {ip}, {
-							'Content-Type': 'application/x-www-form-urlencoded'
-						}).then(function(res) {
-							resolve(res.data);
-						}, function() {
-							reject("请求服务器失败!");
-						});
-					});
-				}
-			}).then(function (data) {
-				if (data.Success) {
-					swal("添加成功",'','success');
-				} else {
-					swal("添加失败",'','error');
-				}
-			}).catch(swal.noop);
-		}
 }]);

+ 5 - 1
src/Masuit.MyBlogs.Core/wwwroot/ng-views/views/merge/list.html

@@ -21,7 +21,7 @@
                 <a ng-href="/{{row.PostId}}" target="_blank">{{row.PostTitle}}</a>
             </td>
             <td title="'新标题'">
-                <a ng-href="/{{row.PostId}}" target="_blank">{{row.Title}}</a>
+                <a ng-href="#/merge/compare?id={{row.Id}}" target="_blank">{{row.Title}}</a>
             </td>
             <td title="'修改人'">
                 <a ng-href="/author/{{row.Modifier}}" target="_blank">{{row.Modifier}}</a>
@@ -32,6 +32,10 @@
             <td title="'提交时间'">
                 {{row.SubmitTime|date:'yyyy-MM-dd HH:mm:ss'}}
             </td>
+            <td title="'IP'">
+                <a ng-href="/tools/ip/{{row.IP}}" target="_blank">{{row.IP}}</a>
+                <button class="badge btn btn-primary pull-right" ng-click="addToBlackList(row.IP)">黑名单</button>
+            </td>
             <td title="'状态'">
                 <span ng-if="row.MergeState==0" class="text-warning">待合并</span>
                 <span ng-if="row.MergeState==1" class="text-success">已合并</span>