feat(backend): Improve authorization governance and video interactions
This commit is contained in:
+24
@@ -1,5 +1,6 @@
|
||||
package com.nuaa.video.auth.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nuaa.video.auth.entity.AuthUser;
|
||||
import com.nuaa.video.auth.service.AuthUserService;
|
||||
@@ -10,6 +11,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 认证管理控制器 - 供管理后台调用
|
||||
*/
|
||||
@@ -63,6 +67,26 @@ public class AdminAuthController {
|
||||
return authUserService.lockUser(userId, locked);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按账号状态查询用户ID - 管理接口
|
||||
*/
|
||||
@GetMapping("/user-ids/status/{status}")
|
||||
public Result<List<Long>> getUserIdsByStatus(
|
||||
@PathVariable Integer status,
|
||||
HttpServletRequest request) {
|
||||
if (!isInternalRequest(request)) {
|
||||
return Result.error("非法的内部调用");
|
||||
}
|
||||
|
||||
List<Long> userIds = authUserService.list(new LambdaQueryWrapper<AuthUser>()
|
||||
.select(AuthUser::getId)
|
||||
.eq(AuthUser::getStatus, status))
|
||||
.stream()
|
||||
.map(AuthUser::getId)
|
||||
.collect(Collectors.toList());
|
||||
return Result.success(userIds);
|
||||
}
|
||||
|
||||
private boolean isInternalRequest(HttpServletRequest request) {
|
||||
return internalServiceToken.equals(request.getHeader("X-Internal-Token"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user