WeixinException("-1","xxx")->WeixinException("xxx")
This commit is contained in:
parent
788869f183
commit
96b3080c2d
5
pom.xml
5
pom.xml
@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<version>1.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>weixin4j</name>
|
||||
<url>https://github.com/foxinmy/weixin4j</url>
|
||||
|
||||
@ -232,7 +232,7 @@ public class HttpRequest {
|
||||
throw new WeixinException(response.getAsString());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new WeixinException("-1", e.getMessage());
|
||||
throw new WeixinException(e.getMessage());
|
||||
} finally {
|
||||
request.releaseConnection();
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public class MassApi extends MpApi {
|
||||
}
|
||||
}
|
||||
if (!(box instanceof Massable)) {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"%s not implement Massable", box.getClass()));
|
||||
}
|
||||
String msgtype = box.getMediaType().name();
|
||||
@ -187,7 +187,7 @@ public class MassApi extends MpApi {
|
||||
}
|
||||
}
|
||||
if (!(box instanceof Massable)) {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"%s not implement Massable", box.getClass()));
|
||||
}
|
||||
String msgtype = box.getMediaType().name();
|
||||
|
||||
@ -20,7 +20,7 @@ import com.foxinmy.weixin4j.util.FileUtil;
|
||||
import com.foxinmy.weixin4j.util.IOUtil;
|
||||
|
||||
/**
|
||||
* 媒体相关API
|
||||
* 多媒体相关API
|
||||
*
|
||||
* @className MediaApi
|
||||
* @author jy.hu
|
||||
@ -137,11 +137,11 @@ public class MediaApi extends MpApi {
|
||||
os = new FileOutputStream(file);
|
||||
os.write(datas);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"create file fail:%s", file.getAbsolutePath()));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new WeixinException("-1", e.getMessage());
|
||||
throw new WeixinException(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
|
||||
@ -45,7 +45,7 @@ public class NotifyApi extends MpApi {
|
||||
*/
|
||||
public JsonResult sendNotify(NotifyMessage notify) throws WeixinException {
|
||||
if (!(notify.getBox() instanceof Notifyable)) {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"%s not implement Notifyable", notify.getBox().getClass()));
|
||||
}
|
||||
String custom_notify_uri = getRequestUri("custom_notify_uri");
|
||||
|
||||
@ -356,7 +356,7 @@ public class PayApi extends MpApi {
|
||||
weixinAccount.getMchId(), ca);
|
||||
response = request.post(refund_uri, param);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format("unknown version:%d",
|
||||
throw new WeixinException(String.format("unknown version:%d",
|
||||
version));
|
||||
}
|
||||
return response.getAsObject(new TypeReference<RefundResult>() {
|
||||
@ -530,7 +530,7 @@ public class PayApi extends MpApi {
|
||||
String param = map2xml(map);
|
||||
response = request.post(downloadbill_uri, param);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format("unknown version:%d",
|
||||
throw new WeixinException(String.format("unknown version:%d",
|
||||
version));
|
||||
}
|
||||
BufferedReader reader = null;
|
||||
@ -556,7 +556,7 @@ public class PayApi extends MpApi {
|
||||
os = new FileOutputStream(file);
|
||||
wb.write(os);
|
||||
} catch (IOException e) {
|
||||
throw new WeixinException("-1", e.getMessage());
|
||||
throw new WeixinException(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null) {
|
||||
@ -606,7 +606,7 @@ public class PayApi extends MpApi {
|
||||
String param = map2xml(map);
|
||||
response = request.post(refundquery_uri, param);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format("unknown version:%d",
|
||||
throw new WeixinException(String.format("unknown version:%d",
|
||||
version));
|
||||
}
|
||||
return RefundConverter.fromXML(response.getAsString());
|
||||
|
||||
@ -98,16 +98,16 @@ public class QrApi extends MpApi {
|
||||
byte[] datas = getQRData(parameter);
|
||||
OutputStream os = null;
|
||||
try {
|
||||
boolean flag = file.createNewFile();
|
||||
boolean flag = file.exists() || file.createNewFile();
|
||||
if (flag) {
|
||||
os = new FileOutputStream(file);
|
||||
os.write(datas);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"create file fail:%s", file.getAbsolutePath()));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new WeixinException("-1", e.getMessage());
|
||||
throw new WeixinException(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
|
||||
@ -133,9 +133,9 @@ public class UserApi extends MpApi {
|
||||
* @see com.foxinmy.weixin4j.mp.model.Following
|
||||
*/
|
||||
public Following getFollowing(String nextOpenId) throws WeixinException {
|
||||
String fllowing_uri = getRequestUri("following_uri");
|
||||
String following_uri = getRequestUri("following_uri");
|
||||
Token token = tokenHolder.getToken();
|
||||
Response response = request.get(String.format(fllowing_uri,
|
||||
Response response = request.get(String.format(following_uri,
|
||||
token.getAccessToken(), nextOpenId == null ? "" : nextOpenId));
|
||||
|
||||
Following following = response
|
||||
|
||||
@ -115,13 +115,7 @@ public class MicroPayPackage extends PayPackage {
|
||||
public String toString() {
|
||||
return "MicroPayPackage [appid=" + appid + ", mch_id=" + mch_id
|
||||
+ ", device_info=" + device_info + ", nonce_str=" + nonce_str
|
||||
+ ", sign=" + sign + ", auth_code=" + auth_code
|
||||
+ ", getBody()=" + getBody() + ", getAttach()=" + getAttach()
|
||||
+ ", getOut_trade_no()=" + getOut_trade_no()
|
||||
+ ", getTotal_fee()=" + getTotal_fee()
|
||||
+ ", getSpbill_create_ip()=" + getSpbill_create_ip()
|
||||
+ ", getTime_start()=" + getTime_start()
|
||||
+ ", getTime_expire()=" + getTime_expire()
|
||||
+ ", getGoods_tag()=" + getGoods_tag() + "]";
|
||||
+ ", sign=" + sign + ", auth_code=" + auth_code + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,14 @@ import java.util.Date;
|
||||
|
||||
import com.foxinmy.weixin4j.util.DateUtil;
|
||||
|
||||
/**
|
||||
* 订单信息
|
||||
* @className PayPackage
|
||||
* @author jy
|
||||
* @date 2014年12月18日
|
||||
* @since JDK 1.7
|
||||
* @see
|
||||
*/
|
||||
public class PayPackage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3450161267802545790L;
|
||||
@ -126,10 +134,10 @@ public class PayPackage implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PayPackage [body=" + body + ", attach=" + attach
|
||||
+ ", out_trade_no=" + out_trade_no + ", total_fee=" + total_fee
|
||||
return "body=" + body + ", attach=" + attach + ", out_trade_no="
|
||||
+ out_trade_no + ", total_fee=" + total_fee
|
||||
+ ", spbill_create_ip=" + spbill_create_ip + ", time_start="
|
||||
+ time_start + ", time_expire=" + time_expire + ", goods_tag="
|
||||
+ goods_tag + ", notify_url=" + notify_url + "]";
|
||||
+ goods_tag + ", notify_url=" + notify_url;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,12 +135,6 @@ public class PayPackageV2 extends PayPackage {
|
||||
return "PayPackageV2 [bank_type=" + bank_type + ", partner=" + partner
|
||||
+ ", fee_type=" + fee_type + ", transport_fee=" + transport_fee
|
||||
+ ", product_fee=" + product_fee + ", input_charset="
|
||||
+ input_charset + ", goods_tag=" + getGoods_tag()
|
||||
+ ", getBank_type()=" + getBank_type() + ", getPartner()="
|
||||
+ getPartner() + ", getFee_type()=" + getFee_type()
|
||||
+ ", getTransport_fee()=" + getTransport_fee()
|
||||
+ ", getProduct_fee()=" + getProduct_fee()
|
||||
+ ", getGoods_tag()=" + getGoods_tag()
|
||||
+ ", getInput_charset()=" + getInput_charset() + "]";
|
||||
+ input_charset + ", " + super.toString() + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,12 +146,7 @@ public class PayPackageV3 extends PayPackage {
|
||||
return "PayPackageV3 [appid=" + appid + ", mch_id=" + mch_id
|
||||
+ ", device_info=" + device_info + ", nonce_str=" + nonce_str
|
||||
+ ", sign=" + sign + ", trade_type=" + trade_type + ", openid="
|
||||
+ openid + ", product_id=" + product_id + ", getAppid()="
|
||||
+ getAppid() + ", getMch_id()=" + getMch_id()
|
||||
+ ", getDevice_info()=" + getDevice_info()
|
||||
+ ", getNonce_str()=" + getNonce_str() + ", getSign()="
|
||||
+ getSign() + ", getTrade_type()=" + getTrade_type()
|
||||
+ ", getOpenid()=" + getOpenid() + ", getProduct_id()="
|
||||
+ getProduct_id() + "]";
|
||||
+ openid + ", product_id=" + product_id + ", "
|
||||
+ super.toString() + "]";
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,11 +137,11 @@ public class MediaApi extends QyApi {
|
||||
os = new FileOutputStream(file);
|
||||
os.write(datas);
|
||||
} else {
|
||||
throw new WeixinException("-1", String.format(
|
||||
throw new WeixinException(String.format(
|
||||
"create file fail:%s", file.getAbsolutePath()));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new WeixinException("-1", e.getMessage());
|
||||
throw new WeixinException(e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user