From 4ac3311328baceb5cc493936754386977775b5d9 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sun, 12 Apr 2026 18:12:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BF=AB=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E6=B3=A8=20=E4=BF=9D=E8=AF=81=E8=87=B3=E5=B0=91=E6=9C=895?= =?UTF-8?q?=E4=B8=AA=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../partials/games/baccarat-panel.blade.php | 44 ++++++++++++++----- .../partials/games/horse-race-panel.blade.php | 43 +++++++++++++----- 2 files changed, 66 insertions(+), 21 deletions(-) diff --git a/resources/views/chat/partials/games/baccarat-panel.blade.php b/resources/views/chat/partials/games/baccarat-panel.blade.php index c8ff424..055e32b 100644 --- a/resources/views/chat/partials/games/baccarat-panel.blade.php +++ b/resources/views/chat/partials/games/baccarat-panel.blade.php @@ -490,17 +490,39 @@ const min = this.minBet || 100; const max = this.maxBet || 50000; - // 生成阶梯:最小值, 10倍, 100倍, 500倍, 最大值 - // 并确保每个阶梯都不超过最大值,最后去重排序取前5个 - let steps = [ - min, - min * 10, - min * 100, - min * 500, - max - ].map(v => Math.min(v, max)); - - return [...new Set(steps)].sort((a, b) => a - b).slice(0, 5); + // 预设候选倍数,尽量生成美观的数字 + const candidates = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]; + let steps = candidates.map(m => min * m).filter(v => v >= min && v < max); + steps.push(max); + steps = [...new Set(steps)].sort((a, b) => a - b); + + if (steps.length >= 5) { + // 如果候选值足够多,均匀采样,确保首尾是最小值和最大值 + return [ + steps[0], + steps[Math.floor((steps.length - 1) * 0.25)], + steps[Math.floor((steps.length - 1) * 0.5)], + steps[Math.floor((steps.length - 1) * 0.75)], + steps[steps.length - 1] + ]; + } else { + // 如果候选值不足5个(范围太小),通过线性插值补齐 + while (steps.length < 5) { + let maxGap = 0; + let insertIdx = -1; + for (let i = 0; i < steps.length - 1; i++) { + if (steps[i+1] - steps[i] > maxGap) { + maxGap = steps[i+1] - steps[i]; + insertIdx = i; + } + } + if (insertIdx === -1) break; + let newVal = Math.floor((steps[insertIdx] + steps[insertIdx+1]) / 2); + if (newVal > 100) newVal = Math.floor(newVal / 10) * 10; // 简单取整 + steps.splice(insertIdx + 1, 0, newVal); + } + return steps; + } }, /** diff --git a/resources/views/chat/partials/games/horse-race-panel.blade.php b/resources/views/chat/partials/games/horse-race-panel.blade.php index 3107f42..6b4de89 100644 --- a/resources/views/chat/partials/games/horse-race-panel.blade.php +++ b/resources/views/chat/partials/games/horse-race-panel.blade.php @@ -435,16 +435,39 @@ const min = this.minBet || 100; const max = this.maxBet || 100000; - // 生成阶梯:最小值, 10倍, 100倍, 500倍, 最大值 - let steps = [ - min, - min * 10, - min * 100, - min * 500, - max - ].map(v => Math.min(v, max)); - - return [...new Set(steps)].sort((a, b) => a - b).slice(0, 5); + // 预设候选倍数,尽量生成美观的数字 + const candidates = [1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]; + let steps = candidates.map(m => min * m).filter(v => v >= min && v < max); + steps.push(max); + steps = [...new Set(steps)].sort((a, b) => a - b); + + if (steps.length >= 5) { + // 如果候选值足够多,均匀采样,确保首尾是最小值和最大值 + return [ + steps[0], + steps[Math.floor((steps.length - 1) * 0.25)], + steps[Math.floor((steps.length - 1) * 0.5)], + steps[Math.floor((steps.length - 1) * 0.75)], + steps[steps.length - 1] + ]; + } else { + // 如果候选值不足5个(范围太小),通过线性插值补齐 + while (steps.length < 5) { + let maxGap = 0; + let insertIdx = -1; + for (let i = 0; i < steps.length - 1; i++) { + if (steps[i+1] - steps[i] > maxGap) { + maxGap = steps[i+1] - steps[i]; + insertIdx = i; + } + } + if (insertIdx === -1) break; + let newVal = Math.floor((steps[insertIdx] + steps[insertIdx+1]) / 2); + if (newVal > 100) newVal = Math.floor(newVal / 10) * 10; + steps.splice(insertIdx + 1, 0, newVal); + } + return steps; + } }, /**