From efb07bcec37c49228d9760794f215c8549243ad2 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Mon, 23 Mar 2026 18:52:21 +0800
Subject: [PATCH] 1
---
src/main/java/com/nq/controller/backend/AdminWithDrawController.java | 39 ++++++++++++++++++++++++++++++++++++---
1 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/nq/controller/backend/AdminWithDrawController.java b/src/main/java/com/nq/controller/backend/AdminWithDrawController.java
index b969e4d..4db0114 100644
--- a/src/main/java/com/nq/controller/backend/AdminWithDrawController.java
+++ b/src/main/java/com/nq/controller/backend/AdminWithDrawController.java
@@ -4,6 +4,7 @@
import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.github.pagehelper.PageInfo;
import com.nq.common.ServerResponse;
+import com.nq.pojo.TradeResultVO;
import com.nq.pojo.UserWithdraw;
import com.nq.service.IUserWithdrawService;
@@ -22,6 +23,8 @@
import java.io.IOException;
import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
@Controller
@RequestMapping({"/admin/withdraw/"})
@@ -55,21 +58,51 @@
}
}
+ /**
+ *
+ * @param withId
+ * @param state 1.4审核通过(走代付) 2.审核(不走代付) 3.驳回
+ * @param payoutChannel
+ * @param authMsg
+ * @return
+ */
//修改资金管理 提现列表 提现状态
@RequestMapping({"updateState.do"})
@ResponseBody
public ServerResponse updateState(@RequestParam(value = "withId", required = false) Integer withId,
@RequestParam(value = "state", required = false) Integer state,
- @RequestParam(value = "authMsg", required = false) String authMsg) {
+ @RequestParam(value = "authMsg", required = false) String authMsg,
+ HttpServletRequest request, HttpServletResponse response) {
ServerResponse serverResponse = null;
try {
- serverResponse = this.iUserWithdrawService.updateState(withId, state, authMsg);
+ String requestId = withId + "_" + state;
+ // 检查是否在短时间内重复请求
+ if (isDuplicateRequest(requestId)) {
+ return ServerResponse.createByErrorMsg("重复提交,请稍后再试。");
+ }
+
+ // 更新请求时间戳
+ requestTimestamps.put(requestId, System.currentTimeMillis());
+ synchronized (withId){
+ serverResponse = this.iUserWithdrawService.updateState(withId, state, authMsg, request, response);
+ }
} catch (Exception e) {
log.error("admin修改充值订单状态出错 ,异常 = {}", e);
+ return ServerResponse.createByErrorMsg("操作失败");
}
return serverResponse;
}
- //删除资金记录
+ private final Map<String, Long> requestTimestamps = new ConcurrentHashMap<>();
+ private static final long REPEAT_REQUEST_THRESHOLD = 1000; // 5秒内重复提交视为无效请求
+ private boolean isDuplicateRequest(String requestId) {
+ Long lastRequestTime = requestTimestamps.get(requestId);
+ if (lastRequestTime == null) {
+ return false; // 如果没有该请求记录,认为是首次请求
+ }
+ // 如果请求时间小于设定的时间窗口,则视为重复请求
+ return System.currentTimeMillis() - lastRequestTime < REPEAT_REQUEST_THRESHOLD;
+ }
+
@RequestMapping({"deleteWithdraw.do"})
@ResponseBody
public ServerResponse deleteWithdraw(Integer withdrawId) {
--
Gitblit v1.9.3