处理请求方ip
							parent
							
								
									eb321aba7c
								
							
						
					
					
						commit
						f403b6c66d
					
				| 
						 | 
				
			
			@ -64,7 +64,9 @@ public class TrxServiceImpl implements TrxService {
 | 
			
		|||
        try {
 | 
			
		||||
            HttpRequest httpRequest = HttpRequest.get(url)
 | 
			
		||||
                    .addHeaders(paramsMap);
 | 
			
		||||
            httpRequest.cookie("ngx_cookie=" + ngxCookie);
 | 
			
		||||
            log.info("调用天融信获取随机字符串接口, url:" + httpRequest.getUrl() + "请求头:" + JSONObject.toJSONString(httpRequest.headers()));
 | 
			
		||||
            log.info("调用天融信获取随机字符串接口, 请求信息:" + JSONObject.toJSONString(httpRequest));
 | 
			
		||||
            HttpResponse response = httpRequest.execute();
 | 
			
		||||
            result = JSONObject.parseObject(response.body());
 | 
			
		||||
            if ("-1".equals(result.getString("result"))) {
 | 
			
		||||
| 
						 | 
				
			
			@ -248,7 +250,8 @@ public class TrxServiceImpl implements TrxService {
 | 
			
		|||
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
 | 
			
		||||
            ip = request.getRemoteAddr();
 | 
			
		||||
        }
 | 
			
		||||
        return ip;
 | 
			
		||||
        String[] parts = ip.split(":");
 | 
			
		||||
        return parts[0];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue