Skip to content

merge Develop branch #138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 112 commits into from
Feb 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
2472b7b
Merge pull request #5 from wechat-group/develop
aimilin6688 Oct 25, 2016
8a2e322
Merge pull request #6 from wechat-group/develop
aimilin6688 Nov 24, 2016
a5d582a
Merge branch 'master' into develop
binarywang Dec 1, 2016
f7d0a5d
更改版本号为snapshot版本
binarywang Dec 1, 2016
0d56d6c
Merge pull request #2 from wechat-group/develop
Dec 5, 2016
64619c2
更新注释,明确证书文件对象的含义
binarywang Dec 5, 2016
7a4ca6f
Merge pull request #8 from wechat-group/develop
aimilin6688 Dec 7, 2016
41da9e1
微信订单支付回掉功能完善
aimilin6688 Dec 8, 2016
024878e
Merge pull request #92 from aimilin6688/develop
binarywang Dec 9, 2016
8bb7094
微信支付逻辑修改
aimilin6688 Dec 9, 2016
f7db58a
Merge pull request #93 from aimilin6688/develop
binarywang Dec 9, 2016
80034e5
接口中添加元转分,分转元方法,方便单位转换
aimilin6688 Dec 9, 2016
fd9898e
接口中添加元转分,分转元方法,方便单位转换
aimilin6688 Dec 9, 2016
582ceb9
Merge branch 'develop' of https://github.com/aimilin6688/weixin-java-…
aimilin6688 Dec 9, 2016
79bee7d
Merge pull request #94 from aimilin6688/develop
binarywang Dec 9, 2016
5224f34
reformat code for PayService
binarywang Dec 12, 2016
28e7e45
修复支付配置信息不能重复设置BUG
aimilin6688 Dec 14, 2016
d18e11c
回复版本
aimilin6688 Dec 14, 2016
7babecf
Merge pull request #9 from Wechat-Group/develop
aimilin6688 Dec 14, 2016
95d8723
修复config不能指定Bug
aimilin6688 Dec 14, 2016
5110eb5
Merge pull request #96 from aimilin6688/develop
binarywang Dec 14, 2016
a7c72f6
update
Dec 14, 2016
3e8b1a5
update
Dec 15, 2016
575458d
update
Dec 15, 2016
c0a3259
Merge pull request #97 from johnnytung/develop
binarywang Dec 15, 2016
463b2e3
Merge pull request #3 from Wechat-Group/develop
Dec 15, 2016
b8a9795
修复接口请求重试代码,避免无效等待
binarywang Dec 15, 2016
00421c4
为接口请求增加日志输出
binarywang Dec 15, 2016
242ccc2
Merge branch 'master' into develop
binarywang Dec 15, 2016
84a79a9
".equals()" should not be used to test the values of "Atomic" classes
binarywang Dec 15, 2016
761c570
消灭不规范代码(由sonatype检测出来的)
binarywang Dec 15, 2016
1524de2
消灭不规范代码(由sonatype检测出来的)
binarywang Dec 15, 2016
4812697
消灭不规范代码(由sonatype检测出来的)
binarywang Dec 15, 2016
52221e7
优化属性命名。
Dec 16, 2016
a2106d3
优化属性命名。
Dec 16, 2016
5acee3d
Merge pull request #99 from johnnytung/develop
binarywang Dec 16, 2016
12329d0
Update .travis.yml
binarywang Dec 16, 2016
e4b37f9
Update .travis.yml
binarywang Dec 16, 2016
4758440
Update .travis.yml
binarywang Dec 16, 2016
dc821ff
Merge pull request #10 from Wechat-Group/develop
aimilin6688 Dec 16, 2016
02679bb
微信支付相关接口优化,支持自定义参数信息,不在默认使用配置信息
aimilin6688 Dec 16, 2016
b2d1a76
Merge pull request #100 from aimilin6688/develop
binarywang Dec 19, 2016
da5fe8b
ignore sonar files
binarywang Dec 19, 2016
a5b123f
Merge branch 'master' into develop
binarywang Dec 19, 2016
d18921b
release 2.4.4-beta
binarywang Dec 19, 2016
515ef7c
增加贡献者信息
binarywang Dec 19, 2016
f221ea3
公众平台增加群发接口对原创校验逻辑的支持
binarywang Dec 20, 2016
dc33436
reformat some code
binarywang Dec 20, 2016
9246243
fix test code
binarywang Dec 20, 2016
637fc87
为WxMenuButton和WxMenuRule添加序列化支持
binarywang Dec 23, 2016
c70bf9b
生成带参数的二维码时加入场景值的校验 #106
binarywang Dec 23, 2016
55c6ea5
release 2.4.5.BETA
binarywang Dec 23, 2016
f2858c4
优化发送红包接口
binarywang Dec 23, 2016
4f74b64
Merge branch 'develop' of https://github.com/dengerYang/weixin-java-t…
Dec 25, 2016
ec0d174
在原来的基础上创建更简洁的调用红包接口,请在这之前初始化配置中的SslContext,新增SslContext的get|set方法,方便s…
Dec 25, 2016
8627684
Merge pull request #107 from dengerYang/develop
binarywang Dec 26, 2016
38d817c
修正代码格式,并移除不必要的多余代码 #107
binarywang Dec 26, 2016
ab85c5b
Merge branch 'master' into develop
binarywang Dec 26, 2016
76f4e0b
release 2.4.6.BETA
binarywang Dec 26, 2016
87770f4
fix some javadoc warnings
binarywang Dec 26, 2016
cb67120
修正微信设备授权接口参数字段缺失
dracupid Dec 26, 2016
73a226b
Merge pull request #109 from dracupid/develop
binarywang Dec 26, 2016
7363574
Merge branch 'master' into develop
binarywang Dec 28, 2016
013da38
测试配置中增加证书文件路径的设置
binarywang Dec 29, 2016
a638189
测试配置中增加证书文件路径的设置
binarywang Dec 29, 2016
22723f9
完善查询退款接口,并重构部分支付接口的实现,简化代码
binarywang Dec 29, 2016
96d4597
release 2.4.7.BETA
binarywang Dec 29, 2016
0350182
oauth2认证接口返回值中添加openid
Dec 7, 2016
017e6bb
Merge pull request #112 from withinthefog/openid
binarywang Dec 30, 2016
2361665
Merge branch 'master' into develop
binarywang Dec 31, 2016
2e3a33a
修复变量名,保持跟set方法统一
binarywang Jan 3, 2017
b804400
Merge branch 'master' into develop
binarywang Jan 3, 2017
70af494
Merge branch 'master' into develop
binarywang Jan 3, 2017
c47b8ec
修复toMap方法的bug,并加入单元测试代码
binarywang Jan 4, 2017
cbf7811
完成订单查询结果对象中coupon的组装逻辑代码,并加入单元测试
binarywang Jan 5, 2017
55d66ac
优化重构部分支付相关代码
binarywang Jan 5, 2017
8500368
Merge branch 'master' into develop
binarywang Jan 5, 2017
2d072e9
重构简化方法命名
binarywang Jan 5, 2017
c142daa
添加扫码支付生成二维码的接口及其单元测试,#113
binarywang Jan 6, 2017
c02b2e2
release 2.4.8.BETA
binarywang Jan 6, 2017
81159c2
将发布模块配置改为关闭后自动发布
binarywang Jan 6, 2017
1313658
支持微信接收硬件设备消息的OpenID字段
lijunkun1988 Jan 7, 2017
0e8df66
Merge pull request #118 from lijunkun1988/patch-1
binarywang Jan 7, 2017
fa7360d
实现微信支付交易保障的接口 #56
binarywang Jan 8, 2017
245bec7
引入配置方法,使得微信支付能够支持仿真测试环境 #119
binarywang Jan 9, 2017
eeb0452
优化调整pom文件,将jedis单独移入cp中
binarywang Jan 9, 2017
b1f3b71
修正带参数的二维码接口相关文档注释,并加入对有效期的判断
binarywang Jan 9, 2017
c5bf83c
rename file
binarywang Jan 9, 2017
b9908af
rename file
binarywang Jan 9, 2017
5d30aa3
rename file
binarywang Jan 9, 2017
ab3b224
rename file
binarywang Jan 9, 2017
9e0fcb3
引入配置方法,使得微信支付能够支持仿真测试环境 #119
binarywang Jan 9, 2017
4264eb2
Merge branch 'master' into develop
binarywang Jan 10, 2017
8e831ac
群发消息增加isSendAll属性及相关方法,用于显式指定是否群发消息至所有用户
binarywang Jan 11, 2017
e640b05
单元测试中暂时屏蔽掉沙箱测试环境
binarywang Jan 12, 2017
c844165
完善补充字段注释
binarywang Jan 12, 2017
a2398dd
修复方法
binarywang Jan 12, 2017
e97c15b
实现微信支付下载对账单的接口,还未完成,待调试 #65
binarywang Jan 12, 2017
69aaa74
修复menuTryMatch方法,请求方式由get变更为post,#125
binarywang Jan 16, 2017
41d5966
修复删除个性化菜单的接口 #127
binarywang Jan 17, 2017
d81a5e3
简化代码
binarywang Jan 17, 2017
5018c31
修复完善菜单特别是个性化菜单的创建和删除相关代码
binarywang Jan 17, 2017
39c7f7c
改造查询菜单接口,以支持个性化菜单的conditionalmenu和menuid属性, #126
binarywang Jan 17, 2017
3a87bda
release 2.4.9.BETA
binarywang Jan 17, 2017
1f110dc
修改WxJsapiSignature对象
Jan 22, 2017
89a92c2
修改WxJsapiSignature对象,属性名字大小写与微信一致
Jan 22, 2017
5f3623a
Merge pull request #134 from lly835/develop
binarywang Jan 23, 2017
123eb50
重构测试类的包结构
binarywang Jan 23, 2017
ff1b69a
使用IDEA统一格式化测试代码
binarywang Jan 23, 2017
6c9afe8
修复WxMenuRule一个变态属性的问题 #136
binarywang Feb 9, 2017
a5682cd
更改版本号为2.5.0,准备发布新的正式版
binarywang Feb 12, 2017
111e5fb
Merge branch 'master' into develop
binarywang Feb 12, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
修复接口请求重试代码,避免无效等待
  • Loading branch information
binarywang committed Dec 15, 2016
commit b8a9795cf5a67711ec77c56798e296a9b3a1fa4f
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,20 @@ public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) thro
try {
return executeInternal(executor, uri, data);
} catch (WxErrorException e) {
if (retryTimes + 1 > this.maxRetryTimes) {
this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
//最后一次重试失败后,直接抛出异常,不再等待
throw new RuntimeException("微信服务端异常,超出重试次数");
}

WxError error = e.getError();
/*
* -1 系统繁忙, 1000ms后重试
*/
if (error.getErrorCode() == -1) {
int sleepMillis = this.retrySleepMillis * (1 << retryTimes);
try {
this.log.debug("微信系统繁忙,{}ms 后重试(第{}次)", sleepMillis,
retryTimes + 1);
this.log.debug("微信系统繁忙,{} ms 后重试(第{}次)", sleepMillis, retryTimes + 1);
Thread.sleep(sleepMillis);
} catch (InterruptedException e1) {
throw new RuntimeException(e1);
Expand All @@ -557,8 +562,9 @@ public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) thro
throw e;
}
}
} while (++retryTimes < this.maxRetryTimes);
} while (retryTimes++ < this.maxRetryTimes);

this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
throw new RuntimeException("微信服务端异常,超出重试次数");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package me.chanjar.weixin.cp.api;

import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;

@Test
public class WxCpBusyRetryTest {

Expand All @@ -23,6 +22,7 @@ public Object[][] getService() {
protected synchronized <T, E> T executeInternal(
RequestExecutor<T, E> executor, String uri, E data)
throws WxErrorException {
this.log.info("Executed");
WxError error = new WxError();
error.setErrorCode(-1);
throw new WxErrorException(error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,18 @@ public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) thro
this.log.debug("\n[URL]: {}\n[PARAMS]: {}\n[RESPONSE]: {}",uri, data, result);
return result;
} catch (WxErrorException e) {
if (retryTimes + 1 > this.maxRetryTimes) {
this.log.warn("重试达到最大次数【{}】", maxRetryTimes);
//最后一次重试失败后,直接抛出异常,不再等待
throw new RuntimeException("微信服务端异常,超出重试次数");
}

WxError error = e.getError();
// -1 系统繁忙, 1000ms后重试
if (error.getErrorCode() == -1) {
int sleepMillis = this.retrySleepMillis * (1 << retryTimes);
try {
this.log.debug("微信系统繁忙,{}ms 后重试(第{}次)", sleepMillis, retryTimes + 1);
this.log.warn("微信系统繁忙,{} ms 后重试(第{}次)", sleepMillis, retryTimes + 1);
Thread.sleep(sleepMillis);
} catch (InterruptedException e1) {
throw new RuntimeException(e1);
Expand All @@ -383,8 +389,9 @@ public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) thro
throw e;
}
}
} while (++retryTimes < this.maxRetryTimes);
} while (retryTimes++ < this.maxRetryTimes);

this.log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
throw new RuntimeException("微信服务端异常,超出重试次数");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package me.chanjar.weixin.mp.api;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

@Test
public class WxMpBusyRetryTest {
Expand All @@ -24,6 +23,7 @@ public Object[][] getService() {
protected synchronized <T, E> T executeInternal(
RequestExecutor<T, E> executor, String uri, E data)
throws WxErrorException {
this.log.info("Executed");
WxError error = new WxError();
error.setErrorCode(-1);
throw new WxErrorException(error);
Expand All @@ -32,9 +32,7 @@ protected synchronized <T, E> T executeInternal(

service.setMaxRetryTimes(3);
service.setRetrySleepMillis(500);
return new Object[][] {
new Object[] { service }
};
return new Object[][] { { service } };
}

@Test(dataProvider = "getService", expectedExceptions = RuntimeException.class)
Expand Down