feat: implement detail caching for news articles to optimize content fetching
All checks were successful
Docker Build and Push - News Service / Build and Push News Service Image (push) Successful in 42s
Docker Build and Push - News Service / Build Summary (push) Successful in 0s

This commit is contained in:
2026-04-30 16:38:02 +08:00
parent 9a0b41459c
commit b57b64ef95
77 changed files with 75 additions and 2 deletions

View File

@@ -26,6 +26,8 @@ news_service/
mainnews.json
ranknews.json
worldnews.json
detail-cache.json
images/
src/
app/
config/
@@ -110,6 +112,12 @@ POST /api/news/refresh
POST /api/news/refresh?category=flashnews
```
## 缓存
- 分类列表和前端返回数据会落盘到 `data/<category>.json`
- 详情正文会按详情页 URL 去重缓存到 `data/detail-cache.json`,同一篇新闻后续刷新不会重复抓详情页。
- 正文图片会下载到 `data/images/`,正文 HTML 里的图片地址会替换成 `/api/news/images/<file>`
## Docker
```bash