【特大注意】weixin4j.properties全部的属性名添加weixin4j前缀,并用.代替原来的_
This commit is contained in:
@@ -132,6 +132,8 @@
|
||||
+【重要】第三方应用授权时获取永久授权码覆盖问题。
|
||||
|
||||
|
||||
* 2015-12-08
|
||||
* 2015-12-10
|
||||
|
||||
+ version upgrade to 1.6.4
|
||||
|
||||
+ 【特大注意】weixin4j.properties全部的属性名添加`weixin4j`前缀,并用`.`代替原来的`_`
|
||||
|
||||
+18
-18
@@ -37,7 +37,7 @@ weixin4j-qy
|
||||
|
||||
如何使用
|
||||
--------
|
||||
0.maven依赖(1.6.4,2015-12-08 released)
|
||||
0.maven依赖(1.6.4,2015-12-10 released)
|
||||
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
@@ -50,37 +50,37 @@ weixin4j.properties说明
|
||||
|
||||
| 属性名 | 说明 |
|
||||
| :---------- | :-------------- |
|
||||
| account | 微信企业号信息 `json格式`(使用new WeixinProxy()缺省构造器时须填写) |
|
||||
| token_path | 使用FileTokenStorager时token保存的物理路径(非必须填写) |
|
||||
| media_path | 调用媒体接口时保存媒体文件的物理路径(非必须填写) |
|
||||
| bill_path | 调用下载对账单接口保存文件的物理路径(非必须填写) |
|
||||
| ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件(非必须填写) |
|
||||
| user_oauth_redirect_uri | 企业号用户身份授权后重定向的url(OauthApi接口) |
|
||||
| third_oauth_redirect_uri | 企业号第三方提供商授权后重定向的url(OauthApi接口) |
|
||||
| suite_oauth_redirect_uri | 企业号第三方应用套件授权后重定向的url(OauthApi接口) |
|
||||
| weixin4j.account | 微信企业号信息 `json格式`(使用new WeixinProxy()缺省构造器时须填写) |
|
||||
| weixin4j.token.path | 使用FileTokenStorager时token保存的物理路径(非必须填写) |
|
||||
| weixin4j.media.path | 调用媒体接口时保存媒体文件的物理路径(非必须填写) |
|
||||
| weixin4j.bill.path | 调用下载对账单接口保存文件的物理路径(非必须填写) |
|
||||
| weixin4j.certificate.file | 调用某些接口(支付相关)强制需要auth的ca授权文件(非必须填写) |
|
||||
| weixin4j.user.oauth.redirect.uri | 企业号用户身份授权后重定向的url(OauthApi接口) |
|
||||
| weixin4j.third.oauth.redirect.uri | 企业号第三方提供商授权后重定向的url(OauthApi接口) |
|
||||
| weixin4j.suite.oauth.redirect.uri | 企业号第三方应用套件授权后重定向的url(OauthApi接口) |
|
||||
|
||||
示例(properties中换行用右斜杆\\)
|
||||
|
||||
account={"id":"corpid","secret":"corpsecret",\
|
||||
weixin4j.account={"id":"corpid","secret":"corpsecret",\
|
||||
"suites":[{"id":"应用套件的id","secret":"应用套件的secret"}],\
|
||||
"providerSecret:"第三方提供商secret(企业号登陆)",\
|
||||
"chatSecret":"消息服务secret(企业号消息服务,暂时没用到)"}
|
||||
|
||||
token_path=/tmp/weixin4j/token
|
||||
media_path=/tmp/weixin4j/media
|
||||
bill_path=/tmp/weixin4j/bill
|
||||
weixin4j.token.path=/tmp/weixin4j/token
|
||||
weixin4j.media.path=/tmp/weixin4j/media
|
||||
weixin4j.bill.path=/tmp/weixin4j/bill
|
||||
# ca证书存放的完整路径 (证书文件后缀为*.p12)
|
||||
ca_file=/tmp/weixin4j/xxxxx.p12
|
||||
#classpath路径下:ca_file=classpath:xxxxx.p12
|
||||
weixin4j.certificate.file=/tmp/weixin4j/xxxxx.p12
|
||||
#classpath路径下:weixin4j.certificate.file=classpath:xxxxx.p12
|
||||
|
||||
#企业号用户身份授权后重定向的url(使用OauthApi时需要填写)
|
||||
user_oauth_redirect_uri=http://xxx
|
||||
weixin4j.user.oauth.redirect.uri=http://xxx
|
||||
|
||||
#企业号第三方管理员授权后重定向的url(使用OauthApi时需要填写)
|
||||
third_oauth_redirect_uri=http://xxx
|
||||
weixin4j.third.oauth.redirect.uri=http://xxx
|
||||
|
||||
#企业号第三方应用套件授权后重定向的url(使用OauthApi时需要填写)
|
||||
suite_oauth_redirect_uri=http://xxx
|
||||
weixin4j.suite.oauth.redirect.uri=http://xxx
|
||||
|
||||
2.实例化微信企业号接口代理对象,调用具体的API方法
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ public class MediaApi extends QyApi {
|
||||
*/
|
||||
public File downloadMediaFile(int agentid, String mediaId)
|
||||
throws WeixinException {
|
||||
String media_path = Weixin4jConfigUtil.getValue("media_path",
|
||||
String media_path = Weixin4jConfigUtil.getValue("media.path",
|
||||
Weixin4jConst.DEFAULT_MEDIA_PATH);
|
||||
final String prefixName = String.format("%d_%s.", agentid, mediaId);
|
||||
File[] files = new File(media_path).listFiles(new FilenameFilter() {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class OauthApi extends QyApi {
|
||||
*/
|
||||
public String getUserAuthorizeURL() {
|
||||
String corpId = DEFAULT_WEIXIN_ACCOUNT.getId();
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("user_oauth_redirect_uri");
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("user.oauth.redirect.uri");
|
||||
return getUserAuthorizeURL(corpId, redirectUri, "state");
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class OauthApi extends QyApi {
|
||||
*/
|
||||
public String getThirdAuthorizeURL() {
|
||||
String corpId = DEFAULT_WEIXIN_ACCOUNT.getId();
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("third_oauth_redirect_uri");
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("third.oauth.redirect.uri");
|
||||
return getThirdAuthorizeURL(corpId, redirectUri, "state");
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class OauthApi extends QyApi {
|
||||
* @return
|
||||
*/
|
||||
public String getSuiteAuthorizeURL(String suiteId, String preAuthCode) {
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("suite_oauth_redirect_uri");
|
||||
String redirectUri = Weixin4jConfigUtil.getValue("suite.oauth.redirect.uri");
|
||||
return getSuiteAuthorizeURL(suiteId, preAuthCode, redirectUri, "state");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
# \u6d4b\u8bd5\u4e4b\u7528 \u6b63\u5f0f\u73af\u5883\u4e0bcopy\u4e00\u4efd\u5230classpath
|
||||
# \u4f01\u4e1a\u53f7\u4fe1\u606f
|
||||
account={"id":"id","secret":"secret",\
|
||||
weixin4j.account={"id":"id","secret":"secret",\
|
||||
"suites":[{"id":"\u5e94\u7528\u5957\u4ef6\u7684id","secret":"\u5e94\u7528\u5957\u4ef6\u7684secret"}],\
|
||||
"providerSecret":"\u7b2c\u4e09\u65b9\u63d0\u4f9b\u5546secret(\u4f01\u4e1a\u53f7\u767b\u9646)",\
|
||||
"chatSecret":"\u6d88\u606f\u670d\u52a1secret(\u4f01\u4e1a\u53f7\u6d88\u606f\u670d\u52a1,\u6682\u65f6\u6ca1\u7528\u5230)"}
|
||||
|
||||
# \u4f7f\u7528FileTokenStorager\u65f6token\u7684\u5b58\u653e\u8def\u5f84
|
||||
token_path=/tmp/weixin4j/token
|
||||
weixin4j.token.path=/tmp/weixin4j/token
|
||||
# \u5a92\u4f53\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84
|
||||
media_path=/tmp/weixin4j/media
|
||||
weixin4j.media.path=/tmp/weixin4j/media
|
||||
# \u5bf9\u8d26\u5355\u4fdd\u5b58\u8def\u5f84
|
||||
bill_path=/tmp/weixin4j/bill
|
||||
weixin4j.bill.path=/tmp/weixin4j/bill
|
||||
# ca\u8bc1\u4e66\u5b58\u653e\u7684\u5b8c\u6574\u8def\u5f84 (V2\u7248\u672c\u540e\u7f00\u4e3a*.pfx,V3\u7248\u672c\u540e\u7f00\u4e3a*.p12)
|
||||
ca_file=/tmp/weixin4j/xxxxx.p12
|
||||
weixin4j.certificate.file=/tmp/weixin4j/xxxxx.p12
|
||||
# classpath\u8def\u5f84\u4e0b\u53ef\u4ee5\u8fd9\u4e48\u5199
|
||||
# ca_file=classpath:xxxxx.pfx
|
||||
# weixin4j.certificate.file=classpath:xxxxx.pfx
|
||||
|
||||
# \u4f01\u4e1a\u53f7\u7528\u6237\u8eab\u4efd\u6388\u6743\u540e\u91cd\u5b9a\u5411\u7684url
|
||||
user_oauth_redirect_uri=
|
||||
weixin4j.user.oauth.redirect.uri=
|
||||
|
||||
# \u4f01\u4e1a\u53f7\u7b2c\u4e09\u65b9\u63d0\u4f9b\u5546\u6388\u6743\u540e\u91cd\u5b9a\u5411\u7684url
|
||||
third_oauth_redirect_uri=
|
||||
weixin4j.third.oauth.redirect.uri=
|
||||
|
||||
# \u4f01\u4e1a\u53f7\u7b2c\u4e09\u65b9\u5e94\u7528\u5957\u4ef6\u6388\u6743\u540e\u91cd\u5b9a\u5411\u7684url
|
||||
suite_oauth_redirect_uri=
|
||||
weixin4j.suite.oauth.redirect.uri=
|
||||
@@ -48,7 +48,7 @@ public class MenuTest extends TokenTest {
|
||||
|
||||
@Test
|
||||
public void get() throws WeixinException {
|
||||
btnList = menuApi.getMenu(1);
|
||||
btnList = menuApi.getMenu(0);
|
||||
for (Button btn : btnList) {
|
||||
System.out.println(btn);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TokenTest {
|
||||
tokenHolder = new TokenHolder(new WeixinTokenCreator(
|
||||
weixinAccount.getId(), weixinAccount.getSecret()),
|
||||
new FileTokenStorager(Weixin4jConfigUtil.getValue(
|
||||
"token_path", "/tmp/weixin4j/token")));
|
||||
"token.path", "/tmp/weixin4j/token")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user