update md

This commit is contained in:
jinyu 2015-12-01 12:01:39 +08:00
parent 0d7069036b
commit 78995c687f
5 changed files with 54 additions and 20 deletions

View File

@ -13,5 +13,7 @@ weixin4j-base
`HttpClient的实现` `HttpClient的实现`
`微信支付的实现`
[更新LOG](./CHANGE.md) [更新LOG](./CHANGE.md)
--------------------- ---------------------

View File

@ -45,7 +45,7 @@ public class Article implements Serializable {
@JSONCreator @JSONCreator
public Article(@JSONField(name = "title") String title, public Article(@JSONField(name = "title") String title,
@JSONField(name = "description") String desc, @JSONField(name = "desc") String desc,
@JSONField(name = "picUrl") String picUrl, @JSONField(name = "picUrl") String picUrl,
@JSONField(name = "url") String url) { @JSONField(name = "url") String url) {
this.title = title; this.title = title;

View File

@ -56,15 +56,15 @@ weixin4j.properties说明
| 属性名 | 说明 | | 属性名 | 说明 |
| :---------- | :-------------- | | :---------- | :-------------- |
| account | 微信公众号信息 `json格式`(按需填写) | | account | 微信公众号信息 `json格式`(使用new WeixinProxy()缺省构造器时须填写) |
| token_path | 使用FileTokenStorager时token保存的物理路径 | | token_path | 使用FileTokenStorager时token保存的物理路径(非必须填写) |
| qr_path | 调用二维码接口时保存二维码图片的物理路径 | | qr_path | 调用二维码接口时保存二维码图片的物理路径(非必须填写) |
| media_path | 调用媒体接口时保存媒体文件的物理路径 | | media_path | 调用媒体接口时保存媒体文件的物理路径(非必须填写) |
| bill_path | 调用下载对账单接口保存文件的物理路径 | | bill_path | 调用下载对账单接口保存文件的物理路径(非必须填写) |
| ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件 | | ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件(按须填写) |
| user_oauth_redirect_uri | 调用OauthApi接口时需要填写的重定向路径 | | user_oauth_redirect_uri | 调用OauthApi接口时需要填写的重定向路径(非必须填写) |
示例(properties中换行用右斜杆\\) 完整填写示例(properties中换行用右斜杆\\)
account={"id":"appId","secret":"appSecret",\ account={"id":"appId","secret":"appSecret",\
"mchId":"V3.x版本下的微信商户号",\ "mchId":"V3.x版本下的微信商户号",\
@ -85,12 +85,14 @@ weixin4j.properties说明
2.实例化微信企业号接口代理对象,调用具体的API方法 2.实例化微信企业号接口代理对象,调用具体的API方法
// 微信公众号API // 微信公众号API 使用classpath的weixin4j.properties
WeixinProxy weixinProxy = new WeixinProxy(); WeixinProxy weixinProxy = new WeixinProxy();
// 直接传入公众号信息
// weixinProxy = new WeixinProxy(appid,appsecret); // weixinProxy = new WeixinProxy(appid,appsecret);
weixinProxy.getUser(openId); weixinProxy.getUser(openId);
// 微信支付API // 微信支付API 使用classpath的weixin4j.properties
WeixinPayProxy weixinPayProxy = new WeixinPayProxy(); WeixinPayProxy weixinPayProxy = new WeixinPayProxy();
// 直接构造WexinAccount对象
// weixinPayProxy = new WeixinPayProxy(weixinAccount); // weixinPayProxy = new WeixinPayProxy(weixinAccount);
weixinPayProxy.orderQuery(idQuery); weixinPayProxy.orderQuery(idQuery);

View File

@ -50,11 +50,11 @@ weixin4j.properties说明
| 属性名 | 说明 | | 属性名 | 说明 |
| :---------- | :-------------- | | :---------- | :-------------- |
| account | 微信企业号信息 `json格式`(按需填写) | | account | 微信企业号信息 `json格式`(使用new WeixinProxy()缺省构造器时须填写) |
| token_path | 使用FileTokenStorager时token保存的物理路径 | | token_path | 使用FileTokenStorager时token保存的物理路径(非必须填写) |
| media_path | 调用媒体接口时保存媒体文件的物理路径 | | media_path | 调用媒体接口时保存媒体文件的物理路径(非必须填写) |
| bill_path | 调用下载对账单接口保存文件的物理路径 | | bill_path | 调用下载对账单接口保存文件的物理路径(非必须填写) |
| ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件 | | ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件(非必须填写) |
| user_oauth_redirect_uri | 企业号用户身份授权后重定向的url(OauthApi接口) | | user_oauth_redirect_uri | 企业号用户身份授权后重定向的url(OauthApi接口) |
| third_oauth_redirect_uri | 企业号第三方提供商授权后重定向的url(OauthApi接口) | | third_oauth_redirect_uri | 企业号第三方提供商授权后重定向的url(OauthApi接口) |
| suite_oauth_redirect_uri | 企业号第三方应用套件授权后重定向的url(OauthApi接口) | | suite_oauth_redirect_uri | 企业号第三方应用套件授权后重定向的url(OauthApi接口) |
@ -84,12 +84,19 @@ weixin4j.properties说明
2.实例化微信企业号接口代理对象,调用具体的API方法 2.实例化微信企业号接口代理对象,调用具体的API方法
// 微信企业号API // 微信企业号API 使用classpath的weixin4j.properties
WeixinProxy weixinProxy = new WeixinProxy(); WeixinProxy weixinProxy = new WeixinProxy();
// 直接传入企业号信息
// weixinProxy = new WeixinProxy(corpid,corpsecret); // weixinProxy = new WeixinProxy(corpid,corpsecret);
weixinProxy.getUser(userid); weixinProxy.getUser(userid);
// 微信第三方应用API // 微信支付API 使用classpath的weixin4j.properties
WeixinPayProxy weixinPayProxy = new WeixinPayProxy();
// 直接构造WexinAccount对象
// weixinPayProxy = new WeixinPayProxy(weixinAccount);
weixinPayProxy.orderQuery(idQuery);
// 微信第三方应用API 使用classpath的weixin4j.properties
WeixinSuiteProxy weixinSuiteProxy = new WeixinSuiteProxy(); WeixinSuiteProxy weixinSuiteProxy = new WeixinSuiteProxy();
// 直接传入套件信息
//weixinSuiteProxy = new WeixinSuiteProxy(suiteId,suiteSecret); //weixinSuiteProxy = new WeixinSuiteProxy(suiteId,suiteSecret);
weixinSuiteProxy.api().getOAuthInfo(authCorpid); weixinSuiteProxy.api().getOAuthInfo(authCorpid);

View File

@ -38,8 +38,7 @@ public final class ClassUtil {
public static List<Class<?>> getClasses(String packageName) public static List<Class<?>> getClasses(String packageName)
throws RuntimeException { throws RuntimeException {
String packageFileName = packageName.replace(".", File.separator); String packageFileName = packageName.replace(".", File.separator);
URL fullPath = Thread.currentThread().getContextClassLoader() URL fullPath = getDefaultClassLoader().getResource(packageFileName);
.getResource(packageFileName);
String protocol = fullPath.getProtocol(); String protocol = fullPath.getProtocol();
if (protocol.equals(Consts.PROTOCOL_FILE)) { if (protocol.equals(Consts.PROTOCOL_FILE)) {
File dir = new File(fullPath.getPath()); File dir = new File(fullPath.getPath());
@ -180,6 +179,30 @@ public final class ClassUtil {
return clazz; return clazz;
} }
public static ClassLoader getDefaultClassLoader() {
ClassLoader cl = null;
try {
cl = Thread.currentThread().getContextClassLoader();
} catch (Throwable ex) {
// Cannot access thread context ClassLoader - falling back...
}
if (cl == null) {
// No thread context class loader -> use class loader of this class.
cl = ClassUtil.class.getClassLoader();
if (cl == null) {
// getClassLoader() returning null indicates the bootstrap
// ClassLoader
try {
cl = ClassLoader.getSystemClassLoader();
} catch (Throwable ex) {
// Cannot access system ClassLoader - oh well, maybe the
// caller can live with null...
}
}
}
return cl;
}
public static void main(String[] args) { public static void main(String[] args) {
System.err System.err
.println(getClasses(com.foxinmy.weixin4j.handler.WeixinMessageHandler.class .println(getClasses(com.foxinmy.weixin4j.handler.WeixinMessageHandler.class