Browse Source

REPORT-15314 103模板信息收集=>重构=>调整代码

research/10.0
plough 6 years ago
parent
commit
2a520423a4
  1. 20
      designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java

20
designer-base/src/main/java/com/fr/design/mainframe/template/info/SendHelper.java

@ -3,9 +3,10 @@ package com.fr.design.mainframe.template.info;
import com.fr.design.mainframe.SiteCenterToken; import com.fr.design.mainframe.SiteCenterToken;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
/** /**
@ -32,21 +33,12 @@ class SendHelper {
HashMap<String, String> para = new HashMap<>(); HashMap<String, String> para = new HashMap<>();
para.put("token", SiteCenterToken.generateToken()); para.put("token", SiteCenterToken.generateToken());
para.put("content", content); para.put("content", content);
HttpClient httpClient = new HttpClient(url, para, true);
httpClient.setTimeout(5000);
httpClient.asGet();
if (!httpClient.isServerAlive()) {
return false;
}
String res = httpClient.getResponseText();
boolean success;
try { try {
success = ComparatorUtils.equals(new JSONObject(res).get("status"), "success"); String res = HttpToolbox.get(url, para);
} catch (Exception ex) { return ComparatorUtils.equals(new JSONObject(res).get("status"), "success");
success = false; } catch (IOException ignore) {
} }
return success; return false;
} }
} }

Loading…
Cancel
Save