From f54757414d4677683582347bf1838db49e199812 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sat, 25 Apr 2026 12:15:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=87=AA=E5=8A=A8=E9=92=93?= =?UTF-8?q?=E9=B1=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../partials/games/fishing-panel.blade.php | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/resources/views/chat/partials/games/fishing-panel.blade.php b/resources/views/chat/partials/games/fishing-panel.blade.php index 8051c1b..692a2f4 100644 --- a/resources/views/chat/partials/games/fishing-panel.blade.php +++ b/resources/views/chat/partials/games/fishing-panel.blade.php @@ -254,10 +254,46 @@ errDiv.innerHTML = `【钓鱼】${data.message || '操作失败'}(${timeStr})`; container2.appendChild(errDiv); - _autoFishing = false; // 出错时停止循环 + + // 核心修复:如果是自动钓鱼中遇到超时或接口报错,不要中断,而是休眠5秒后重试抛竿 + if (_autoFishing) { + const btn = document.getElementById('fishing-btn'); + if (btn) { + btn.disabled = true; + btn.textContent = '⏳ 重试中...'; + } + _autoFishCdTimer = setTimeout(() => { + _autoFishCdTimer = null; + if (_autoFishing) startFishing(); + }, 5000); + if (autoScroll) container2.scrollTop = container2.scrollHeight; + return; // 阻止后续重置逻辑 + } + + _autoFishing = false; // 非自动模式出错时停止 } if (autoScroll) container2.scrollTop = container2.scrollHeight; } catch (e) { + // 网络断开或超时 + if (_autoFishing) { + const noticeDiv = document.createElement('div'); + noticeDiv.className = 'msg-line'; + noticeDiv.innerHTML = `⚠️ 网络异常,5秒后自动重试钓鱼...`; + container2.appendChild(noticeDiv); + if (autoScroll) container2.scrollTop = container2.scrollHeight; + + const btn = document.getElementById('fishing-btn'); + if (btn) { + btn.disabled = true; + btn.textContent = '⏳ 重试中...'; + } + _autoFishCdTimer = setTimeout(() => { + _autoFishCdTimer = null; + if (_autoFishing) startFishing(); + }, 5000); + return; // 阻止后续重置逻辑 + } + window.chatDialog.alert('网络错误:' + e.message, '网络异常', '#cc4444'); _autoFishing = false; }