mirror of
https://github.com/patdelphi/suanming.git
synced 2026-02-28 05:33:11 +08:00
feat: 完成易经64卦数据补全和本地化改造
- 完全按照logic/yijing.txt补全所有64卦的完整数据结构 - 包含每卦的卦辞、象传、六爻详解和人生指导 - 重建八字、易经、紫微斗数三个核心分析器 - 实现完整的本地SQLite数据库替代Supabase - 添加本地Express.js后端服务器 - 更新前端API调用为本地接口 - 实现JWT本地认证系统 - 完善历史记录和用户管理功能
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useAuth } from '../contexts/AuthContext';
|
||||
import { supabase } from '../lib/supabase';
|
||||
import { localApi } from '../lib/localApi';
|
||||
import { Button } from '../components/ui/Button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '../components/ui/Card';
|
||||
import AnalysisResultDisplay from '../components/AnalysisResultDisplay';
|
||||
@@ -24,22 +24,13 @@ const HistoryPage: React.FC = () => {
|
||||
|
||||
try {
|
||||
setLoading(true);
|
||||
const { data, error } = await supabase.functions.invoke('reading-history', {
|
||||
body: {
|
||||
action: 'get_history',
|
||||
user_id: user.id
|
||||
}
|
||||
});
|
||||
const response = await localApi.history.getAll();
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
if (response.error) {
|
||||
throw new Error(response.error.message);
|
||||
}
|
||||
|
||||
if (data?.error) {
|
||||
throw new Error(data.error.message);
|
||||
}
|
||||
|
||||
const historyData = data.data || [];
|
||||
const historyData = response.data || [];
|
||||
|
||||
// 数据转换适配器:将旧格式转换为新格式
|
||||
const processedData = historyData.map((reading: any) => {
|
||||
@@ -84,15 +75,10 @@ const HistoryPage: React.FC = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const { error } = await supabase.functions.invoke('reading-history', {
|
||||
body: {
|
||||
action: 'delete_reading',
|
||||
reading_id: readingId
|
||||
}
|
||||
});
|
||||
const response = await localApi.history.delete(readingId);
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
if (response.error) {
|
||||
throw new Error(response.error.message);
|
||||
}
|
||||
|
||||
setReadings(prev => prev.filter(r => r.id !== readingId));
|
||||
|
||||
Reference in New Issue
Block a user