From 89a6836a8203f9bed9659f29614156f84b29e4e3 Mon Sep 17 00:00:00 2001 From: Wang YiHang <3060234389@qq.com> Date: Sun, 8 Sep 2024 11:50:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=88=97=E8=A1=A8=E5=87=BA?= =?UTF-8?q?=E6=9D=A5=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../muyu/market/controller/MyApiController.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cloud-market-server/src/main/java/com/muyu/market/controller/MyApiController.java b/cloud-market-server/src/main/java/com/muyu/market/controller/MyApiController.java index 6e6f3fc..f7faaf3 100644 --- a/cloud-market-server/src/main/java/com/muyu/market/controller/MyApiController.java +++ b/cloud-market-server/src/main/java/com/muyu/market/controller/MyApiController.java @@ -133,13 +133,6 @@ public class MyApiController extends BaseController Long userId = SecurityUtils.getUserId(); myApi.setUserId(userId); MyApi myApi1 = myApiService.selectMyApiByUserIdAndApiId(userId, myApi.getApiId()); - if (myApi1!=null) { - myApi.setMyNum(myApi1.getMyNum()+myApi.getMyNum()); - if(myApi1.getMyStates().equals("N")){ - myApi.setMyStates("Y"); - } - return toAjax(myApiService.updateById(myApi)); - } // 获取当前时间(没有时区) LocalDateTime now = LocalDateTime.now(); @@ -155,6 +148,14 @@ public class MyApiController extends BaseController // 将Instant转换为Date Date date = Date.from(instant); myApi.setMyTime(date); + if (myApi1!=null) { + myApi.setMyNum(myApi1.getMyNum()+myApi.getMyNum()); + if(myApi1.getMyStates().equals("N")){ + myApi.setMyStates("Y"); + } + return toAjax(myApiService.updateById(myApi)); + } + myApi.setMyStates("Y"); return toAjax(myApiService.save(myApi)); }