update md

This commit is contained in:
jy.hu 2014-11-06 10:48:20 +08:00
parent 20d021ceff
commit e6b60a4304
9 changed files with 42 additions and 28 deletions

View File

@ -383,7 +383,6 @@
<desc>ORDERPAID</desc> <desc>ORDERPAID</desc>
<text>订单已支付</text> <text>订单已支付</text>
</error> </error>
<error> <error>
<code>OUT_TRADE_NO_USED</code> <code>OUT_TRADE_NO_USED</code>
<desc>OUT_TRADE_NO_USED</desc> <desc>OUT_TRADE_NO_USED</desc>

View File

@ -26,14 +26,6 @@ public abstract class AbstractTokenHolder implements TokenHolder {
this.weixinConfig = new WeixinConfig(appid, appsecret); this.weixinConfig = new WeixinConfig(appid, appsecret);
} }
protected String getAppid() {
return this.weixinConfig.getAppId();
}
protected String getAppsecret() {
return this.weixinConfig.getAppSecret();
}
public WeixinConfig getConfig() { public WeixinConfig getConfig() {
return this.weixinConfig; return this.weixinConfig;
} }

View File

@ -50,8 +50,8 @@ public class FileTokenHolder extends AbstractTokenHolder {
*/ */
@Override @Override
public Token getToken() throws WeixinException { public Token getToken() throws WeixinException {
String appid = getAppid(); String appid = getConfig().getAppId();
String appsecret = getAppsecret(); String appsecret = getConfig().getAppSecret();
if (StringUtils.isBlank(appid) || StringUtils.isBlank(appsecret)) { if (StringUtils.isBlank(appid) || StringUtils.isBlank(appsecret)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"appid or appsecret not be null!"); "appid or appsecret not be null!");

View File

@ -48,8 +48,8 @@ public class RedisTokenHolder extends AbstractTokenHolder {
@Override @Override
public Token getToken() throws WeixinException { public Token getToken() throws WeixinException {
String appid = getAppid(); String appid = getConfig().getAppId();
String appsecret = getAppsecret(); String appsecret = getConfig().getAppSecret();
if (StringUtils.isBlank(appid) || StringUtils.isBlank(appsecret)) { if (StringUtils.isBlank(appid) || StringUtils.isBlank(appsecret)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"appid or appsecret not be null!"); "appid or appsecret not be null!");

View File

@ -34,7 +34,7 @@ weixin4j-mp
------- -------
* 2014-10-27 * 2014-10-27
+ 用netty构建http服务器并支持消息分发 + 用netty构建http服务器&消息分发
* 2014-10-28 * 2014-10-28
@ -42,7 +42,7 @@ weixin4j-mp
* 2014-10-31 * 2014-10-31
+ `weixin.properties`切分为API调用地址/公众号信息两部分 + `weixin.properties`切分为API调用地址和公众号appid等信息两部分
* 2014-11-03 * 2014-11-03

View File

@ -1,7 +1,7 @@
weixin4j-mp-api weixin4j-mp-api
=============== ===============
微信[公众平台](http://mp.weixin.qq.com/wiki)开发工具包 [微信公众平台](http://mp.weixin.qq.com/wiki)开发工具包
功能列表 功能列表
------- -------
@ -40,7 +40,7 @@ weixin.properties说明
| media_path | 调用媒体接口时保存媒体文件的物理路径 | | media_path | 调用媒体接口时保存媒体文件的物理路径 |
| bill_path | 调用支付(`V3`)下载对账单接口保存excel文件的物理路径 | | bill_path | 调用支付(`V3`)下载对账单接口保存excel文件的物理路径 |
示例 示例(properties中换行用右斜杆\)
> account={"appId":"appId","appSecret":"appSecret", > account={"appId":"appId","appSecret":"appSecret",
> "token":"开放者的token 非必须","openId":"公众号的openid 非必须", > "token":"开放者的token 非必须","openId":"公众号的openid 非必须",
@ -58,7 +58,7 @@ weixin.properties说明
// weixinProxy = new WeixinProxy(appid,appsecret); // weixinProxy = new WeixinProxy(appid,appsecret);
weixinProxy.getUser(openId); weixinProxy.getUser(openId);
3.针对`token`存储有两种方案,`File存储`/`Redis存储`,当然也可自己实现`TokenHolder`(继承`AbstractTokenHolder`并重写`getToken`方法),默认使用文件(xml)的方式保存token,如果环境中支持`redis`,建议使用`RedisTokenHolder`. 3.针对`token`存储有两种方案,`File存储`/`Redis存储`,当然也可自己实现`TokenHolder`(继承`AbstractTokenHolder`并重写`getToken`方法),默认使用文件(xml)的方式保存token,如果环境中支持`redis`,建议使用`RedisTokenHolder`.
WeixinProxy weixinProxy = new WeixinProxy(new RedisTokenHolder()); WeixinProxy weixinProxy = new WeixinProxy(new RedisTokenHolder());
// weixinProxy = new WeixinProxy(new RedisTokenHolder(appid,appsecret)); // weixinProxy = new WeixinProxy(new RedisTokenHolder(appid,appsecret));
@ -69,7 +69,7 @@ weixin.properties说明
------- -------
* 2014-10-27 * 2014-10-27
+ 用netty构建http服务器并支持消息分发 + 用netty构建http服务器&消息分发
* 2014-10-28 * 2014-10-28
@ -77,7 +77,7 @@ weixin.properties说明
* 2014-10-31 * 2014-10-31
+ `weixin.properties`切分为API调用地址/公众号信息两部分 + `weixin.properties`切分为API调用地址和公众号appid等信息两部分
* 2014-11-03 * 2014-11-03

View File

@ -1 +1,5 @@
支付模块【JSP AY】【NATIVE PAY】【APP PAY】 支付模块【JSAPI】【NATIVE】
微信公众平台[V2版本支付]文档(https://mp.weixin.qq.com/paymch/readtemplate?t=mp/business/course2_tmpl&lang=zh_CN&token=6056275)
微信公众平台[V3版本支付]文档(https://mp.weixin.qq.com/paymch/readtemplate?t=mp/business/course3_tmpl&lang=zh_CN&token=6056275)
**在`2014年10月9号`之前申请并审核通过的支付接口应该属于`V2版本`支付,而之后申请的接口则为`V3版本`支付**

View File

@ -31,13 +31,14 @@ import com.thoughtworks.xstream.mapper.Mapper;
*/ */
public class RefundConverter { public class RefundConverter {
private final static XStream xStream = XStream.get(); private final static XStream xStream = XStream.get();
private final ReflectionConverter reflectionConverter; private final Mapper mapper;
private final ReflectionProvider reflectionProvider;
public RefundConverter() { public RefundConverter() {
xStream.processAnnotations(Refund.class); xStream.processAnnotations(Refund.class);
xStream.registerConverter(new RefundConverter.$()); xStream.registerConverter(new RefundConverter.$());
reflectionConverter = new ReflectionConverter(xStream.getMapper(), this.mapper = xStream.getMapper();
xStream.getReflectionProvider()); this.reflectionProvider = xStream.getReflectionProvider();
} }
public String toXML(Refund refund) { public String toXML(Refund refund) {
@ -57,7 +58,8 @@ public class RefundConverter {
@Override @Override
public void marshal(Object source, HierarchicalStreamWriter writer, public void marshal(Object source, HierarchicalStreamWriter writer,
MarshallingContext context) { MarshallingContext context) {
reflectionConverter.marshal(source, writer, context); new ReflectionConverter(mapper, reflectionProvider).marshal(source,
writer, context);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -65,9 +67,6 @@ public class RefundConverter {
public Object unmarshal(HierarchicalStreamReader reader, public Object unmarshal(HierarchicalStreamReader reader,
UnmarshallingContext context) { UnmarshallingContext context) {
Refund refund = new Refund(); Refund refund = new Refund();
Mapper mapper = xStream.getMapper();
ReflectionProvider reflectionProvider = xStream
.getReflectionProvider();
Pattern pattern = Pattern.compile("(_\\d)$"); Pattern pattern = Pattern.compile("(_\\d)$");
Matcher matcher = null; Matcher matcher = null;
Map<String, Map<String, String>> outMap = new HashMap<String, Map<String, String>>(); Map<String, Map<String, String>> outMap = new HashMap<String, Map<String, String>>();

View File

@ -15,6 +15,26 @@ weixin4j-mp-server
-------- --------
1.正确填写`weixin.properties`中的属性值 1.正确填写`weixin.properties`中的属性值
| 属性名 | 说明 |
| :---------- | :-------------- |
| account | 微信公众号信息 `json格式` |
| token_path | 使用FileTokenHolder时token保存的物理路径 |
| qr_path | 调用二维码接口时保存二维码图片的物理路径 |
| media_path | 调用媒体接口时保存媒体文件的物理路径 |
| bill_path | 调用支付(`V3`)下载对账单接口保存excel文件的物理路径 |
示例(properties中换行用右斜杆\)
> account={"appId":"appId","appSecret":"appSecret",
> "token":"开放者的token 非必须","openId":"公众号的openid 非必须",
> "mchId":"V3.x版本下的微信商户号",
> "partnerId":"财付通的商户号","partnerKey":"财付通商户权限密钥Key",
> "paySignKey":"微信支付中调用API的密钥"} <br/>
> token_path=/tmp/weixin/token <br/>
> qr_path=/tmp/weixin/qr <br/>
> media_path=/tmp/weixin/media <br/>
> bill_path=/tmp/weixin/bill <br/>
2.mvn package,得到一个zip的压缩包,解压到启动目录(见`src/main/startup.sh/APP_HOME`) 2.mvn package,得到一个zip的压缩包,解压到启动目录(见`src/main/startup.sh/APP_HOME`)
3.启动netty服务(`com.foxinmy.weixin4j.mp.startup.WeixinServiceBootstrap`) 3.启动netty服务(`com.foxinmy.weixin4j.mp.startup.WeixinServiceBootstrap`)