浏览代码

黑名单管理增加重放

xusl 1 年之前
父节点
当前提交
fbaff5bb71

+ 4 - 0
backend/src/main/java/com/jiayue/ssi/controller/IpBlacklistController.java

@@ -4,6 +4,7 @@ import cn.hutool.core.util.NumberUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jiayue.ssi.annotation.OperateLog;
+import com.jiayue.ssi.annotation.PreventReplay;
 import com.jiayue.ssi.backenum.AuditType;
 import com.jiayue.ssi.backenum.BusinessType;
 import com.jiayue.ssi.constant.CacheConstants;
@@ -39,6 +40,7 @@ public class IpBlacklistController {
      */
     @GetMapping(value = "/getAll")
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:list')")
+    @PreventReplay
     public ResponseVO getAll(String currentPage, String pageSize, String ip) throws CustomException {
         try {
             Integer cp;
@@ -87,6 +89,7 @@ public class IpBlacklistController {
     @PostMapping(value = "/addIp")
     @OperateLog(title = "黑名单管理", businessType = BusinessType.INSERT, auditType = AuditType.SYS)
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:add')")
+    @PreventReplay
     public ResponseVO addIp(String ip) throws CustomException {
         try {
             if (!IPUtils.isIP(ip)) {
@@ -115,6 +118,7 @@ public class IpBlacklistController {
     @PostMapping(value = "/delIp")
     @OperateLog(title = "黑名单管理", businessType = BusinessType.DELETE, auditType = AuditType.SYS)
     @PreAuthorize("@ss.hasPermi('system:ipblacklist:remove')")
+    @PreventReplay
     public ResponseVO delIp(String id) throws CustomException {
         try {
             if (StringUtils.isEmpty(id)) {

+ 51 - 11
ui/src/views/sysManager/ipBlacklist/index.vue

@@ -129,16 +129,25 @@ export default {
       this.getList()
     },
     /** 查询用户列表 */
-    getList(){
+    async getList(){
+      let sysTime
+      let lk
+      await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
+        sysTime = res.data.sysTime
+        lk = res.data.lk
+      }).catch((error) => {
+      })
+
       this.loading = true;
       var searchParams = {
         currentPage: this.currentPage,
         pageSize: this.pageSize,
-        ip: this.queryParams.ip
+        ip: this.queryParams.ip,
+        sysTime: sysTime,
+        lk: lk
       }
-      this.$axios.get('/ipBlacklistController/getAll',
+      await this.$axios.get('/ipBlacklistController/getAll',
         {params: searchParams}).then((res) => {
-
         if (res.code == 0) {
           this.userList = res.data.records
           this.total = res.data.total
@@ -190,7 +199,19 @@ export default {
             return false;
           }
         },
-        inputErrorMessage: 'IP格式不正确'
+        inputErrorMessage: 'IP格式不正确',
+        beforeClose(action, instance, done) {
+          if (action === "confirm") {
+            instance.$refs["confirm"].$el.onclick = (function (e) {
+              e = e || window.event;
+              if (e.detail != 0) {
+                done();
+              }
+            })();
+          } else {
+            done();
+          }
+        }
       }).then(async({value})=>{
         this.doAdd(value)
       }).catch((e)=>{})
@@ -217,11 +238,21 @@ export default {
     /**
      * 添加提交
      */
-    doAdd:debounce(function(ip){
+    doAdd:debounce(async function(ip){
+      let sysTime
+      let lk
+      await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
+        sysTime = res.data.sysTime
+        lk = res.data.lk
+      }).catch((error) => {
+      })
+
       const param = {
-        ip:ip
+        ip:ip,
+        sysTime: sysTime,
+        lk: lk
       }
-      this.$axios.post('/ipBlacklistController/addIp', param).then((res) => {
+      await this.$axios.post('/ipBlacklistController/addIp', param).then((res) => {
         if (res.code == 0) {
           this.$message({
             type: 'success',
@@ -245,9 +276,19 @@ export default {
     /**
      * 删除提交
      */
-    doDelete:debounce(function(_selectData){
+    doDelete:debounce(async function(_selectData){
+      let sysTime
+      let lk
+      await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
+        sysTime = res.data.sysTime
+        lk = res.data.lk
+      }).catch((error) => {
+      })
+
       const param = {
-        id: _selectData.id
+        id: _selectData.id,
+        sysTime: sysTime,
+        lk: lk
       }
       this.$axios.post('/ipBlacklistController/delIp', param).then((res) => {
         if (res.code == 0) {
@@ -267,7 +308,6 @@ export default {
           type: 'error',
           message: '删除失败!'
         });
-        console.log(error)
         this.loading = false
       })
     },1000)