🚀 Refactor Blade

- Optimize Blade JavaScript code.
- Refactored multiple admin controllers for improved validation, error handling, and query efficiency.
- Added ProxyConfig trait to centralize proxy configuration options.
- Updated NodeStatusDetection to use model relationships for heartbeat checks.
- Improved category, label, and country management logic and error logging.
- Added new Blade components for admin UI and updated language files and assets for better localization and frontend support.
- Bug fixed & introduced more bug :)
This commit is contained in:
BrettonYe
2025-08-24 11:59:33 +08:00
committed by BrettonYe
parent 572751e135
commit ad3662cda0
232 changed files with 14634 additions and 16724 deletions

View File

@@ -46,8 +46,22 @@ class SubscribeController extends Controller
$query->whereBetween('request_time', [$request->input('start').' 00:00:00', $request->input('end').' 23:59:59']);
}
$subscribeLogs = $query->latest()->paginate(20)->appends($request->except('page'))->through(function ($log) {
$log->ipInfo = $log->request_ip ? optional(IP::getIPInfo($log->request_ip))['address'] ?? null : null;
$subscribeLogs = $query->latest()->paginate(20)->appends($request->except('page'));
// 批量获取 IP 信息以减少查询次数
$ipList = $subscribeLogs->pluck('request_ip')->filter()->unique()->toArray();
$ipInfoMap = [];
foreach ($ipList as $ip) {
if ($ip) {
$ipInfo = IP::getIPInfo($ip);
$ipInfoMap[$ip] = $ipInfo ? ($ipInfo['address'] ?? null) : null;
}
}
// 将 IP 信息附加到日志记录中
$subscribeLogs->getCollection()->transform(function ($log) use ($ipInfoMap) {
$log->ipInfo = $log->request_ip ? ($ipInfoMap[$log->request_ip] ?? null) : null;
return $log;
});