feat: 增加作家状态查询接口

This commit is contained in:
xiongxiaoyang 2022-05-29 15:23:37 +08:00
parent 066dd0f13e
commit f33c66c5d2
4 changed files with 26 additions and 2 deletions

View File

@ -40,6 +40,14 @@ public class AuthorController {
return authorService.register(dto); return authorService.register(dto);
} }
/**
* 查询作家状态接口
* */
@GetMapping("status")
public RestResp<Integer> getStatus(){
return authorService.getStatus(UserHolder.getUserId());
}
/** /**
* 小说发布接口 * 小说发布接口
*/ */
@ -65,7 +73,7 @@ public class AuthorController {
} }
/** /**
* 小说发布章节列表查询接口 * 小说章节发布列表查询接口
*/ */
@GetMapping("book/chapters/{bookId}") @GetMapping("book/chapters/{bookId}")
public RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(@PathVariable("bookId") Long bookId, PageReqDto dto) { public RestResp<PageRespDto<BookChapterRespDto>> listBookChapters(@PathVariable("bookId") Long bookId, PageReqDto dto) {

View File

@ -32,7 +32,10 @@ public class AuthorAuthStrategy implements AuthStrategy {
/** /**
* 不需要进行作家权限认证的 URI * 不需要进行作家权限认证的 URI
* */ * */
private static final List<String> EXCLUDE_URI = List.of(ApiRouterConsts.API_AUTHOR_URL_PREFIX + "/register"); private static final List<String> EXCLUDE_URI = List.of(
ApiRouterConsts.API_AUTHOR_URL_PREFIX + "/register",
ApiRouterConsts.API_AUTHOR_URL_PREFIX +"/status"
);
@Override @Override
public void auth(String token, String requestUri) throws BusinessException { public void auth(String token, String requestUri) throws BusinessException {

View File

@ -18,4 +18,11 @@ public interface AuthorService {
* @return void * @return void
*/ */
RestResp<Void> register(AuthorRegisterReqDto dto); RestResp<Void> register(AuthorRegisterReqDto dto);
/**
* 查询作家状态
* @param userId 用户ID
* @return 作家状态
* */
RestResp<Integer> getStatus(Long userId);
} }

View File

@ -54,4 +54,10 @@ public class AuthorServiceImpl implements AuthorService {
return RestResp.ok(); return RestResp.ok();
} }
@Override
public RestResp<Integer> getStatus(Long userId) {
AuthorInfoDto author = authorInfoCacheManager.getAuthor(userId);
return Objects.isNull(author) ? RestResp.ok(null) : RestResp.ok(author.getStatus());
}
} }