Commit 4a26711b by patpat

调整离线支付重复限制

parent 22987824
......@@ -81,8 +81,7 @@ public class PayOfflineAction extends Action {
setState(State.FAIL, "请不要重复扫码");
return;
}
mPayCodeHistory.add(payCode);
clearTimeoutPayCodeHistory();
addPayCodeHistory(payCode);
try {
JSONObject params = new JSONObject();
......@@ -119,8 +118,12 @@ public class PayOfflineAction extends Action {
LogUtil.i(TAG, list.toString());
}
private void clearTimeoutPayCodeHistory() {
if (mPayCodeHistory.size() > 100) {
public void addPayCodeHistory(String payCode) {
if (mPayCodeHistory.contains(payCode)) {
mPayCodeHistory.remove(payCode);
}
mPayCodeHistory.add(payCode);
if (mPayCodeHistory.size() > 300) {
mPayCodeHistory.remove(0);
}
}
......
......@@ -92,6 +92,7 @@ public class PayOnlineAction extends Action {
setState(State.STARTED, "");
setActionResult(result);
mPayCode = payCode;
PayOfflineAction.getDefault().addPayCodeHistory(payCode);
mTimeoutId = TimerHelper.INSTANCE.loop(new TimerHelper.LoopTask() {
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment