mirror of
https://github.com/blossom-editor/blossom
synced 2024-11-17 14:39:21 +08:00
feat: 指定用户的统计查询
This commit is contained in:
parent
e8d3691853
commit
88c01f5fbb
@ -2,12 +2,16 @@ package com.blossom.backend.server.article.stat;
|
||||
|
||||
import com.blossom.backend.base.auth.AuthContext;
|
||||
import com.blossom.backend.base.auth.annotation.AuthIgnore;
|
||||
import com.blossom.backend.base.auth.annotation.AuthUserType;
|
||||
import com.blossom.backend.base.auth.exception.AuthException;
|
||||
import com.blossom.backend.base.auth.exception.AuthRCode;
|
||||
import com.blossom.backend.base.user.UserTypeEnum;
|
||||
import com.blossom.backend.config.BlConstants;
|
||||
import com.blossom.backend.server.article.draft.pojo.ArticleStatRes;
|
||||
import com.blossom.backend.server.article.stat.pojo.ArticleHeatmapRes;
|
||||
import com.blossom.backend.server.article.stat.pojo.ArticleLineRes;
|
||||
import com.blossom.backend.server.article.stat.pojo.ArticleWordsSaveReq;
|
||||
import com.blossom.backend.server.article.stat.pojo.ArticleWordsRes;
|
||||
import com.blossom.backend.server.article.stat.pojo.ArticleWordsSaveReq;
|
||||
import com.blossom.common.base.pojo.R;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -77,6 +81,21 @@ public class ArticleStatController {
|
||||
return R.ok(statService.statCount(null, null, AuthContext.getUserId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 文章数和文章字数
|
||||
*
|
||||
* @apiNote 只有管理员可以查看
|
||||
* @since 1.13.0
|
||||
*/
|
||||
@AuthUserType(UserTypeEnum.ADMIN)
|
||||
@GetMapping("/words/user")
|
||||
public R<ArticleStatRes> word(@RequestParam("id") Long id) {
|
||||
if (!AuthContext.getType().equals(UserTypeEnum.ADMIN.getType())) {
|
||||
throw new AuthException(AuthRCode.PERMISSION_DENIED);
|
||||
}
|
||||
return R.ok(statService.statCount(null, null, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字数统计列表
|
||||
*
|
||||
|
@ -2,6 +2,8 @@ package com.blossom.backend.server.picture;
|
||||
|
||||
import com.blossom.backend.base.auth.AuthContext;
|
||||
import com.blossom.backend.base.auth.annotation.AuthIgnore;
|
||||
import com.blossom.backend.base.auth.annotation.AuthUserType;
|
||||
import com.blossom.backend.base.user.UserTypeEnum;
|
||||
import com.blossom.backend.server.picture.pojo.*;
|
||||
import com.blossom.common.base.exception.XzException400;
|
||||
import com.blossom.common.base.pojo.PageRes;
|
||||
@ -116,4 +118,15 @@ public class PictureController {
|
||||
public R<PictureStatRes> stat(@RequestParam(value = "pid", required = false) Long pid) {
|
||||
return R.ok(baseService.stat(AuthContext.getUserId(), pid));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的图片统计
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@AuthUserType(UserTypeEnum.ADMIN)
|
||||
@GetMapping("/stat/user")
|
||||
public R<PictureStatRes> statUser(@RequestParam(value = "id") Long userId) {
|
||||
return R.ok(baseService.stat(userId, null));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user