接入
This commit is contained in:
@@ -23,7 +23,7 @@ import java.util.List;
|
||||
@RequestMapping("/recordOrder")
|
||||
public class OrderController {
|
||||
|
||||
public static String TOKEN = "cc0313";
|
||||
public static String TOKEN = "dd7f298cc465e7a9791796ae1303a1f6c031a18d4894ecd9e75d44fdb0ef32d80a49e4c5811b98d8ac65d73d22a54083630d5329c7c9de2276317669ecb2e544";
|
||||
@Autowired
|
||||
private JDUtil jdUtils;
|
||||
@Autowired
|
||||
@@ -35,14 +35,27 @@ public class OrderController {
|
||||
return TOKEN.equals(token);
|
||||
}
|
||||
|
||||
@RequestMapping("/testToken")
|
||||
@ResponseBody
|
||||
public ApiResponse testToken(String token) {
|
||||
if (!checkToken(token)){
|
||||
return ApiResponse.unauthorized();
|
||||
}
|
||||
return ApiResponse.success();
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
@ResponseBody
|
||||
public ApiResponse<List<ProductOrder>> list(String token) throws Exception {
|
||||
public ApiResponse list(String token) throws Exception {
|
||||
if (!checkToken(token)){
|
||||
return ApiResponse.unauthorized();
|
||||
}
|
||||
try {
|
||||
|
||||
List<ProductOrder> all = productOrderRepository.findAll();
|
||||
return ApiResponse.success(all);
|
||||
} catch (Exception e) {
|
||||
return (ApiResponse<List<ProductOrder>>) ApiResponse.error(500, "Server Error: " + e.getMessage());
|
||||
return ApiResponse.error(500, "Server Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user