feat: 完善纳音五行功能 - 添加八字和紫微斗数中的纳音计算、展示和个性化解释

- 后端:为八字分析器添加完整的60甲子纳音计算功能
- 前端:在八字和紫微斗数组件中添加纳音五行专题展示
- 个性化:为30种纳音提供专属的性格分析和职业指导
- 理论:完整的纳音五行理论解释和传统应用说明
- 配合:四柱纳音的生克关系分析和发展建议
This commit is contained in:
patdelphi
2025-08-20 15:44:30 +08:00
parent 9709f06af2
commit e059f08cc5
3 changed files with 421 additions and 3 deletions

View File

@@ -198,6 +198,13 @@ class BaziAnalyzer {
},
day_master: dayPillar.stem,
day_master_element: this.getElementFromStem(dayPillar.stem),
// 添加纳音五行信息
nayin_info: {
year_nayin: this.calculateNayin(yearPillar.stem, yearPillar.branch),
month_nayin: this.calculateNayin(monthPillar.stem, monthPillar.branch),
day_nayin: this.calculateNayin(dayPillar.stem, dayPillar.branch),
hour_nayin: this.calculateNayin(hourPillar.stem, hourPillar.branch)
},
month_order: monthPillar.branch,
complete_chart: `${yearPillar.stem}${yearPillar.branch} ${monthPillar.stem}${monthPillar.branch} ${dayPillar.stem}${dayPillar.branch} ${hourPillar.stem}${hourPillar.branch}`,
// 添加五行旺衰分析
@@ -211,6 +218,31 @@ class BaziAnalyzer {
return result;
}
// 计算纳音五行
calculateNayin(stem, branch) {
// 纳音五行对照表60甲子纳音
const nayinTable = {
'甲子': '海中金', '乙丑': '海中金', '丙寅': '炉中火', '丁卯': '炉中火',
'戊辰': '大林木', '己巳': '大林木', '庚午': '路旁土', '辛未': '路旁土',
'壬申': '剑锋金', '癸酉': '剑锋金', '甲戌': '山头火', '乙亥': '山头火',
'丙子': '涧下水', '丁丑': '涧下水', '戊寅': '城头土', '己卯': '城头土',
'庚辰': '白蜡金', '辛巳': '白蜡金', '壬午': '杨柳木', '癸未': '杨柳木',
'甲申': '泉中水', '乙酉': '泉中水', '丙戌': '屋上土', '丁亥': '屋上土',
'戊子': '霹雳火', '己丑': '霹雳火', '庚寅': '松柏木', '辛卯': '松柏木',
'壬辰': '长流水', '癸巳': '长流水', '甲午': '砂中金', '乙未': '砂中金',
'丙申': '山下火', '丁酉': '山下火', '戊戌': '平地木', '己亥': '平地木',
'庚子': '壁上土', '辛丑': '壁上土', '壬寅': '金箔金', '癸卯': '金箔金',
'甲辰': '覆灯火', '乙巳': '覆灯火', '丙午': '天河水', '丁未': '天河水',
'戊申': '大驿土', '己酉': '大驿土', '庚戌': '钗钏金', '辛亥': '钗钏金',
'壬子': '桑柘木', '癸丑': '桑柘木', '甲寅': '大溪水', '乙卯': '大溪水',
'丙辰': '沙中土', '丁巳': '沙中土', '戊午': '天上火', '己未': '天上火',
'庚申': '石榴木', '辛酉': '石榴木', '壬戌': '大海水', '癸亥': '大海水'
};
const ganzhi = stem + branch;
return nayinTable[ganzhi] || '大林木';
}
// 年柱计算 - 基于精确立春节气
calculateYearPillar(year, month, day, hour = 12, minute = 0) {