public static void main(String[] args) throws Exception {
System.out.println(getSellerItem());
System.out.println(getSellerItem());
System.out.println("----------------");
Map<String,String> map=new HashMap<>();
map.put("page_index", "100");
map.put("page_size", "1");
System.out.println(getSellerItem("jushuitan.order.list.query",map));
System.out.println(getSellerItem("jushuitan.order.list.query",map));
}
private static String getSellerItem() throws IOException {
Map<String, String> params = new HashMap<String, String>();
// 公共参数
params.put("page_index", "100");
params.put("page_size", "1");
params.put("method", "jushuitan.order.list.query");
params.put("app_key", appKey);
params.put("session", sessionKey);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
params.put("timestamp", df.format(new Date()));
params.put("format", "json");
params.put("v", "2.0");
params.put("sign_method", "hmac");
// 业务参数
params.put("fields", "num_iid,title,nick,price,num");
params.put("num_iid", "123456789");
// 签名参数
params.put("sign", signTopRequest(params, appSecret, SIGN_METHOD_HMAC));
// 请用API
return callApi(new URL(serverUrl), params);
}
public static String getSellerItem(String fangfa, Map<String, String> params) throws IOException {
// 公共参数
params.put("method", fangfa);
params.put("app_key", appKey);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
params.put("timestamp", df.format(new Date()));
params.put("format", "json");
params.put("v", "2.0");
params.put("sign_method", "hmac");
// 业务参数
params.put("fields", "num_iid,title,nick,price,num");
params.put("num_iid", "123456789");
// 签名参数
params.put("sign", signTopRequest(params, appSecret, SIGN_METHOD_HMAC));
// 请用API
return callApi(new URL(serverUrl), params);
}
getSellerItem带参:
加入代码:
Map<String, String> params =new HashMap<>();
params.putAll(map);
修改Map<String,String>参数名称为map
这样就正常了,为什么
这是奇门的错误可能出现的情况,我可能是3.1但是为什么第一遍能成功第二遍就不行了