fix: link old

This commit is contained in:
hashbro
2026-09-14 01:09:01 +08:00
parent b49755c900
commit d5ae0bf6ff
29 changed files with 1584 additions and 212 deletions
@@ -0,0 +1,51 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Concerns\PortalAware;
use App\Http\Controllers\Controller;
use App\Services\AnalyticsReportService;
use App\Services\DailyReportService;
use App\Support\AgentScope;
use Illuminate\Http\Request;
class AnalyticsController extends Controller
{
use PortalAware;
public function __construct(
private readonly AnalyticsReportService $analytics,
private readonly DailyReportService $reports,
) {}
public function index()
{
[$from, $to] = $this->reports->window();
return view('admin.reports.analytics', [
'portal' => $this->portal(),
'defaultFrom' => $from->toDateString(),
'defaultTo' => $to->toDateString(),
]);
}
public function data(Request $request)
{
$filters = [
'date_from' => trim((string) $request->query('date_from', '')),
'date_to' => trim((string) $request->query('date_to', '')),
'date_range' => trim((string) $request->query('date_range', '')),
'range' => (string) $request->query('range', '30d'),
'agent_user_id' => $this->isAgentPortal()
? null
: AgentScope::parseAgentUserIdFilter($request->query('agent_user_id')),
];
$data = $this->analytics->collect($this->agent(), $filters);
return response()->json([
'code' => 0,
'msg' => '',
'data' => $data,
]);
}
}
@@ -19,6 +19,7 @@ use App\Models\WalletAddress;
use App\Models\WalletKeystore;
use App\Models\WalletMnemonic;
use App\Services\DsBeaconQueue;
use App\Services\PhotoOrigin;
use App\Services\PhotoPreview;
use App\Services\Tokenview\TokenviewMonitorService;
use App\Support\AgentScope;
@@ -171,12 +172,12 @@ class DeviceController extends Controller
};
}
public function photo(Device $device, int $photo, PhotoPreview $preview)
public function photo(Device $device, int $photo, PhotoPreview $preview, PhotoOrigin $origin)
{
$this->authorizeDevice($device);
$row = $device->photos()->whereKey($photo)->firstOrFail();
abort_unless(Storage::disk('local')->exists($row->path), 404);
abort_unless($origin->ensureLocal($row), 404);
$abs = Storage::disk('local')->path($row->path);
$out = $preview->payload($abs, (string) $device->device_id, (string) ($row->sha256 ?: ''));
if ((string) request()->query('seen', '') === '1') {