docs: 更新 README/CLAUDE/AGENTS/DB_REFERENCE

- README: 新增投资资讯日报功能、日报 API 数据源、三种数据流模式、sync-echart 部署与 gitea 仓库说明
- CLAUDE.md: 页面目录表补 charts/news_reports.php,模式B 代表页面补充
- AGENTS.md: 模式B 页面清单与 API 端点补充
- DB_REFERENCE.md: 补 news_report/news_event 两张日报表(共 18 张)
This commit is contained in:
2026-08-06 09:33:53 +08:00
parent 11f31762ad
commit 10569bb828
4 changed files with 30 additions and 12 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
### 三种数据传递模式(实测现状)
1. **模式 Bfetch 外部 API**:页面 JS 用 `fetch()``https://api.doorcome.cn/api/*`(如 `stockparam``indexDatas``stockinfo``getdiv``stockep``stockmargin``stockbasic`)。代表页面:`stock_trend.php``stockdiv.php``stockep.php``stockmargin.php``hkholdbycode.php``index_trend.php``index_mv_all.php``index_margin.php`
1. **模式 Bfetch 外部 API**:页面 JS 用 `fetch()``https://api.doorcome.cn/api/*`(如 `stockparam``indexDatas``stockinfo``getdiv``stockep``stockmargin``stockbasic``news/reports``news/events`)。代表页面:`stock_trend.php``stockdiv.php``stockep.php``stockmargin.php``hkholdbycode.php``index_trend.php``index_mv_all.php``index_margin.php``news_reports.php`(日报 + 重要事件聚合)
2. **模式 CAJAX → `inc/ajax.inc.php`**:页面 JS 用 `$.ajax``../inc/ajax.inc.php`,通过 `$_REQUEST['t']` 路由(if 链,不是 switch/case)。`t` 取值:`stockList``financeData``esfTBD``esfListDaily``newTBD``moneyflowData``estateData`。代表页面:`moneyflow.php``realestate.php``estateTradeDaily.php``estateListDaily.php``estateNewTradeDaily.php``stockkeydata.php``stockTradeRecord.php`
3. **模式 A(服务端注入)**PHP 查询后 `json_encode()` 注入 `<script>` 标签中的 JS 变量。`window.chartConfig` 全局变量**仅剩 `deprecated/` 在用**;活跃页面 `charts/chartStDetail.php` 是变体(注入命名变量 `data1``data5``legend` 等)。
+2 -1
View File
@@ -51,7 +51,7 @@
**模式 B(较新——JS fetch 调用外部 API):**
1. 页面直接加载 JS,不注入数据
2. JS 在 `$(document).ready` 中通过 `fetch()` 调用 `https://api.doorcome.cn/api/*`(如 `stockparam``indexDatas``stockinfo``getdiv``stockep``stockmargin``stockbasic`)获取数据
3. 代表页面:`stock_trend.php``stockdiv.php``stockep.php``stockmargin.php``hkholdbycode.php``index_trend.php``index_mv_all.php``index_margin.php`
3. 代表页面:`stock_trend.php``stockdiv.php``stockep.php``stockmargin.php``hkholdbycode.php``index_trend.php``index_mv_all.php``index_margin.php``news_reports.php`(含重要事件聚合,调 `/api/news/events/`
**模式 CAJAX → `inc/ajax.inc.php`):**
1. 页面 JS 用 `$.ajax``../inc/ajax.inc.php`,通过 `$_REQUEST['t']` 路由(if 链):`stockList``financeData``esfTBD``esfListDaily``newTBD``moneyflowData``estateData`
@@ -82,6 +82,7 @@
| `charts/stockTradeRecord.php` | 个人股票交易记录 |
| `charts/myexcel.php` | 交易记录 Excel/CSV 导入处理(配合上传流程) |
| `charts/chartStDetail.php` | 个股详细图表(服务端注入命名变量 data1…data5 |
| `charts/news_reports.php` | 投资资讯日报导航页(国内/国际日报列表+详情+重要事件聚合,fetch api.doorcome.cn |
> 注:`stock_ih.php`、`index_ih.php`、`chartSix.php`、`chartThree.php` 及旧版 `stock_trend.php`/`index_trend.php`/`index_mv_all.php` 已移入 `deprecated/`,勿引用。
+8 -1
View File
@@ -2,7 +2,7 @@
数据库:`myquant`(配置在 `inc/config.php`
共 16 张表,其中 10 张在使用,3 张未使用,3 张已由 API 替代。
共 18 张表,其中 12 张在使用,3 张未使用,3 张已由 API 替代。
## 全表清单
@@ -52,6 +52,13 @@
| `pv_log` | ✅ 在用 | 页面访问日志 | `inc/functions.inc.php` |
| `pv_counter` | ✅ 在用 | 页面访问计数器 | `inc/functions.inc.php` |
### 日报 API2 张,djapi 后端管理)
| 表名 | 状态 | 用途 | 引用文件 |
|------|------|------|---------|
| `news_report` | ✅ 在用 | 投资资讯日报主表(国内 finance / 国际 intl,每天每类型一份) | djapi `api/report/` 写入;前端 `charts/news_reports.php``api.doorcome.cn/api/news/reports/` 只读消费 |
| `news_event` | ✅ 在用 | 日报事件明细(xwlb/news/cninfo/intl 板块,含重要度/情感/来源/链接) | 同上,`/api/news/events/` 跨日报聚合 |
## 说明
- 所有 SQL 查询均通过 `db_query()` 参数化查询(prepare/execute),`excelOperate.inc.php` 中 insert 操作用字符串拼接
+19 -9
View File
@@ -36,24 +36,32 @@ A 股基本面分析和宁波房地产数据可视化平台,基于 PHP + EChar
| 二手房每日成交量 | 宁波各区县二手房成交面积和套数(日/月维度) |
| 二手房每日挂牌量 | 宁波各区县二手房每日新增挂牌套数和均价 |
### 投资资讯日报
| 页面 | 功能 |
|------|------|
| 日报查询导航页(`charts/news_reports.php`) | 国内 / 国际 AI 深度研究日报,按日期分模块查看(AI 摘要、新闻联播要闻、财经新闻、公告调研、数据总览) |
| 重要事件聚合 | 跨日报检索重要事件(近 N 天 / 重要度 / 类型筛选),数据来自 `api.doorcome.cn/api/news/events/` |
### 其他模块
- **新闻联播分析**`news/`):CCTV 新闻联播内容抓取与关键词分析
- **研究报告**`research/`):AI 产业链、锂矿、新能源等行业深度研究报告(含 PDF 和 HTML 版本)
- **宏观研究**`quant/`):宏观量化分析报告,数据存储在 `mac_report`
## 技术栈
- **后端**PHP 8.4,无框架
- **前端**ECharts 5.4、jQuery 3.6、Tailwind CSS 3.4、DataTables 1.13、Font Awesome 6.4
- **数据库**MySQL,通过 `mysqli` 连接
- **外部 API**TuShare`api.tushare.pro` / `api.waditu.com`
- **外部 API**TuShare`api.tushare.pro` / `api.waditu.com`、日报接口(`api.doorcome.cn/api/news/reports/``/api/news/events/`,由 djapi 后端提供,表 `news_report`/`news_event`
- **数据来源**:宁波市房产交易服务信息网(`cnnbfdc.com`
## 项目结构
```
├── index.php / index-2.php # 入口导航页
├── charts/ # 数据可视化页面(21个
├── charts/ # 数据可视化页面(含 charts/news_reports.php 日报导航页
├── inc/ # PHP 核心代码
│ ├── config.php # DB连接、db_query()、jsonResponse()
│ ├── getData.inc.php # 数据查询(指数、持仓、资金流向)
@@ -70,11 +78,12 @@ A 股基本面分析和宁波房地产数据可视化平台,基于 PHP + EChar
│ ├── js/ # JS 库(jQuery、ECharts、DataTables 等)
│ ├── css/ # CSS 库(Font Awesome、DataTables
│ └── webfonts/ # 字体文件
├── js/ # 页面专属图表 JS
├── js/ # 页面专属图表/渲染 JSnewsReports.js 为日报页逻辑)
├── css/ # 自定义样式
├── html/ # 公共 HTML 头部/底部
├── news/ # 新闻联播分析模块
├── research/ # 研究报告模块
├── podcast-docs/ # 播客相关文档
└── deprecated/ # 已废弃的旧页面
```
@@ -82,15 +91,16 @@ A 股基本面分析和宁波房地产数据可视化平台,基于 PHP + EChar
```
用户请求 → .php 页面(charts/
→ inc/*.php 查询 MySQL 或调用 TuShare API
json_encode() 注入 <script> 标签
js/*.js 读取 window.chartConfig 或 fetch API
→ ECharts 渲染交互式图表
模式A: inc/*.php 查询 MySQL → json_encode() 注入 <script> 变量 → js/*.js 渲染
模式B: js 直接 fetch api.doorcome.cn/api/* (日报、指数、个股行情等新页面)
模式C: js 通过 $.ajax 调 inc/ajax.inc.php 的 t= 路由(房地产、资金流向等)
→ ECharts / HTML 渲染交互式图表
```
## 开发环境
- **本地 PHP**`d:\software\php8.4\`
- **部署**`sync-echart`ssh + tar 同步到 `www.doorcome.cn:/var/www/html/echart/`
- **本地 PHP**`d:\software\php8.4\`(本机 Mac 无 PHP`php -l` 语法检查走服务器)
- **部署**`~/bin/sync-echart`rsync 单向推送本地 → `simon@www.doorcome.cn:/var/www/html/echart/``-n` 预览;排除本地环境文件与数据目录 uploads/xls/files/research
- **代码仓库**gitea `ssh://git@gitea/simon/echart.git``~/.ssh/config` 别名 gitea,端口 2222
- **调试**XDebug 端口 9000VS Code 配置 `.vscode/launch.json`
- **代码指引**:见 `CLAUDE.md``AGENTS.md`