|
@@ -62,7 +62,7 @@ public class AdminController {
|
|
|
private static final List<String> SEND_LIST = List.of("o_i5g6V5z5uDpx_SBhJ4ePek8g8k","o_i5g6X99wu2OmC4DcQKXKNmJexA");
|
|
private static final List<String> SEND_LIST = List.of("o_i5g6V5z5uDpx_SBhJ4ePek8g8k","o_i5g6X99wu2OmC4DcQKXKNmJexA");
|
|
|
|
|
|
|
|
@PostMapping(value = "/login")
|
|
@PostMapping(value = "/login")
|
|
|
- public Result<Long> login(@RequestBody Admin adminRequest) throws Exception {
|
|
|
|
|
|
|
+ public Result<AdminInfo> login(@RequestBody Admin adminRequest) throws Exception {
|
|
|
Admin admin = adminService.getOne(
|
|
Admin admin = adminService.getOne(
|
|
|
new QueryWrapper<Admin>().lambda().eq(Admin::getUserName,adminRequest.getUserName()));
|
|
new QueryWrapper<Admin>().lambda().eq(Admin::getUserName,adminRequest.getUserName()));
|
|
|
|
|
|
|
@@ -80,7 +80,18 @@ public class AdminController {
|
|
|
throw BusinessRuntimeException.getInstance("密码有误.");
|
|
throw BusinessRuntimeException.getInstance("密码有误.");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(admin.getId());
|
|
|
|
|
|
|
+ // 生成token
|
|
|
|
|
+
|
|
|
|
|
+ StpUtil.login(admin.getId());
|
|
|
|
|
+
|
|
|
|
|
+ String token = StpUtil.getTokenValue();
|
|
|
|
|
+
|
|
|
|
|
+ admin.setPassWord("");
|
|
|
|
|
+
|
|
|
|
|
+ AdminInfo info = new AdminInfo();
|
|
|
|
|
+ info.setInfo(admin);
|
|
|
|
|
+ info.setToken(token);
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(info);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/post")
|
|
@PostMapping("/post")
|