Commit 4a26711b by patpat

调整离线支付重复限制

parent 22987824
...@@ -81,8 +81,7 @@ public class PayOfflineAction extends Action { ...@@ -81,8 +81,7 @@ public class PayOfflineAction extends Action {
setState(State.FAIL, "请不要重复扫码"); setState(State.FAIL, "请不要重复扫码");
return; return;
} }
mPayCodeHistory.add(payCode); addPayCodeHistory(payCode);
clearTimeoutPayCodeHistory();
try { try {
JSONObject params = new JSONObject(); JSONObject params = new JSONObject();
...@@ -119,8 +118,12 @@ public class PayOfflineAction extends Action { ...@@ -119,8 +118,12 @@ public class PayOfflineAction extends Action {
LogUtil.i(TAG, list.toString()); LogUtil.i(TAG, list.toString());
} }
private void clearTimeoutPayCodeHistory() { public void addPayCodeHistory(String payCode) {
if (mPayCodeHistory.size() > 100) { if (mPayCodeHistory.contains(payCode)) {
mPayCodeHistory.remove(payCode);
}
mPayCodeHistory.add(payCode);
if (mPayCodeHistory.size() > 300) {
mPayCodeHistory.remove(0); mPayCodeHistory.remove(0);
} }
} }
......
...@@ -92,6 +92,7 @@ public class PayOnlineAction extends Action { ...@@ -92,6 +92,7 @@ public class PayOnlineAction extends Action {
setState(State.STARTED, ""); setState(State.STARTED, "");
setActionResult(result); setActionResult(result);
mPayCode = payCode; mPayCode = payCode;
PayOfflineAction.getDefault().addPayCodeHistory(payCode);
mTimeoutId = TimerHelper.INSTANCE.loop(new TimerHelper.LoopTask() { mTimeoutId = TimerHelper.INSTANCE.loop(new TimerHelper.LoopTask() {
@Override @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