From dcdfe1382eea0e2124f08061d8e8592edd006bae Mon Sep 17 00:00:00 2001 From: sky121113 Date: Thu, 28 May 2026 11:42:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[FIX]=20=E8=A7=A3=E6=B1=BA=20HTTPS=20?= =?UTF-8?q?=E7=92=B0=E5=A2=83=E4=B8=8B=20AJAX=20=E5=88=86=E9=A0=81?= =?UTF-8?q?=E8=AB=8B=E6=B1=82=20http=20=E6=B7=B7=E5=90=88=E5=85=A7?= =?UTF-8?q?=E5=AE=B9=20(Mixed=20Content)=20=E6=94=94=E6=88=AA=20Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 在 ads/index.blade.php 的 fetchPage 分頁異步請求中,新增主機與協議對齊邏輯 (urlObj.protocol = window.location.protocol),防止在 HTTPS 網頁中請求同域 http 分頁而被瀏覽器攔截。 2. 同步在 products/index.blade.php 的 AJAX 分頁切換重組中,對同域的請求協議進行 HTTPS 同步校正,解決混合內容載入失敗的問題。 --- resources/views/admin/ads/index.blade.php | 7 ++++++- resources/views/admin/products/index.blade.php | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) 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(); From acde99e383afb627b321899994f83073a9459872 Mon Sep 17 00:00:00 2001 From: sky121113 Date: Thu, 28 May 2026 14:53:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[FIX]=20=E4=BF=AE=E6=AD=A3=E4=B8=8B?= =?UTF-8?q?=E4=BD=8D=E6=A9=9F=20Discord=20=E5=91=8A=E8=AD=A6=E7=99=BC?= =?UTF-8?q?=E9=80=81=E6=A2=9D=E4=BB=B6=E8=88=87=E5=B1=A4=E7=B4=9A=E5=B0=8D?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 調整 MachineLog 的 created 監聽器,使 submachine 類型日誌僅在 level 為 warning 或 error 時才派發 Discord 通知任務,避免 info 狀態日誌(如出貨中、平台上升中)洗板告警。 2. 優化 DiscordWebhookService 的下位機異常渲染,根據日誌嚴重程度 (level) 動態調整標題前面的 Emoji 圖示,error 級別顯示 🚨,warning 級別顯示 ⚠️。 --- app/Models/Machine/MachineLog.php | 5 ++++- app/Services/Notification/DiscordWebhookService.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) 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;