diff --git a/backend/app/routers/information.py b/backend/app/routers/information.py index 7fb9484..87e3baf 100644 --- a/backend/app/routers/information.py +++ b/backend/app/routers/information.py @@ -891,3 +891,18 @@ def get_publisher_info( "contact": contact, "created_at": info.created_at.isoformat() if info.created_at else None } + + +@router.get("/yichen-posts") +def get_yichen_posts(category: str = None, search: str = None, page: int = 1, page_size: int = 20): + from app.models.models import Information + from sqlalchemy import desc + query = db.query(Information).filter(Information.info_type == 'yichen') + if category: + query = query.filter(Information.expect_category == category) + if search: + query = query.filter(Information.title.contains(search)) + total = query.count() + offset = (page - 1) * page_size + items = query.order_by(desc(Information.created_at)).offset(offset).limit(page_size).all() + return {"data": items, "pagination": {"page": page, "limit": page_size, "total": total}} diff --git a/frontend/index.html b/frontend/index.html index 03c4351..0e59670 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,7 +4,7 @@ - 甲辰收藏 v1.2.38 + 甲辰收藏 v0.0.0 diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 04cb53f..651c20d 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -69,7 +69,7 @@ export default function News() { // 寻配号对所有人公开,无需登录即可查看 const token = localStorage.getItem('token') // 根据tab获取不同类型的数据 - const type = activeTab === 'seek' ? 'seek' : 'deal' + const type = activeTab === 'seek' ? 'seek' : activeTab === 'deal' ? 'deal' : 'yichen' // 始终传递token,以便获取准确的matched_count const headers = token ? { Authorization: `Bearer ${token}` } : {} const res = await fetch(`${API_BASE}/api/information/list?info_type=${type}`, { headers }) @@ -315,7 +315,8 @@ export default function News() { // Tab切换 const tabs = [ { key: 'seek', label: '🔍 寻配号' }, - { key: 'deal', label: '💰 成交行情' } + { key: 'deal', label: '💰 成交行情' }, + { key: 'yichen', label: '📊 一尘看板' } ] const formatDate = (dateStr) => { @@ -435,7 +436,7 @@ export default function News() { )}

- {activeTab === 'seek' ? '🔍 寻配号信息' : '💰 成交行情信息'} + {activeTab === 'seek' ? '🔍 寻配号信息' : activeTab === 'deal' ? '💰 成交行情信息' : '📊 一尘看板'} {activeTab === 'seek' && (
@@ -450,7 +451,7 @@ export default function News() {
加载中...
) : infoList.length === 0 ? (
- 暂无{activeTab === 'seek' ? '寻配号' : '成交行情'}信息 + 暂无{activeTab === 'seek' ? '寻配号' : activeTab === 'deal' ? '成交行情' : '一尘看板'}信息
) : (