feat: 사주 명식 카드 — 오행 세력 막대·가장 센 오행 그림, 신강·신약, 기둥별 십성·일간 '나'·월령, 용어 풀이 (API me.elements·strong·십성 추가, GA saju_view 에 strength·top_element)

This commit is contained in:
minaChoi committed 2026-10-29 13:15:51 +09:00
1 parent 63db0b725b
commit d7f891fddb
14 files changed
+131 -15

No files matched your search

+7 -1
View File
@@ -11,6 +11,8 @@ from router.v1.saju.protocol import Req_Saju, Req_SajuBirth, Req_SajuMatch, Res_
from services import saju_text as T
from services.level_service import UNLOCKS
from services.saju.ganji import branch_element, ko, stem_element
from services.saju.rules import chart_ten_gods
from services.saju.strength import chart_strength
from services.saju_service import Reading, SajuService, shown_saju, weather_points
router = APIRouter(prefix="/v1/saju", tags=["saju"])
@@ -20,12 +22,16 @@ _WEEKDAY = "월화수목금토일"
def _res(r: Reading) -> Res_Saju:
c = r.chart
pillars = [("year", c.year), ("month", c.month), ("day", c.day)] + ([("hour", c.hour)] if c.hour else [])
gods = chart_ten_gods(c.day_stem, dict(pillars))
strength = chart_strength(c)
today = r.today
best = max(r.week, key=lambda d: d.score).day if r.week else None
return Res_Saju(
me=SajuMe(
pillars=[SajuPillar(position=pos, stem=p.stem, branch=p.branch, stem_ko=ko(p.stem), branch_ko=ko(p.branch), stem_element=stem_element(p.stem), branch_element=branch_element(p.branch)) for pos, p in pillars],
pillars=[SajuPillar(position=pos, stem=p.stem, branch=p.branch, stem_ko=ko(p.stem), branch_ko=ko(p.branch), stem_element=stem_element(p.stem), branch_element=branch_element(p.branch),
stem_ten_god=gods[pos]["stem"], branch_ten_god=gods[pos]["branch"]) for pos, p in pillars],
hour_known=c.hour is not None, jeol_warning=c.jeol_on_birth_day, scene=r.scene[0], scene_desc=r.scene[1], scene_icon=r.scene_icon, need=r.need,
elements=strength.elements, top_element=strength.top, strong=strength.strong, support=strength.support,
),
today=SajuToday(
day=today.day, pillar=ko(today.facts.pillar.stem + today.facts.pillar.branch), ten_god=today.facts.stem_ten_god, title=T.TEN_GOD_TEXT[today.facts.stem_ten_god][0],