Files
finance_app/routes/console.php
henry yo 85972f950c feat: 前端分離+功能api化
1. 新增資產管理CRUD、googleOAuth登入
2. 更改原記帳controller
2026-06-25 14:19:07 +08:00

31 lines
836 B
PHP

<?php
use App\Console\Commands\RefreshAllAssetPrices;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;
use App\Jobs\FetchAndParseGmailInvoices;
use App\Models\User;
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');
Schedule::command(RefreshAllAssetPrices::class)
->weekdays()
->at('14:00')
->at('22:00');
Schedule::call(function () {
// 找出所有有綁定 Google Refresh Token 的使用者
$users = User::whereNotNull('google_refresh_token')->get();
foreach ($users as $user) {
// 分別派發非同步任務去排隊抓信,不塞車
FetchAndParseGmailInvoices::dispatch($user);
}
})
->weekdays()
->at('14:00')
->at('22:00');