Explorar o código

尼尔斯活动铸造

licailing %!s(int64=4) %!d(string=hai) anos
pai
achega
ced6146211

+ 1 - 1
src/main/java/com/izouma/nineth/service/MintOrderService.java

@@ -35,7 +35,7 @@ public class MintOrderService {
     }
 
     @Transactional
-    public void exchange(Long userId, List<Long> assetIds) {
+    public void create(Long userId, List<Long> assetIds) {
         User user = userRepo.findByIdAndDelFalse(userId).orElseThrow(new BusinessException("用户不存在"));
         User blackHole = userRepo.findByIdAndDelFalse(134670L).orElseThrow(new BusinessException("无法铸造"));
         if (assetIds.size() != 3) {

+ 4 - 4
src/main/java/com/izouma/nineth/web/MintOrderController.java

@@ -6,10 +6,10 @@ import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.MintOrderRepo;
 import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
@@ -58,11 +58,11 @@ public class MintOrderController extends BaseController {
         ExcelUtils.export(response, data);
     }
 
-    @PostMapping("/exchange")
-    public void exchange(@RequestParam Long userId, @RequestParam String assets) {
+    @PostMapping("/create")
+    public void create(@RequestParam String assets) {
         LongArrayConverter lc = new LongArrayConverter();
         List<Long> assetIds = lc.convertToEntityAttribute(assets);
-        mintOrderService.exchange(userId, assetIds);
+        mintOrderService.create(SecurityUtils.getAuthenticatedUser().getId(),  assetIds);
     }
 }
 

+ 1 - 1
src/test/java/com/izouma/nineth/service/MintOrderServiceTest.java

@@ -13,7 +13,7 @@ class MintOrderServiceTest extends ApplicationTests {
 
     @Test
     void exchange() throws InterruptedException {
-        mintOrderService.exchange(9972L, Arrays.asList(134607L, 132435L, 132433L));
+        mintOrderService.create(9972L, Arrays.asList(134607L, 132435L, 132433L));
         Thread.sleep(1000);
     }
 }