|
|
|
|
@ -44,14 +44,13 @@ class SyncAlipayRechargeState extends Command
|
|
|
|
|
$offset_seconds = 40; //支付发起后多少秒开始轮询
|
|
|
|
|
$due_minutes = 500; //支付发起后第一次开始轮询的时间往后延迟5分钟后不再轮询
|
|
|
|
|
$last_id = cache("last_sync_alipay_recharge_id", 0);
|
|
|
|
|
dump($last_id);
|
|
|
|
|
|
|
|
|
|
DB::enableQueryLog();
|
|
|
|
|
$recharges = (new Recharge())
|
|
|
|
|
->where("id", ">", $last_id)
|
|
|
|
|
->whereNull("paid_at")
|
|
|
|
|
->where("payment", "alipay")
|
|
|
|
|
->whereRaw("UNIX_TIMESTAMP(`created_at`) between " . (time() + $offset_seconds) . " and " . (time() + $due_minutes * 60 + $offset_seconds))
|
|
|
|
|
->whereRaw("(UNIX_TIMESTAMP(`created_at`) between (UNIX_TIMESTAMP(`created_at`) + {$offset_seconds}) and (UNIX_TIMESTAMP(`created_at`) + " . ($due_minutes * 60) . " + {$offset_seconds}))")
|
|
|
|
|
->limit($threshold)
|
|
|
|
|
->get();
|
|
|
|
|
dump(DB::getQueryLog());
|
|
|
|
|
|