mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-10-21 22:56:41 +08:00
添加管理添加书籍前校验用户token是否有效,同时修改了获取用户信息的部分代码(从Controller层挪到Service层)(还未测试)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user