commit 2586b13e089626d43b6a51015815d62581136d3a Author: mula.liu Date: Sun Jan 4 18:36:50 2026 +0800 Update from Nex Docus diff --git a/PHASE5_PLAN.md b/PHASE5_PLAN.md new file mode 100644 index 0000000..20babfd --- /dev/null +++ b/PHASE5_PLAN.md @@ -0,0 +1,90 @@ +# Phase 5: APP Connectivity & Social Features Plan + +## 🎯 阶段目标 +本阶段致力于打通移动端 APP 与后端平台的连接,增强系统的社会化属性(关注、频道),并引入天体事件自动发现机制。同时优化底层数据获取性能。 + +--- + +## 🛠 功能规划 + +### 1. 资源增强:天体图标 (Icons) +* **需求**: 为每个天体增加专属图标(320x320 PNG/JPG),用于 APP 列表页和详情页头部展示。 +* **实现**: + * 利用现有的 `resources` 表。 + * 确保 `resource_type` 支持 `'icon'` 枚举值。 + * 后端 API `POST /celestial/resources/upload` 需支持上传到 `upload/icon/` 目录。 + * 前端/APP 端在获取天体列表时,优先加载 icon 资源。 + +### 2. 天体事件系统 (Celestial Events) +* **需求**: 自动计算/拉取天体动态事件(如“火星冲日”、“小行星飞掠”)。 +* **数据源**: + * **小天体 (Comets/Asteroids)**: NASA JPL SBDB Close-Approach Data API (`https://ssd-api.jpl.nasa.gov/cad.api`). + * **主要行星**: 基于 `skyfield` 或 `ephem` 库进行本地计算(冲日、合月等),或解析 Horizons 数据。 +* **实现**: + * 新增 `celestial_events` 表。 + * 新增定时任务脚本 `fetch_celestial_events.py` (注册到 Scheduled Jobs)。 + * API: `GET /events` (支持按天体、时间范围筛选)。 + +### 3. 性能优化:JPL Horizons Redis 缓存 +* **需求**: 减少对 NASA 接口的实时请求,针对“同天体、同一日”的请求进行缓存。 +* **策略**: + * **Key**: `nasa:horizons:{body_id}:{date_str}` (例如 `nasa:horizons:499:2025-12-12`). + * **Value**: 解析后的 Position 对象或原始 Raw Text。 + * **TTL**: 7天或更久(历史数据永不过期)。 + * 在 `HorizonsService` 层拦截,先查 Redis,无数据再请求 NASA 并写入 Redis。 + +### 4. 社交功能:关注与频道 +* **关注 (Subscriptions/Follows)**: + * 用户可以关注感兴趣的天体(如关注“旅行者1号”)。 + * 新增 `user_follows` 表。 + * API: 关注、取消关注、获取关注列表。 +* **天体频道 (Body Channels)**: + * 每个天体拥有一个独立的讨论区(Channel)。 + * 只有关注了该天体的用户才能在频道内发言。 + * **存储**: **Redis List** (类似于弹幕 `danmaku` 的设计),不持久化到 PostgreSQL。 + * **Key**: `channel:messages:{body_id}`。 + * **TTL**: 消息保留最近 100-500 条或 7 天,过旧自动丢弃。 + * API: 发送消息、获取频道消息流。 +* **消息推送 (Notification)**: + * 当关注的天体发生 `celestial_events` 时,系统应生成通知(本阶段先实现数据层关联,推送推迟到 Phase 6 或 APP 端轮询)。 + +--- + +## 🗄 数据库变更 (Database Schema) + +### 新增表结构 + +#### 1. `celestial_events` (天体事件表) +| Column | Type | Comment | +| :--- | :--- | :--- | +| id | SERIAL | PK | +| body_id | VARCHAR(50) | FK -> celestial_bodies.id | +| title | VARCHAR(200) | 事件标题 (e.g., "Asteroid 2024 XK Flyby") | +| event_type | VARCHAR(50) | 类型: 'approach', 'opposition', 'conjunction' | +| event_time | TIMESTAMP | 事件发生时间 (UTC) | +| description | TEXT | 事件描述 | +| details | JSONB | 技术参数 (距离、相对速度等) | +| source | VARCHAR(50) | 来源 ('nasa_sbdb', 'calculated') | + +#### 2. `user_follows` (用户关注表) +| Column | Type | Comment | +| :--- | :--- | :--- | +| user_id | INTEGER | FK -> users.id | +| body_id | VARCHAR(50) | FK -> celestial_bodies.id | +| created_at | TIMESTAMP | 关注时间 | +| **Constraint** | PK | (user_id, body_id) 联合主键 | + +--- + +## 🗓 实施步骤 (Execution Steps) + +1. **数据库迁移**: 执行 SQL 脚本创建新表(`celestial_events`, `user_follows`)。 +2. **后端开发**: + * **Horizons缓存**: 修改 `HorizonsService` 增加 Redis 缓存层。 + * **关注功能**: 实现 `/social/follow` API。 + * **频道消息**: 实现 `/social/channel` API,使用 Redis 存储。 + * **天体事件**: 实现 NASA SBDB 数据拉取逻辑与 API。 +3. **验证**: + * 测试关注/取关。 + * 测试频道消息发送与接收(验证 Redis 存储)。 + * 测试 Horizons 缓存生效。 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6745aff --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# 项目首页 + +欢迎使用 NEX Docus! + +[PHASE5_PLAN.md](PHASE5_PLAN.md) + +[土星.pdf](星球知识卡/土星.pdf) diff --git a/星球知识册/Moon_Core_Revealed.pdf b/星球知识册/Moon_Core_Revealed.pdf new file mode 100644 index 0000000..a82f331 Binary files /dev/null and b/星球知识册/Moon_Core_Revealed.pdf differ diff --git a/星球知识册/The_Blue_Past_of_the_Red_Planet.pdf b/星球知识册/The_Blue_Past_of_the_Red_Planet.pdf new file mode 100644 index 0000000..0b8b293 Binary files /dev/null and b/星球知识册/The_Blue_Past_of_the_Red_Planet.pdf differ diff --git a/星球知识册/Unlocking_the_Ice_Giant.pdf b/星球知识册/Unlocking_the_Ice_Giant.pdf new file mode 100644 index 0000000..0ba82bb Binary files /dev/null and b/星球知识册/Unlocking_the_Ice_Giant.pdf differ diff --git a/星球知识册/Venus_Mysteries_Unveiled_Deep_Space_Exploration.pdf b/星球知识册/Venus_Mysteries_Unveiled_Deep_Space_Exploration.pdf new file mode 100644 index 0000000..a4257fc Binary files /dev/null and b/星球知识册/Venus_Mysteries_Unveiled_Deep_Space_Exploration.pdf differ diff --git a/星球知识卡/Pluto.pdf b/星球知识卡/Pluto.pdf new file mode 100644 index 0000000..b434bd0 Binary files /dev/null and b/星球知识卡/Pluto.pdf differ diff --git a/星球知识卡/土星.pdf b/星球知识卡/土星.pdf new file mode 100644 index 0000000..15a9893 Binary files /dev/null and b/星球知识卡/土星.pdf differ diff --git a/星球知识卡/地球.pdf b/星球知识卡/地球.pdf new file mode 100644 index 0000000..048470e Binary files /dev/null and b/星球知识卡/地球.pdf differ diff --git a/星球知识卡/天王星.pdf b/星球知识卡/天王星.pdf new file mode 100644 index 0000000..150eb8c Binary files /dev/null and b/星球知识卡/天王星.pdf differ diff --git a/星球知识卡/月球.pdf b/星球知识卡/月球.pdf new file mode 100644 index 0000000..6e96cd9 Binary files /dev/null and b/星球知识卡/月球.pdf differ diff --git a/星球知识卡/木星.pdf b/星球知识卡/木星.pdf new file mode 100644 index 0000000..42bd0bc Binary files /dev/null and b/星球知识卡/木星.pdf differ diff --git a/星球知识卡/水星.pdf b/星球知识卡/水星.pdf new file mode 100644 index 0000000..c58f407 Binary files /dev/null and b/星球知识卡/水星.pdf differ diff --git a/星球知识卡/海王星.pdf b/星球知识卡/海王星.pdf new file mode 100644 index 0000000..c35d4c9 Binary files /dev/null and b/星球知识卡/海王星.pdf differ diff --git a/星球知识卡/火星.pdf b/星球知识卡/火星.pdf new file mode 100644 index 0000000..96c9bab Binary files /dev/null and b/星球知识卡/火星.pdf differ diff --git a/星球知识卡/金星.pdf b/星球知识卡/金星.pdf new file mode 100644 index 0000000..018efa0 Binary files /dev/null and b/星球知识卡/金星.pdf differ diff --git a/测试内容导航.md b/测试内容导航.md new file mode 100644 index 0000000..b8b27d0 --- /dev/null +++ b/测试内容导航.md @@ -0,0 +1,106 @@ +# COSMO 天体知识体系全目录 + +> **欢迎来到42号宇宙!** + +## 0. 宇宙概览 (Cosmos Overview) +*宇宙的宏观尺度与结构基础* +- [ ] **宇宙时空** + - 宇宙大爆炸与演化年表 + - 可观测宇宙尺度 (The Observable Universe) + - 星系纤维结构 (Galaxy Filaments) +- [ ] **基础物理概念** (Glossary) + - 光年与天文单位 (Light-year & AU) + - 引力与轨道力学基础 + - 光谱与红移 + - 黑洞与奇点理论 + +## 1. 恒星系统 (Star Systems) +*人类的家园* +### 1.1 太阳系 (Solar System) +- [ ] **恒星 (Star)** + - **太阳 (The Sun)** + - 内部结构 (核反应区/对流层) + - 太阳大气 (光球/色球/日冕) + - 太阳活动 (黑子/耀斑/太阳风) +- [ ] **行星 (Planets)** + - **类地行星 (Terrestrial Planets)** + - 水星 (Mercury): 极端温差与陨石坑 + - 金星 (Venus): 失控温室效应 + - 地球 (Earth): 生命摇篮与磁场保护 + - 火星 (Mars): 红色地貌与移民潜力 + - **气态巨行星 (Gas Giants)** + - 木星 (Jupiter): 氢氦大气与大红斑 + - 土星 (Saturn): 行星环系统物理学 + - **冰巨星 (Ice Giants)** + - 天王星 (Uranus): 独特的躺倒自转 + - 海王星 (Neptune): 极地风暴与深蓝大气 +- [ ] **卫星 (Moons)** + - 地月系: 月球 (The Moon) + - 伽利略卫星 (木卫一/二/三/四) + - 泰坦 (土卫六 - Titan) + - 活跃卫星 (如: 土卫二 Enceladus 的冰喷泉) + +### 1.2 系外行星系统 (Exoplanets) +- [ ] 潜在宜居带行星 (Habitable Zone) +- [ ] 热木星 (Hot Jupiters) +- [ ] 超级地球 (Super-Earths) + +## 2. 小天体与碎片 (Small Bodies) +*太阳系的剩余物质,移动的威胁与宝藏* +- [ ] **小行星 (Asteroids)** + - 小行星带 (Main Belt) + - 近地小行星 (NEO) - *结合防御监测数据* + - 矮行星 (Dwarf Planets): 冥王星 (Pluto)、谷神星 (Ceres) +- [ ] **彗星 (Comets)** + - 彗核、彗发与彗尾结构 + - 著名彗星 (哈雷彗星/海尔-波普) +- [ ] **柯伊伯带与奥尔特云 (Kuiper Belt & Oort Cloud)** + +## 3. 深空天体 (Deep Space Objects - DSO) +*星系级尺度的壮丽景观* +- [ ] **星云 (Nebulae)** + - 发射星云 (如: 猎户座大星云) + - 行星状星云 (如: 环状星云) + - 超新星遗迹 (如: 蟹状星云) + - 暗星云 (如: 马头星云) +- [ ] **星团 (Star Clusters)** + - 疏散星团 (Open Clusters) + - 球状星团 (Globular Clusters) +- [ ] **星系 (Galaxies)** + - 银河系结构 (The Milky Way) + - 仙女座星系 (Andromeda) + - 星系分类 (螺旋/椭圆/不规则) +- [ ] **极端天体 (Exotic Objects)** + - 黑洞 (Black Holes): 史瓦西半径与视界 + - 中子星与脉冲星 (Neutron Stars & Pulsars) + - 类星体 (Quasars) + +## 4. 人类探索与技术 (Human Exploration) +*Cosmo 项目的特色板块:人与太空的交互* +- [ ] **航天器与探测器 (Spacecraft)** + - 载人飞船 (Vostok, Apollo, Shenzhou, Dragon) + - 空间站 (ISS, Tiangong) + - 深空探测器 (Voyager 1/2, New Horizons) + - 火星漫游车 (Curiosity, Perseverance, Zhurong) +- [ ] **著名太空任务 (Missions)** + - 阿波罗登月计划 + - 赫歇尔/韦伯/哈勃望远镜任务 + - 阿尔忒弥斯计划 (重返月球) +- [ ] **地面观测技术** + - 射电望远镜阵列 (VLA / FAST) + - 引力波探测 (LIGO) + +## 5. 天文文化与数据可视化 (Culture & Viz) +*软知识与前端交互展示区* +- [ ] **星座体系 (Constellations)** + - 88现代星座图谱 + - 黄道十二宫 + - 中国三垣二十八宿 +- [ ] **天文现象 (Phenomena)** + - 日食与月食原理 + - 流星雨观测指南 + - 极光 (Aurora) +- [ ] **Cosmo 交互实验室** (Interactive Labs) + - 引力弹弓模拟器 + - 太阳系实时漫游 (Real-time Orrery) + - 相对论时间膨胀计算器 \ No newline at end of file