Browse Source

加白名单

master
nili 10 months ago
parent
commit
5b38506541
  1. 5
      game-dao/src/main/java/awesome/group/game/dao/mapper/MatrixAdvRecordMapper.java
  2. 6
      game-service/src/main/java/awesome/group/game/service/MatrixService.java
  3. 13
      game-web/src/main/java/awesome/group/controller/MatrixController.java
  4. 1
      game-web/src/main/java/awesome/group/filter/LoginFilter.java

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

@ -4,8 +4,13 @@ import awesome.group.game.dao.bean.MatrixAdvRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface MatrixAdvRecordMapper extends BaseMapper<MatrixAdvRecord> { public interface MatrixAdvRecordMapper extends BaseMapper<MatrixAdvRecord> {
@Select("select id from matrix_app where code = #{code}") @Select("select id from matrix_app where code = #{code}")
Integer queryAppId(String code); Integer queryAppId(String code);
@Select("select device_id from matrix_white_device")
List<String> queryWhitelist();
} }

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

@ -8,6 +8,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.List;
@Service @Service
public class MatrixService { public class MatrixService {
@ -31,4 +33,8 @@ public class MatrixService {
record.setIp(ip); record.setIp(ip);
mapper.insert(record); mapper.insert(record);
} }
public List<String> whiteList() {
return mapper.queryWhitelist();
}
} }

13
game-web/src/main/java/awesome/group/controller/MatrixController.java

@ -6,10 +6,9 @@ import awesome.group.game.service.MatrixService;
import awesome.group.game.service.bo.MatrixAdvRecordEditBo; import awesome.group.game.service.bo.MatrixAdvRecordEditBo;
import awesome.group.game.service.common.response.R; import awesome.group.game.service.common.response.R;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import java.util.List;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/api/game/matrix") @RequestMapping("/api/game/matrix")
@ -23,4 +22,10 @@ public class MatrixController {
matrixService.saveRecord(bo, RequestContext.getIpAddr(RequestContext.getRequest())); matrixService.saveRecord(bo, RequestContext.getIpAddr(RequestContext.getRequest()));
return new R<>(R.CODE_SUCCESS, "ok", null); return new R<>(R.CODE_SUCCESS, "ok", null);
} }
@GetMapping("/whiteList")
@RestApi
public R<List<String>> whiteList(){
return new R<>(R.CODE_SUCCESS, "ok", matrixService.whiteList());
}
} }

1
game-web/src/main/java/awesome/group/filter/LoginFilter.java

@ -39,6 +39,7 @@ public class LoginFilter implements Filter {
"/api/game/auth/loginV2", "/api/game/auth/loginV2",
"/api/game/auth/loginV3", "/api/game/auth/loginV3",
"/api/game/matrix/saveAdvRecord", "/api/game/matrix/saveAdvRecord",
"/api/game/matrix/whiteList",
"/api/game/auth/test"); "/api/game/auth/test");
boolean pass = false; boolean pass = false;
Integer userId = null; Integer userId = null;

Loading…
Cancel
Save