From 71c386509c125ccb59b4825a9c6c8eed98de9099 Mon Sep 17 00:00:00 2001 From: awayings Date: Fri, 11 Sep 2026 16:25:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=AA=E8=82=A1/=E6=9D=BF=E5=9D=97?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E6=97=A5K=E5=8F=AA=E5=8F=96=E8=BF=91=202=20?= =?UTF-8?q?=E5=B9=B4=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=85=A8=E5=8E=86=E5=8F=B2?= =?UTF-8?q?=E5=88=86=E9=A1=B5=EF=BC=885+=20=E9=A1=B5=20=E2=86=92=201=20?= =?UTF-8?q?=E9=A1=B5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 弹窗日K只用最近 250 根,却以 count=800 逐页拉全历史(300308 约 3400 根 = 5 页),深层页还触发服务端 QFQ 负价的 NONE+XDXR 本地重算(每页多一次 协议请求)。传 startDate(近 2 年)后单页 800 根即覆盖,翻页循环第一页 即命中退出;长期停牌取不到时退回全历史,行为不变。 Co-Authored-By: Claude Code --- web-ui/src/components/BoardDialog.vue | 6 +++++- web-ui/src/components/StockDialog.vue | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web-ui/src/components/BoardDialog.vue b/web-ui/src/components/BoardDialog.vue index 1836987..84f816f 100644 --- a/web-ui/src/components/BoardDialog.vue +++ b/web-ui/src/components/BoardDialog.vue @@ -74,7 +74,11 @@ async function loadMinute() { async function loadDaily() { dailyError.value = '' try { - const bars = await fetchBars('SH', props.code, 'DAY', undefined, undefined) + // 日K只展示最近 250 根:取近 2 年(/bars 单页 800 根即可覆盖,避免全历史分页); + // 长期停牌取不到再退回全历史。 + const since = new Date(Date.now() - 2 * 365 * 86400_000).toISOString().slice(0, 10) + let bars = await fetchBars('SH', props.code, 'DAY', since, undefined) + if (bars.length === 0) bars = await fetchBars('SH', props.code, 'DAY', undefined, undefined) if (bars.length === 0) throw new Error('该板块无日K数据') dailyBars.value = bars.slice(-250) } catch (e) { diff --git a/web-ui/src/components/StockDialog.vue b/web-ui/src/components/StockDialog.vue index 622d74c..fb2d796 100644 --- a/web-ui/src/components/StockDialog.vue +++ b/web-ui/src/components/StockDialog.vue @@ -106,7 +106,11 @@ watch(minuteDays, loadMinute) async function loadDaily() { dailyError.value = '' try { - let bars = await fetchBars(props.market, props.code, 'DAY', undefined, undefined) + // 日K只展示最近 250 根:取近 2 年(/bars 单页 800 根即可覆盖,避免全历史 + // 分页 5+ 页 + 深层 QFQ 负价重算);长期停牌取不到再退回全历史。 + const since = new Date(Date.now() - 2 * 365 * 86400_000).toISOString().slice(0, 10) + let bars = await fetchBars(props.market, props.code, 'DAY', since, undefined) + if (bars.length === 0) bars = await fetchBars(props.market, props.code, 'DAY', undefined, undefined) // 指数(或 /bars 空数据的服务器)回退指数接口 if (bars.length === 0) bars = await fetchIndexBars(props.market, props.code, 250) if (bars.length === 0) throw new Error('无日K数据(可能为新股或代码有误)')