1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-10-21 22:56:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

添加管理添加书籍前校验用户token是否有效,同时修改了获取用户信息的部分代码(从Controller层挪到Service层)(还未测试)

This commit is contained in:
2022-04-01 23:21:13 +08:00
parent 6b47ded6ee
commit 7bf98f6ae0
7 changed files with 131 additions and 13 deletions

View File

@@ -1,5 +1,7 @@
package plus.bookshelf.Service.Service;
import org.springframework.data.redis.core.RedisTemplate;
import plus.bookshelf.Common.Error.BusinessException;
import plus.bookshelf.Service.Model.UserModel;
public interface UserService {
@@ -13,8 +15,18 @@ public interface UserService {
/**
* 通过用户Id获取用户
*
* @param id 用户Id
* @return
*/
UserModel getUserById(Integer id);
/**
* 检查用户令牌是否有效,并返回令牌对应的用户 UserModel
* (令牌无效直接抛出异常)
*
* @param token
* @return
*/
UserModel getUserByToken(RedisTemplate redisTemplate, String token) throws BusinessException;
}