parent
058a898c25
commit
e921fd57ab
|
@ -181,6 +181,12 @@
|
||||||
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.7.16</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package net.shapelight.modules.xian.service;
|
package net.shapelight.modules.xian.service;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
|
@ -95,7 +96,7 @@ public class XaApi {
|
||||||
* @param secre
|
* @param secre
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String httpPOSTJson(String url, String json, String serviceId, String serviceValue, String appid, String secre, String tranId) {
|
public static String httpPOSTJsonOld(String url, String json, String serviceId, String serviceValue, String appid, String secre, String tranId) {
|
||||||
String data = "";
|
String data = "";
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
try {
|
try {
|
||||||
|
@ -169,6 +170,30 @@ public class XaApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String httpPOSTJson(String url, String json, String serviceId, String serviceValue, String appid, String secre, String tranId) {
|
||||||
|
// String data = "";
|
||||||
|
|
||||||
|
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||||
|
String token = XaUtils.md5(appid + secre + currdate + json.replaceAll("\r\n", ""));
|
||||||
|
Map<String,String> map=new HashMap();
|
||||||
|
map.put("appid",appid);
|
||||||
|
map.put("token",token);
|
||||||
|
map.put("tranId",tranId);//可固定这么写
|
||||||
|
map.put("serviceId",serviceId);
|
||||||
|
map.put("serviceValue",serviceValue);
|
||||||
|
map.put("versionCode","");
|
||||||
|
map.put("User-Agent","Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||||
|
String body = HttpUtil.createPost(url).headerMap(map, true).body(json).execute().body();
|
||||||
|
try{
|
||||||
|
body = URLDecoder.decode(body, "UTF-8");
|
||||||
|
return body;
|
||||||
|
}catch (UnsupportedEncodingException e){
|
||||||
|
log.error("解码返回结果失败:原始数据:"+body);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void syncRoom() {
|
public static void syncRoom() {
|
||||||
String appid = "1297164778041095";
|
String appid = "1297164778041095";
|
||||||
String appsecret = "22971647780410956329716477804109";
|
String appsecret = "22971647780410956329716477804109";
|
||||||
|
|
Loading…
Reference in New Issue