diff --git a/app/Models/Machine/MachineLog.php b/app/Models/Machine/MachineLog.php index 019bd29..ae3de14 100644 --- a/app/Models/Machine/MachineLog.php +++ b/app/Models/Machine/MachineLog.php @@ -58,7 +58,10 @@ class MachineLog extends Model } } } elseif ($log->type === 'submachine') { - $shouldNotify = true; + // 下位機日誌僅在 warning 或 error 級別時發送 Discord 告警,info 狀態日誌不發送 + if (in_array($log->level, ['warning', 'error'])) { + $shouldNotify = true; + } } elseif ($log->level === 'error') { $shouldNotify = true; } diff --git a/app/Services/Notification/DiscordWebhookService.php b/app/Services/Notification/DiscordWebhookService.php index 86225eb..611f1f0 100644 --- a/app/Services/Notification/DiscordWebhookService.php +++ b/app/Services/Notification/DiscordWebhookService.php @@ -151,7 +151,8 @@ class DiscordWebhookService $translatedError = __($translatedError); } - $title = '⚠️ ' . $this->cleanTranslation(__('Submachine Exception'), $companyLocale); + $icon = ($log->level === 'error') ? '🚨 ' : '⚠️ '; + $title = $icon . $this->cleanTranslation(__('Submachine Exception'), $companyLocale); $description = $this->cleanTranslation(__('Vending machine reported a submachine hardware error.'), $companyLocale); $color = ($log->level === 'error') ? 14753096 : 14251782; diff --git a/resources/views/admin/ads/index.blade.php b/resources/views/admin/ads/index.blade.php index 95c834d..397d617 100644 --- a/resources/views/admin/ads/index.blade.php +++ b/resources/views/admin/ads/index.blade.php @@ -875,6 +875,11 @@ $baseRoute = 'admin.data-config.advertisements'; async fetchPage(url) { if (!url || url === window.location.href) return; + const urlObj = new URL(url, window.location.origin); + if (urlObj.host === window.location.host) { + urlObj.protocol = window.location.protocol; + } + url = urlObj.toString(); this.isLoading = true; try { @@ -1481,4 +1486,4 @@ $baseRoute = 'admin.data-config.advertisements'; })); }); -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/admin/products/index.blade.php b/resources/views/admin/products/index.blade.php index b022608..3b94873 100644 --- a/resources/views/admin/products/index.blade.php +++ b/resources/views/admin/products/index.blade.php @@ -1023,6 +1023,9 @@ hover:bg-slate-100 dark:hover:bg-white/5 rounded-lg flex items-center justify-be } else { // Ensure URL has tab and _ajax params const urlObj = new URL(url, window.location.origin); + if (urlObj.host === window.location.host) { + urlObj.protocol = window.location.protocol; + } urlObj.searchParams.set('tab', tab); urlObj.searchParams.set('_ajax', '1'); url = urlObj.toString();