Browse Source

白名单忽略channel

master
nili 7 months ago
parent
commit
62608919cd
  1. 1
      game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java
  2. 8
      game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAdvRecordMapper.java
  3. 6
      game-service/src/main/java/awesome/group/game/service/MatrixService.java

1
game-dao/src/main/java/awesome/group/game/dao/bean/MatrixApp.java

@ -12,6 +12,5 @@ public class MatrixApp {
private String code; private String code;
private String url; private String url;
private Long income;//分 private Long income;//分
private String channel;
private String secret; private String secret;
} }

8
game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAdvRecordMapper.java

@ -11,9 +11,9 @@ public interface MatrixAdvRecordMapper extends BaseMapper<MatrixAdvRecord> {
@Select("select * from matrix_app where code = #{code}") @Select("select * from matrix_app where code = #{code}")
MatrixApp queryApp(String code); MatrixApp queryApp(String code);
@Select("select count(*) from matrix_white_device where channel = #{channel} and device_id = #{deviceId}") @Select("select count(*) from matrix_white_device where device_id = #{deviceId}")
Integer queryWhitelist(String channel, String deviceId); Integer queryWhitelist(String deviceId);
@Insert("insert ignore into matrix_white_device (channel, device_id) values (#{channel}, #{deviceId})") @Insert("insert ignore into matrix_white_device (device_id) values (#{deviceId})")
void insertWhiteList(String channel, String deviceId); void insertWhiteList(String deviceId);
} }

6
game-service/src/main/java/awesome/group/game/service/MatrixService.java

@ -69,7 +69,7 @@ public class MatrixService {
if (app == null) { if (app == null) {
return false; return false;
} }
return mapper.queryWhitelist(app.getChannel(), deviceId) > 0; return mapper.queryWhitelist(deviceId) > 0;
} }
public void addIntoWhiteList(String deviceId, String appCode) { public void addIntoWhiteList(String deviceId, String appCode) {
@ -77,9 +77,9 @@ public class MatrixService {
if (app == null) { if (app == null) {
return; return;
} }
if (mapper.queryWhitelist(app.getChannel(), deviceId) > 0) { if (mapper.queryWhitelist(deviceId) > 0) {
return; return;
} }
mapper.insertWhiteList(app.getChannel(), deviceId); mapper.insertWhiteList(deviceId);
} }
} }

Loading…
Cancel
Save