mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-10 20:04:06 +08:00
管理用户detail接口
This commit is contained in:
parent
797cc74714
commit
aca847c06e
@ -3,10 +3,9 @@ package xyz.playedu.api.controller.backend;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.PlayEduBackendThreadLocal;
|
||||
import xyz.playedu.api.bus.BackendBus;
|
||||
import xyz.playedu.api.constant.SystemConstant;
|
||||
import xyz.playedu.api.domain.AdminUser;
|
||||
import xyz.playedu.api.event.AdminUserLoginEvent;
|
||||
@ -23,6 +22,7 @@ import xyz.playedu.api.util.RequestUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/backend/v1/auth")
|
||||
@ -31,11 +31,14 @@ public class LoginController {
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
@Autowired
|
||||
private BackendBus backendBus;
|
||||
|
||||
@Autowired
|
||||
private JWTService jwtService;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private ApplicationContext ctx;
|
||||
|
||||
@PostMapping("/login")
|
||||
@ImageCaptchaCheckMiddleware
|
||||
@ -59,7 +62,7 @@ public class LoginController {
|
||||
data.put("token", token.getToken());
|
||||
data.put("expire", token.getExpire());
|
||||
|
||||
context.publishEvent(new AdminUserLoginEvent(this, adminUser.getId(), new Date(), token.getToken(), IpUtil.getIpAddress(), adminUser.getLoginTimes()));
|
||||
ctx.publishEvent(new AdminUserLoginEvent(this, adminUser.getId(), new Date(), token.getToken(), IpUtil.getIpAddress(), adminUser.getLoginTimes()));
|
||||
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
@ -70,4 +73,16 @@ public class LoginController {
|
||||
return JsonResponse.success("success");
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
public JsonResponse detail() {
|
||||
AdminUser user = PlayEduBackendThreadLocal.getAdminUser();
|
||||
HashMap<String, Boolean> permissions = backendBus.adminUserPermissions(user.getId());
|
||||
|
||||
HashMap<String, Object> data = new HashMap<>();
|
||||
data.put("user", user);
|
||||
data.put("permissions", permissions);
|
||||
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user