huangzhiyong пре 8 година
родитељ
комит
414f29de50

+ 5 - 4
hos-camel2/src/main/java/camel/gateway/processor/GatewayProcessor.java

@ -127,7 +127,7 @@ public class GatewayProcessor implements Processor {
    private boolean checkAuthorized(Map<String, Object> params) {
        ObjectMapper objectMapper = new ObjectMapper();
        //TODO 设置固定的验证入口地址
        HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
        HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
        if (response.getStatusCode() != 200) {
            System.out.println("验证API权限,请求失败!");
            return false;
@ -184,9 +184,10 @@ public class GatewayProcessor implements Processor {
                    endPoint[0] = endPoint[0].replaceAll("\\{[^}]*\\}", value);
                } else if (p.getType().equals("2")) { //head param
                    exchange.getOut().setHeader(p.getName(), value);
                }else {
                    body[0] += ("&" + p.getName() + "=" + value);
                }
                body[0] += ("&" + p.getName() + "=" + value);
            });
            if (body[0].length() != 0) {
@ -205,7 +206,7 @@ public class GatewayProcessor implements Processor {
            return appApi;
        }
        HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApi/search?filters=methodName%3D" + api + "&size=15&page=1");
        HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/appApi/search?filters=methodName%3D" + api + "&size=15&page=1");
        if (response.getStatusCode() != 200) {
            return null;
        }
@ -225,7 +226,7 @@ public class GatewayProcessor implements Processor {
    private String getSecret(String appKey) {
        ObjectMapper objectMapper = new ObjectMapper();
        //TODO 设置固定的验证入口地址
        HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/apps/" + appKey);
        HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/apps/" + appKey);
        if (response.getStatusCode() != 200) {
            System.out.println("获取app的secret请求失败!");
            return "";

+ 2 - 2
src/main/resources/application.yml

@ -112,6 +112,6 @@ hos:
  mysql:
    filePath: /usr/local/esb/esb.sql   #租户基础表 sql文件位置
service-gateway:
  portalUrl: http://192.168.131.109:444/api/v1.0/portal
  adminUrl: http://192.168.131.109:10000/api/v1.0/admin
  portalUrl: http://192.168.1.221:10280/api/v1.0/portal
  adminUrl: http://192.168.1.221:10000/api/v1.0/admin
  url: http://192.168.131.109:9999/api