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)); }