From 7a45518ca17d0d303e6db1007d7cb118d0aaa149 Mon Sep 17 00:00:00 2001 From: zhu0823 Date: Sun, 24 Mar 2024 12:10:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E4=B8=AA=E5=95=86?= =?UTF-8?q?=E5=93=81=E9=9A=8F=E6=9C=BA=E5=BB=B6=E8=BF=9F=E9=A2=84=E7=BA=A6?= =?UTF-8?q?=20(#299)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oddfar/campus/business/service/impl/IMTServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java b/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java index e237f1d..8a21321 100644 --- a/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java +++ b/campus-modular/src/main/java/com/oddfar/campus/business/service/impl/IMTServiceImpl.java @@ -40,6 +40,7 @@ import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.Random; @Service public class IMTServiceImpl implements IMTService { @@ -191,6 +192,11 @@ public void reservation(IUser iUser) { //预约 JSONObject json = reservation(iUser, itemId, shopId); logContent += String.format("[预约项目]:%s\n[shopId]:%s\n[结果返回]:%s\n\n", itemId, shopId, json.toString()); + + //随机延迟3~5秒 + Random random = new Random(); + int sleepTime = random.nextInt(3) + 3; + Thread.sleep(sleepTime * 1000); } catch (Exception e) { logContent += String.format("执行报错--[预约项目]:%s\n[结果返回]:%s\n\n", itemId, e.getMessage()); }