mirror of
https://github.com/patdelphi/suanming.git
synced 2026-02-28 05:33:11 +08:00
feat: 完整重构易经占卜系统 - 专业化升级和界面修复
🎯 主要更新: - 重构易经分析器:增加多种起卦方法、高级分析、象数理论 - 创建专业前端组件:CompleteYijingAnalysis,参考八字分析样式 - 修复表单验证逻辑:易经占卜只需问题,无需个人信息 - 优化后端API接口:适配新的参数格式和验证逻辑 🚀 功能增强: - 多种起卦方法:时间、梅花易数、金钱卦、数字起卦 - 高级分析:互卦、错卦、综卦四卦综合分析 - 象数理论:八卦数理、时间共振、五行分析 - 动态分析:问题类型识别、时间因素、针对性指导 - 专业展示:卦象符号、爻辞象传、哲学洞察 🔧 技术优化: - 前端表单条件渲染:根据分析类型显示不同表单 - 后端参数验证:易经占卜验证问题而非姓名 - API接口统一:标准化数据传递格式 - 数据库适配:易经记录使用合理默认值 ✅ 问题修复: - 解决'缺少姓名'错误 - 修复按钮无法点击问题 - 优化用户体验和界面响应
This commit is contained in:
@@ -78,21 +78,19 @@ router.post('/bazi', authenticate, asyncHandler(async (req, res) => {
|
||||
|
||||
// 易经分析接口
|
||||
router.post('/yijing', authenticate, asyncHandler(async (req, res) => {
|
||||
const { birth_data, question } = req.body;
|
||||
const { question, user_id, divination_method } = req.body;
|
||||
|
||||
// 输入验证
|
||||
if (!birth_data || !birth_data.name) {
|
||||
throw new AppError('缺少必要参数:姓名', 400, 'MISSING_BIRTH_DATA');
|
||||
if (!question) {
|
||||
throw new AppError('缺少必要参数:占卜问题', 400, 'MISSING_QUESTION');
|
||||
}
|
||||
|
||||
const finalQuestion = question || '人生运势综合占卜';
|
||||
|
||||
try {
|
||||
// 执行易经分析
|
||||
const analysisResult = yijingAnalyzer.performYijingAnalysis({
|
||||
question: finalQuestion,
|
||||
user_id: req.user.id,
|
||||
birth_data: birth_data
|
||||
question: question,
|
||||
user_id: user_id || req.user.id,
|
||||
divination_method: divination_method || 'time'
|
||||
});
|
||||
|
||||
// 保存到数据库
|
||||
@@ -107,12 +105,12 @@ router.post('/yijing', authenticate, asyncHandler(async (req, res) => {
|
||||
const result = insertReading.run(
|
||||
req.user.id,
|
||||
'yijing',
|
||||
birth_data.name,
|
||||
birth_data.birth_date || null,
|
||||
birth_data.birth_time || null,
|
||||
birth_data.birth_place || null,
|
||||
birth_data.gender || null,
|
||||
JSON.stringify({ question: finalQuestion, birth_data }),
|
||||
'易经占卜用户', // 易经占卜不需要真实姓名
|
||||
null, // 不需要出生日期
|
||||
null, // 不需要出生时间
|
||||
null, // 不需要出生地点
|
||||
null, // 不需要性别
|
||||
JSON.stringify({ question, divination_method }),
|
||||
JSON.stringify(analysisResult),
|
||||
'completed'
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user