weizong song 5 years ago
parent 492023e02d
commit 4ffe14b68f

@ -42,7 +42,7 @@ class SyncAlipayRechargeState extends Command
{ {
$threshold = 5; $threshold = 5;
$offset_seconds = 40; //支付发起后多少秒开始轮询 $offset_seconds = 40; //支付发起后多少秒开始轮询
$due_minutes = 101; //支付发起后第一次开始轮询的时间往后延迟5分钟后不再轮询 $due_minutes = 110; //支付发起后第一次开始轮询的时间往后延迟5分钟后不再轮询
$last_id = cache("last_sync_alipay_recharge_id", 0); $last_id = cache("last_sync_alipay_recharge_id", 0);
DB::enableQueryLog(); DB::enableQueryLog();
@ -53,8 +53,6 @@ class SyncAlipayRechargeState extends Command
->whereRaw("(" . time() . " between (UNIX_TIMESTAMP(`created_at`) + {$offset_seconds}) and (UNIX_TIMESTAMP(`created_at`) + " . ($due_minutes * 60) . " + {$offset_seconds}))") ->whereRaw("(" . time() . " between (UNIX_TIMESTAMP(`created_at`) + {$offset_seconds}) and (UNIX_TIMESTAMP(`created_at`) + " . ($due_minutes * 60) . " + {$offset_seconds}))")
->limit($threshold) ->limit($threshold)
->get(); ->get();
dump(DB::getQueryLog());
dd($recharges);
if (!$recharges->count()) { if (!$recharges->count()) {
cache(['last_sync_alipay_recharge_id' => null], now()->addSeconds(90)); cache(['last_sync_alipay_recharge_id' => null], now()->addSeconds(90));
echo "nothing"; echo "nothing";

@ -50,7 +50,7 @@ class SyncWeixinRechargeState extends Command
->where("id", ">", $last_id) ->where("id", ">", $last_id)
->whereNull("paid_at") ->whereNull("paid_at")
->where("payment", "weixin") ->where("payment", "weixin")
->whereRaw("UNIX_TIMESTAMP(`created_at`) between " . (time() + $offset_seconds) . " and " . (time() + $due_minutes * 60 + $offset_seconds)) ->whereRaw("(" . time() . " between (UNIX_TIMESTAMP(`created_at`) + {$offset_seconds}) and (UNIX_TIMESTAMP(`created_at`) + " . ($due_minutes * 60) . " + {$offset_seconds}))")
->limit($threshold) ->limit($threshold)
->get(); ->get();
if (!$recharges->count()) { if (!$recharges->count()) {

Loading…
Cancel
Save