parent
a527230820
commit
8c7c439c4e
|
@ -39,7 +39,7 @@ public class ApiService {
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
String signature = generateSignature("appKey" + APP_KEY + "timestamp" + currentTimeMillis);
|
||||
logger.info("getBIPToken → 签名: {}", signature);
|
||||
try {
|
||||
|
||||
// 禁用 SSL 证书验证
|
||||
disableSSLCertificateChecking();
|
||||
// 构建URL
|
||||
|
@ -50,18 +50,21 @@ public class ApiService {
|
|||
map.put("url", urlString);
|
||||
// return urlString;
|
||||
|
||||
String token;
|
||||
try {
|
||||
// 发送请求
|
||||
Request request = buildRequest(urlString);
|
||||
logger.info("getBIPToken → 获取返回数据:{}", request);
|
||||
Response response = client.newCall(request).execute();
|
||||
String token = handleResponse(response);
|
||||
token = handleResponse(response);
|
||||
} catch (Exception e) {
|
||||
logger.error("getBIPToken → 请求失败: ", e);
|
||||
token = null;
|
||||
}
|
||||
map.put("token", token);
|
||||
// 处理响应
|
||||
return map;
|
||||
} catch (Exception e) {
|
||||
logger.error("getBIPToken → 请求失败: ", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Request buildRequest(String urlString) {
|
||||
|
|
|
@ -173,7 +173,7 @@ public class ApiMappingBillPlugin extends AbstractFormPlugin implements Plugin {
|
|||
apiEntity.setHeaders(headMap);
|
||||
Map<String, Object> paramsMap = new HashMap<>();
|
||||
Map<String, Object> resultMap = ApiService.getBIPToken(domainName);
|
||||
paramsMap.put("access_token", resultMap != null ? resultMap.get("token") : "");
|
||||
paramsMap.put("access_token", resultMap.get("token"));
|
||||
apiEntity.setQueryParams(paramsMap);
|
||||
apiEntity.setRequestBody(codeEdit.getText());
|
||||
JSONObject responseBody = ApiEntity.getResponseBody(apiEntity);
|
||||
|
|
|
@ -36,13 +36,13 @@ public class ApiTestBillPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
if ("shkd_token".equals(key)) {
|
||||
String url = this.getModel().getValue("shkd_url").toString();
|
||||
Map<String, Object> resultMap = ApiService.getBIPToken(url);
|
||||
this.getView().showTipNotification(resultMap != null ? resultMap.get("token").toString() : "数据为空");
|
||||
this.getView().showTipNotification(resultMap.get("token") == null ? "获取token为空" :resultMap.get("token").toString());
|
||||
}
|
||||
|
||||
if ("shkd_geturl".equals(key)) {
|
||||
String url = this.getModel().getValue("shkd_url").toString();
|
||||
Map<String, Object> resultMap = ApiService.getBIPToken(url);
|
||||
this.getView().showTipNotification(resultMap != null ? resultMap.get("url").toString() : "数据为空");
|
||||
this.getView().showTipNotification(resultMap.get("url").toString());
|
||||
}
|
||||
|
||||
if ("shkd_api".equals(key)) {
|
||||
|
|
Loading…
Reference in New Issue