mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-23 19:19:32 +08:00
完成登录校验
This commit is contained in:
@@ -1,24 +1,25 @@
|
||||
package xyz.playedu.api.controller.admin;
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import xyz.playedu.api.constant.SystemConstant;
|
||||
import xyz.playedu.api.domain.AdminUser;
|
||||
import xyz.playedu.api.middleware.AuthMiddleware;
|
||||
import xyz.playedu.api.service.AdminUserService;
|
||||
import xyz.playedu.api.types.PaginationResult;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/backend/v1/admin-user")
|
||||
public class AdminUserController {
|
||||
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
@AuthMiddleware(prv = SystemConstant.JWT_PRV_ADMIN_USER)
|
||||
@GetMapping("/admin/user/index")
|
||||
@GetMapping("/index")
|
||||
public JsonResponse List(@RequestParam(name = "page", defaultValue = "1") Integer page, @RequestParam(name = "size", defaultValue = "10") Integer size) {
|
||||
PaginationResult<AdminUser> result = adminUserService.paginate(page, size, null);
|
||||
return JsonResponse.data(result);
|
||||
@@ -1,4 +1,4 @@
|
||||
package xyz.playedu.api.controller.admin;
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import xyz.playedu.api.constant.SystemConstant;
|
||||
import xyz.playedu.api.domain.AdminUser;
|
||||
import xyz.playedu.api.exception.JwtLogoutException;
|
||||
import xyz.playedu.api.middleware.ImageCaptchaCheckMiddleware;
|
||||
import xyz.playedu.api.request.LoginRequest;
|
||||
import xyz.playedu.api.service.AdminUserService;
|
||||
@@ -22,7 +23,7 @@ import java.util.HashMap;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/v1/auth")
|
||||
@RequestMapping("/backend/v1/auth")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
@@ -57,8 +58,10 @@ public class LoginController {
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public JsonResponse logout() {
|
||||
public JsonResponse logout() throws JwtLogoutException {
|
||||
jwtService.logout(RequestUtil.token(), SystemConstant.JWT_PRV_ADMIN_USER);
|
||||
return JsonResponse.success("success");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package xyz.playedu.api.controller.admin;
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -12,7 +12,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/v1/system")
|
||||
@RequestMapping("/backend/v1/system")
|
||||
public class SystemController {
|
||||
|
||||
@Autowired
|
||||
Reference in New Issue
Block a user