From b563e0cd473ef3cfe7451adcf2a33857fa28a07e Mon Sep 17 00:00:00 2001 From: 732642856 <732642856@qq.com> Date: Fri, 12 Jun 2026 15:31:49 +0800 Subject: [PATCH] =?UTF-8?q?v6.9.6:=20=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E4=BF=AE=E5=A4=8D=20=E2=80=94=20degree?= =?UTF-8?q?=E2=86=92degree=5Fin=5Fsign=20+=20toFixed=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jyotish-app/api-bridge.js | 16 +++++++++++++--- jyotish-app/main.js | 2 +- jyotish-app/public/api-bridge.js | 16 +++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/jyotish-app/api-bridge.js b/jyotish-app/api-bridge.js index 08af1bb2..d6073310 100644 --- a/jyotish-app/api-bridge.js +++ b/jyotish-app/api-bridge.js @@ -22,9 +22,19 @@ async function computeWithPython(birthData) { const data = await resp.json(); if (data.success) { console.log('[Compute] ✅ Python API v' + data.version); - // Python API返回 'birth',统一转为JS引擎的 'birth_info' 格式 - if (data.birth && !data.birth_info) { - data.birth_info = data.birth; + // Python API → JS引擎字段映射 + if (data.birth && !data.birth_info) data.birth_info = data.birth; + // ascendant.degree → ascendant.degree_in_sign + if (data.ascendant?.degree != null && data.ascendant.degree_in_sign == null) { + data.ascendant.degree_in_sign = data.ascendant.degree; + } + // planet degree → degree_in_sign + if (data.planets) { + for (const [k, v] of Object.entries(data.planets)) { + if (v?.degree != null && v.degree_in_sign == null) { + v.degree_in_sign = v.degree % 30; + } + } } return data; } diff --git a/jyotish-app/main.js b/jyotish-app/main.js index 03a4f645..ab83e8b4 100644 --- a/jyotish-app/main.js +++ b/jyotish-app/main.js @@ -272,7 +272,7 @@ function renderAll() { // Banner $('asc-sign').textContent = `${ascendant.sign} · ${signName(ascendant.sign)}`; - $('asc-degree').textContent = `${(ascendant.degree_in_sign != null ? ascendant.degree_in_sign : ascendant.degree).toFixed(2)}° | ${t('asc.lord')}: ${planetName(ascendant.lord)}`; + $('asc-degree').textContent = `${((ascendant.degree_in_sign ?? ascendant.degree) ?? 0).toFixed(2)}° | ${t('asc.lord')}: ${planetName(ascendant.lord)}`; if (moonP) $('asc-nakshatra').textContent = `${t('asc.nakshatra')}: ${moonP.nakshatra} Pada ${moonP.nakshatra_pada}`; $('asc-lord-badge').textContent = `${t('asc.lord')}: ${planetName(ascendant.lord)} (${ascendant.lord})`; diff --git a/jyotish-app/public/api-bridge.js b/jyotish-app/public/api-bridge.js index 08af1bb2..d6073310 100644 --- a/jyotish-app/public/api-bridge.js +++ b/jyotish-app/public/api-bridge.js @@ -22,9 +22,19 @@ async function computeWithPython(birthData) { const data = await resp.json(); if (data.success) { console.log('[Compute] ✅ Python API v' + data.version); - // Python API返回 'birth',统一转为JS引擎的 'birth_info' 格式 - if (data.birth && !data.birth_info) { - data.birth_info = data.birth; + // Python API → JS引擎字段映射 + if (data.birth && !data.birth_info) data.birth_info = data.birth; + // ascendant.degree → ascendant.degree_in_sign + if (data.ascendant?.degree != null && data.ascendant.degree_in_sign == null) { + data.ascendant.degree_in_sign = data.ascendant.degree; + } + // planet degree → degree_in_sign + if (data.planets) { + for (const [k, v] of Object.entries(data.planets)) { + if (v?.degree != null && v.degree_in_sign == null) { + v.degree_in_sign = v.degree % 30; + } + } } return data; }