|
@@ -133,24 +133,24 @@ public class PlanNewCommonOutController {
|
|
|
if (!materialList.isEmpty()) {
|
|
if (!materialList.isEmpty()) {
|
|
|
Material material = materialList.get(RandomUtil.randomInt(0, materialList.size()));
|
|
Material material = materialList.get(RandomUtil.randomInt(0, materialList.size()));
|
|
|
String content = material.content();
|
|
String content = material.content();
|
|
|
-// String clientIP = exchange.getRequest().getHeaders().getFirst("X-Forwarded-For");
|
|
|
|
|
-// if ((clientIP == null || clientIP.isEmpty()) && Objects.nonNull(exchange.getRequest().getRemoteAddress())) {
|
|
|
|
|
-// clientIP = exchange.getRequest().getRemoteAddress().getAddress().getHostAddress();
|
|
|
|
|
-// }
|
|
|
|
|
-// if (StrUtil.isNotBlank(clientIP)) {
|
|
|
|
|
-// JSONObject ipInfo = ipAnalyzeServiceInterface.getIpInfo(clientIP);
|
|
|
|
|
-// if (null != ipInfo) {
|
|
|
|
|
-// String city = ipInfo.getStr("city");
|
|
|
|
|
-// if (StrUtil.isNotBlank(city)) {
|
|
|
|
|
-// content = city + content;
|
|
|
|
|
-// } else {
|
|
|
|
|
-// String province = ipInfo.getStr("region");
|
|
|
|
|
-// if (StrUtil.isNotBlank(province)) {
|
|
|
|
|
-// content = province + content;
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ String clientIP=null ;//exchange.getRequest().getHeaders().getFirst("X-Forwarded-For");
|
|
|
|
|
+ if ( Objects.nonNull(exchange.getRequest().getRemoteAddress())) {
|
|
|
|
|
+ clientIP = exchange.getRequest().getRemoteAddress().getAddress().getHostAddress();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StrUtil.isNotBlank(clientIP)) {
|
|
|
|
|
+ JSONObject ipInfo = ipAnalyzeServiceInterface.getIpInfo(clientIP);
|
|
|
|
|
+ if (null != ipInfo) {
|
|
|
|
|
+ String city = ipInfo.getStr("city");
|
|
|
|
|
+ if (StrUtil.isNotBlank(city)) {
|
|
|
|
|
+ content = city + content;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ String province = ipInfo.getStr("region");
|
|
|
|
|
+ if (StrUtil.isNotBlank(province)) {
|
|
|
|
|
+ content = province + content;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
h5ImageAndText.setName(content);
|
|
h5ImageAndText.setName(content);
|
|
|
h5ImageAndText.setRemark(material.remark());
|
|
h5ImageAndText.setRemark(material.remark());
|
|
|
}
|
|
}
|