diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java index 6f884edc..3f9c50c1 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOpenApiController.java @@ -95,18 +95,18 @@ public class HighOpenApiController { public ResponseData getGuizhouSinopecList(HttpServletRequest request) { try { -// String ip = ""; -// // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for -// if (request.getHeader("x-forwarded-for") == null) { -// ip = request.getRemoteAddr(); -// } else { -// ip = request.getHeader("x-forwarded-for"); -// } -// -// if (!secConfigService.isConfig("IP_WHITE" , ip)) { -// log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); -// } + String ip = ""; + // 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for + if (request.getHeader("x-forwarded-for") == null) { + ip = request.getRemoteAddr(); + } else { + ip = request.getHeader("x-forwarded-for"); + } + + if (!secConfigService.isConfig("IP_WHITE" , ip)) { + log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); + } // 获取token String token = huiLianTongConfig.getToken(); @@ -140,16 +140,16 @@ public class HighOpenApiController { ip = request.getHeader("x-forwarded-for"); } -// if (!secConfigService.isConfig("IP_WHITE" , ip)) { -// log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); -// } + if (!secConfigService.isConfig("IP_WHITE" , ip)) { + log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); + } // 获取token String token = huiLianTongConfig.getToken(); // 查询电子卡券类型 - JSONObject data = HuiLianTongConfig.getCouState(token, object.getString("orderNo")); + JSONObject data = HuiLianTongConfig.getCouState(token, object.getString("couNo")); if (!data.getString("result").equals("success")) { log.error("HighOpenApiController -> insertCoupon() error!","查询电子券状态失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "查询电子券状态失败"); @@ -175,11 +175,11 @@ public class HighOpenApiController { } else { ip = request.getHeader("x-forwarded-for"); } -// -// if (!secConfigService.isConfig("IP_WHITE" , ip)) { -// log.error("couJointDist error!", "非法ip地址,请联系管理人员!"); -// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); -// } + + if (!secConfigService.isConfig("IP_WHITE" , ip)) { + log.error("couJointDist error!", "非法ip地址,请联系管理人员!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!"); + } // 获取token String token = huiLianTongConfig.getToken();