From ef39c25f66a6d170d74e073f87f5e3ea96f98c4a Mon Sep 17 00:00:00 2001 From: "jy.hu" Date: Mon, 10 Nov 2014 13:26:29 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=87=8D=E8=A6=81]=E6=9B=B4=E6=96=B0pom?= =?UTF-8?q?=E7=9A=84package=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 25 +++++++++++++++++++ weixin4j-base/pom.xml | 7 +----- .../foxinmy/weixin4j/http/HttpRequest.java | 5 +--- weixin4j-mp/pom.xml | 25 ++++++++++++++++++- weixin4j-mp/weixin4j-mp-api/README.md | 5 ++-- weixin4j-mp/weixin4j-mp-api/pom.xml | 7 +++++- .../src/main/resources/weixin.properties | 3 ++- weixin4j-mp/weixin4j-mp-server/README.md | 5 ++-- weixin4j-mp/weixin4j-mp-server/pom.xml | 17 +------------ .../weixin4j-mp-server/src/main/assembly.xml | 17 ++++++++----- .../src/main/resources/weixin.properties | 1 + 11 files changed, 78 insertions(+), 39 deletions(-) diff --git a/pom.xml b/pom.xml index 2c3bdbaa..ff6246f7 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,31 @@ ${project.build.sourceEncoding} + + org.apache.maven.plugins + maven-jar-plugin + 2.5 + + + default-jar + package + + jar + + + target/classes + + *.properties + *.xml + *.txt + + + false + + + + + diff --git a/weixin4j-base/pom.xml b/weixin4j-base/pom.xml index 9fec1614..eebbbcfb 100644 --- a/weixin4j-base/pom.xml +++ b/weixin4j-base/pom.xml @@ -103,10 +103,5 @@ commons-codec ${commons.codec.version} - - org.jsoup - jsoup - ${jsoup.version} - - + \ No newline at end of file diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/HttpRequest.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/HttpRequest.java index 26b7e062..977351c8 100644 --- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/HttpRequest.java +++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/HttpRequest.java @@ -33,8 +33,6 @@ import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.params.CoreConnectionPNames; import org.apache.http.params.CoreProtocolPNames; import org.apache.http.util.EntityUtils; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; import com.alibaba.fastjson.JSONException; import com.foxinmy.weixin4j.exception.WeixinException; @@ -198,8 +196,7 @@ public class HttpRequest { if (contentType.getValue().contains( ContentType.TEXT_HTML.getMimeType())) { response.setText(new String(data, "gbk")); - Document doc = Jsoup.parse(response.getAsString()); - throw new WeixinException(doc.body().text()); + throw new WeixinException(response.getAsString()); } else if (contentType.getValue().contains( ContentType.APPLICATION_JSON.getMimeType())) { checkJson(response); diff --git a/weixin4j-mp/pom.xml b/weixin4j-mp/pom.xml index c9343387..d3a5ebd0 100644 --- a/weixin4j-mp/pom.xml +++ b/weixin4j-mp/pom.xml @@ -19,6 +19,29 @@ weixin4j-mp + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.5.1 + + + src/main/assembly.xml + + + + + make-assembly + package + + single + + + + + + @@ -27,4 +50,4 @@ ${weixin4j.base.version} - + \ No newline at end of file diff --git a/weixin4j-mp/weixin4j-mp-api/README.md b/weixin4j-mp/weixin4j-mp-api/README.md index ad9e5592..73b7acb6 100644 --- a/weixin4j-mp/weixin4j-mp-api/README.md +++ b/weixin4j-mp/weixin4j-mp-api/README.md @@ -39,7 +39,7 @@ weixin.properties说明 | token_path | 使用FileTokenHolder时token保存的物理路径 | | qr_path | 调用二维码接口时保存二维码图片的物理路径 | | media_path | 调用媒体接口时保存媒体文件的物理路径 | -| bill_path | 调用支付(`V3`)下载对账单接口保存excel文件的物理路径 | +| bill_path | 调用下载对账单接口保存excel文件的物理路径 | | ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件 | 示例(properties中换行用右斜杆\\) @@ -48,12 +48,13 @@ weixin.properties说明 > "token":"开放者的token 非必须","openId":"公众号的openid 非必须", > "mchId":"V3.x版本下的微信商户号", > "partnerId":"财付通的商户号","partnerKey":"财付通商户权限密钥Key", +> "version":"针对微信支付的版本号(2,3),如果不填则按照mchId非空与否来判断", > "paySignKey":"微信支付中调用API的密钥"}
> token_path=/tmp/weixin/token
> qr_path=/tmp/weixin/qr
> media_path=/tmp/weixin/media
> bill_path=/tmp/weixin/bill
-> ca_file=/tmp/weixin/xxxxx.p12
+> ca_file=/tmp/weixin/xxxxx.p12|xxxx.pfx
2.实例化一个`WeixinProxy`对象,调用API,需要强调的是如果只传入appid,appsecret两个参数将无法调用支付相关接口 diff --git a/weixin4j-mp/weixin4j-mp-api/pom.xml b/weixin4j-mp/weixin4j-mp-api/pom.xml index 2325bf6c..49290256 100644 --- a/weixin4j-mp/weixin4j-mp-api/pom.xml +++ b/weixin4j-mp/weixin4j-mp-api/pom.xml @@ -42,5 +42,10 @@ poi-ooxml-schemas ${poi.version} + + org.jsoup + jsoup + ${jsoup.version} + - + \ No newline at end of file diff --git a/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties b/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties index b423ddfe..18671ff5 100644 --- a/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties +++ b/weixin4j-mp/weixin4j-mp-api/src/main/resources/weixin.properties @@ -3,6 +3,7 @@ account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\ "token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\ "mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\ +"version":3,\ "partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key",\ "paySignKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5"} @@ -15,4 +16,4 @@ media_path=/tmp/weixin/media # \u5bf9\u8d26\u5355\u4fdd\u5b58\u8def\u5f84 bill_path=/tmp/weixin/bill # ca\u8bc1\u4e66\u5b58\u653e\u7684\u5b8c\u6574\u8def\u5f84 -ca_file=/Users/jy/Downloads/1221928801.pfx \ No newline at end of file +ca_file=/tmp/weixin/xxxxxx.p12 \ No newline at end of file diff --git a/weixin4j-mp/weixin4j-mp-server/README.md b/weixin4j-mp/weixin4j-mp-server/README.md index 9a575c96..bddb3b5d 100644 --- a/weixin4j-mp/weixin4j-mp-server/README.md +++ b/weixin4j-mp/weixin4j-mp-server/README.md @@ -21,7 +21,7 @@ weixin4j-mp-server | token_path | 使用FileTokenHolder时token保存的物理路径 | | qr_path | 调用二维码接口时保存二维码图片的物理路径 | | media_path | 调用媒体接口时保存媒体文件的物理路径 | -| bill_path | 调用支付(`V3`)下载对账单接口保存excel文件的物理路径 | +| bill_path | 调用下载对账单接口保存excel文件的物理路径 | | ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件 | 示例(properties中换行用右斜杆\\) @@ -30,12 +30,13 @@ weixin4j-mp-server > "token":"开放者的token 非必须","openId":"公众号的openid 非必须", > "mchId":"V3.x版本下的微信商户号", > "partnerId":"财付通的商户号","partnerKey":"财付通商户权限密钥Key", +> "version":"针对微信支付的版本号(目前可能为2,3),如果不填则按照mchId非空与否来做判断", > "paySignKey":"微信支付中调用API的密钥"}
> token_path=/tmp/weixin/token
> qr_path=/tmp/weixin/qr
> media_path=/tmp/weixin/media
> bill_path=/tmp/weixin/bill
-> ca_file=/tmp/weixin/xxxxx.p12
+> ca_file=/tmp/weixin/xxxxx.p12|xxxxx.pfx
2.mvn package,得到一个zip的压缩包,解压到启动目录(见`src/main/startup.sh/APP_HOME`) diff --git a/weixin4j-mp/weixin4j-mp-server/pom.xml b/weixin4j-mp/weixin4j-mp-server/pom.xml index d526216f..12774800 100644 --- a/weixin4j-mp/weixin4j-mp-server/pom.xml +++ b/weixin4j-mp/weixin4j-mp-server/pom.xml @@ -13,28 +13,13 @@ https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp/weixin4j-server 微信公众号服务 + weixin4j-mp-server org.apache.maven.plugins maven-assembly-plugin - 2.2.1 - - - src/main/assembly.xml - - - - - make-assembly - package - - single - - - - weixin4j-mp-server diff --git a/weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml b/weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml index aecfae92..b1181354 100644 --- a/weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml +++ b/weixin4j-mp/weixin4j-mp-server/src/main/assembly.xml @@ -1,4 +1,7 @@ - + bin zip @@ -10,6 +13,12 @@ + + com.foxinmy.weixin4j.mp + + **/*.md + + src/main / @@ -19,12 +28,8 @@ - target/classes + src/main/resources /conf - - *.properties - *.xml - \ No newline at end of file diff --git a/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties b/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties index 2adb3a3c..ba1eb132 100644 --- a/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties +++ b/weixin4j-mp/weixin4j-mp-server/src/main/resources/weixin.properties @@ -2,6 +2,7 @@ account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\ "token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\ "mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\ +"version":3,\ "partnerId":"\u8d22\u4ed8\u901a\u7684\u5546\u6237\u53f7","partnerKey":"\u8d22\u4ed8\u901a\u5546\u6237\u6743\u9650\u5bc6\u94a5Key",\ "paySignKey":"\u5fae\u4fe1\u652f\u4ed8\u4e2d\u8c03\u7528API\u7684\u5bc6\u94a5"}