diff --git a/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixAdmin.java b/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixAdmin.java index 99066a4..5ade0eb 100644 --- a/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixAdmin.java +++ b/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixAdmin.java @@ -18,4 +18,5 @@ public class MatrixAdmin { private String userIds;//绑定代理账号的用户id private Integer incomeRate; private Integer hide; + private Integer disable; } diff --git a/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java b/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java index fa52583..c1c7bf6 100644 --- a/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java +++ b/game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java @@ -19,6 +19,7 @@ public class MatrixApp { private Integer hide; private String secret; private Integer version; + private Integer disable; private String umeng;//友盟的配置数据 private String aliPay;//支付宝的配置数据 diff --git a/game-service/src/main/java/awesome/group/game/service/cache/CacheKey.java b/game-service/src/main/java/awesome/group/game/service/cache/CacheKey.java index db32d6e..9b8b566 100644 --- a/game-service/src/main/java/awesome/group/game/service/cache/CacheKey.java +++ b/game-service/src/main/java/awesome/group/game/service/cache/CacheKey.java @@ -15,8 +15,4 @@ public class CacheKey { public static final String activateTryTimes(Integer uid) { return String.format("vip_activate_times_%s", uid); } - - public static final String disableChannel() { - return "disable_channel"; - } } diff --git a/game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java b/game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java index ab47151..9634c5f 100644 --- a/game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java +++ b/game-service/src/main/java/awesome/group/game/service/citrus/CitrusAppService.java @@ -26,7 +26,7 @@ public class CitrusAppService { public AppBasicInfo getAppDetail(String appCode) { MatrixApp app = appMapper.queryByCode(appCode); AppBasicInfo res = AppBasicInfo.getBasic(app); - res.disable = jedisManager.exist("disable_" + appCode); + res.disable = app.getDisable() > 0; return res; } diff --git a/game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java b/game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java index 3fae632..24cba03 100644 --- a/game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java +++ b/game-service/src/main/java/awesome/group/game/service/matrix/SuperAdminService.java @@ -128,22 +128,6 @@ public class SuperAdminService { } } - public void disableByChannel(String channel) { - List list = appMapper.selectByChannel(channel); - for (MatrixApp app : list) { - jedisManager.set("disable_" + app.getCode(), "1"); - } - String cacheKey = CacheKey.disableChannel(); - jedisManager.sadd(cacheKey, channel); - } - - public void enableByChannel(String channel) { - List list = appMapper.selectByChannel(channel); - for (MatrixApp app : list) { - jedisManager.del("disable_" + app.getCode()); - } - } - public void changeInnerUser(Integer userId, int status) { innerUserMapper.updateStatus(userId, status); } diff --git a/game-web/src/main/java/awesome/group/game/web/filter/AdminLoginFilter.java b/game-web/src/main/java/awesome/group/game/web/filter/AdminLoginFilter.java index 23c9e0b..98f0949 100644 --- a/game-web/src/main/java/awesome/group/game/web/filter/AdminLoginFilter.java +++ b/game-web/src/main/java/awesome/group/game/web/filter/AdminLoginFilter.java @@ -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 { diff --git a/game-web/src/main/java/awesome/group/game/web/rest/matrix/SuperAdminController.java b/game-web/src/main/java/awesome/group/game/web/rest/matrix/SuperAdminController.java index 247d72c..1bfd84a 100644 --- a/game-web/src/main/java/awesome/group/game/web/rest/matrix/SuperAdminController.java +++ b/game-web/src/main/java/awesome/group/game/web/rest/matrix/SuperAdminController.java @@ -92,11 +92,4 @@ public class SuperAdminController { superAdminService.addMockSchedule(bo, RequestContext.getAdminID()); return new R<>(R.CODE_SUCCESS, "ok", null); } - - @GetMapping("/disableByChannel") - @RestApi - public R disableByChannel(@RequestParam String channel) { - superAdminService.disableByChannel(channel); - return new R<>(R.CODE_SUCCESS, "ok", null); - } }