|
|
@ -1,11 +1,12 @@ |
|
|
|
package awesome.group.game.web.filter; |
|
|
|
|
|
|
|
import awesome.group.game.service.cache.CacheKey; |
|
|
|
import awesome.group.game.dao.bean.MatrixAdmin; |
|
|
|
import awesome.group.game.dao.mapper.MatrixAdminMapper; |
|
|
|
import awesome.group.game.service.cache.JedisManager; |
|
|
|
import awesome.group.game.web.RequestContext; |
|
|
|
import awesome.group.game.service.common.log.L; |
|
|
|
import awesome.group.game.service.common.response.R; |
|
|
|
import awesome.group.game.service.util.JwtUtils; |
|
|
|
import awesome.group.game.web.RequestContext; |
|
|
|
import com.auth0.jwt.exceptions.TokenExpiredException; |
|
|
|
import com.google.gson.Gson; |
|
|
|
import jakarta.servlet.*; |
|
|
@ -28,6 +29,9 @@ public class AdminLoginFilter implements Filter { |
|
|
|
@Autowired |
|
|
|
private JedisManager jedisManager; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MatrixAdminMapper adminMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void init(FilterConfig filterConfig) throws ServletException { |
|
|
@ -70,11 +74,12 @@ public class AdminLoginFilter implements Filter { |
|
|
|
} |
|
|
|
if (pass) { |
|
|
|
RequestContext.initAdmin(httpRequest, (HttpServletResponse) response, adminId); |
|
|
|
String channel = RequestContext.getRequestChannel(); |
|
|
|
String cacheKey = CacheKey.disableChannel(); |
|
|
|
if (adminId != null && adminId != 1 && jedisManager.sIsMember(cacheKey, channel)) { |
|
|
|
channelDisable(response); |
|
|
|
return; |
|
|
|
if (adminId != null) { |
|
|
|
MatrixAdmin admin = adminMapper.selectById(adminId); |
|
|
|
if (admin != null && admin.getDisable() > 0) { |
|
|
|
channelDisable(response); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
chain.doFilter(request, response); |
|
|
|
} else { |
|
|
|