Browse Source

nftt的findById

skyfffire 2 tháng trước cách đây
mục cha
commit
633188d914

+ 15 - 0
src/main/java/modules/nftt/NfttController.java

@@ -26,6 +26,21 @@ public class NfttController extends MyController {
         renderJson(MyRet.ok(service.hello()));
     }
     
+    @Before(LoginInterceptor.class)
+    @EmptyInterface({"id"})
+    public void findById() {
+        JSONObject requestBodyJson = MyController.getJsonModelByRequestAndType(getRequest(), JSONObject.class);
+        
+        String id = requestBodyJson.getString("id");
+        Nftt nftt = service.findNfttById(id);
+
+        if (nftt != null) {
+            renderJson(MyRet.ok("获取成功").setData(nftt));
+        } else {
+            renderJson(MyRet.fail("获取失败,非法请求可能会导致ip封禁!" + id));
+        }
+    }
+    
     @Before(LoginInterceptor.class)
     @RequiredRoleInterface({UserController.ROLE_CHECK_ADMIN, UserController.ROLE_SUPER_ADMIN})
     @EmptyInterface({"price", "name", "presale_start_time", "presale_end_time", "buying_start_time", "author", "max_quantity", "detail_image_list"})

+ 9 - 0
src/test/rest/NfttControllerTest.http

@@ -1,6 +1,15 @@
 ### 连通性测试
 POST {{ baseUrl }}/nftt/hello
 
+### NFT查看
+POST {{ baseUrl }}/nftt/findById
+Content-Type: application/json
+dl-token: {{dl_token_var}}
+
+{
+  "id": 1
+}
+
 ### 【审核管理员、超级管理员】NFT模板创建接口
 POST {{ baseUrl }}/nftt/create
 Content-Type: application/json