diff --git a/app/Admin/Actions/Coupon/RefreshPAOrder.php b/app/Admin/Actions/Coupon/RefreshPAOrder.php index 44e5f1b..299b64f 100644 --- a/app/Admin/Actions/Coupon/RefreshPAOrder.php +++ b/app/Admin/Actions/Coupon/RefreshPAOrder.php @@ -4,6 +4,7 @@ namespace App\Admin\Actions\Coupon; use App\Jobs\CheckCouponByLog; use App\Jobs\CheckCouponLog; +use Carbon\Carbon; use Encore\Admin\Actions\Action; use Illuminate\Http\Request; @@ -13,16 +14,23 @@ class RefreshPAOrder extends Action protected $selector = '.refresh-order'; - public function handle(Request $request) + public function handle(Request $request): \Encore\Admin\Actions\Response { - $table = 'api_log_'.date('Ym'); + $month = $request->month; + $month = Carbon::parse($month)->format('Ym'); + $table = 'api_log_'.$month; CheckCouponLog::dispatch($table); - CheckCouponByLog::dispatch($table); + CheckCouponByLog::dispatch($table)->delay(now()->addMinutes(10));; return $this->response()->success('正在获取数据,请等待片刻后刷新页面查看!')->refresh(); } + public function form() + { + $this->date('month', '月份')->format('YYYY-MM'); + } + public function html() { return <<disableActions(); $grid->tools(function (Grid\Tools $tools) { - $tools->append(new refreshPAOrder());//食物 + $tools->append(new refreshPAOrder());//刷新平安订单id }); $grid->model()