Serve dashboard stats from daily_stats and default visit list to today.

Stop live-scanning page_visits on every dashboard load (including today) so the admin home stays fast; keep the live path only for channel filters and cache the result for 45s.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
root
2026-10-11 09:46:38 +00:00
parent 11caef98fc
commit fcbc479c2e
9 changed files with 550 additions and 76 deletions
@@ -4,12 +4,12 @@ namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Concerns\PortalAware;
use App\Http\Controllers\Controller;
use App\Models\DsChainLog;
use App\Models\Device;
use App\Models\DsChainLog;
use App\Models\PageVisit;
use App\Models\User;
use App\Support\CfIpCountry;
use App\Support\AgentScope;
use App\Support\CfIpCountry;
use Carbon\Carbon;
use Illuminate\Http\Request;
@@ -154,7 +154,7 @@ class PageVisitController extends Controller
$q->where('referer', 'like', '%'.$referer.'%');
}
[$from, $to] = $this->rangeBounds((string) $request->query('range', '30d'));
[$from, $to] = $this->rangeBounds((string) $request->query('range', 'today'));
$q->whereBetween('created_at', [$from, $to]);
return $q;