讲书下添加点赞评论

This commit is contained in:
wuchunlei
2023-11-29 14:49:29 +08:00
parent 70748a2e4c
commit 06359588f6
10 changed files with 284 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
package com.peanut.common.utils;
import com.peanut.common.exception.RRException;
import com.peanut.modules.book.entity.MyUserEntity;
import com.peanut.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
@@ -36,6 +37,11 @@ public class ShiroUtils {
public static Long getUserId() {
return getUserEntity().getUserId();
}
public static Integer getUId() {
MyUserEntity user = (MyUserEntity)SecurityUtils.getSubject().getPrincipal();
return user.getId();
}
public static void setSessionAttribute(Object key, Object value) {
getSession().setAttribute(key, value);