From 3a2258d2d3aa8b6a93563808c98af3eb02a4ef80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Fri, 24 Apr 2026 14:02:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dnetwork=5Fmatched=5Fco?= =?UTF-8?q?unt=E6=98=BE=E7=A4=BA=E4=B8=BA0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit News.jsx: 0.0.5 → 0.0.6 seek.py: 0.0.6 → 0.0.7 --- backend/app/routers/seek.py | 13 ++++++++----- frontend/src/pages/News.jsx | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/backend/app/routers/seek.py b/backend/app/routers/seek.py index bec1853..16130ff 100644 --- a/backend/app/routers/seek.py +++ b/backend/app/routers/seek.py @@ -1,6 +1,6 @@ # seek - 寻配号路由 -# Version: 0.0.6 (2026-04-24) -# 更新:添加matched_count计算,留言功能迁移到seek.py +# Version: 0.0.7 (2026-04-24) +# 更新:添加network_matched_count计算 from fastapi import APIRouter, Depends, Query, HTTPException from sqlalchemy.orm import Session @@ -11,7 +11,7 @@ from app.core.database import get_db from app.core.auth import get_current_user from app.models.seek_info import SeekInfo from app.models.models import User, Collection -from app.routers.information import match_collections_count +from app.routers.information import match_collections_count, match_collections_count_from_coolbot from app.utils.coolbot_matcher import ( match_pattern, match_self_collections_count, @@ -104,11 +104,14 @@ def get_seek_list( user_name = user.f01_01_name if user else '匿名用户' # 构建响应(不实时计算网络匹配,网络匹配在点击时再查) - # 计算自有匹配数量 + # 计算自有匹配数量和网络匹配数量 matched_count = 0 + network_matched_count = 0 if item.expect_number and len(item.expect_number) == 10: if current_user and current_user.f99_90_id: matched_count = match_collections_count(db, current_user.f99_90_id, item.expect_number) + # 网络匹配数量(需要一定时间,可以返回0让用户点击时再计算) + network_matched_count = match_collections_count_from_coolbot(item.expect_number) result.append(SeekInfoResponse( id=item.id, @@ -131,7 +134,7 @@ def get_seek_list( updated_at=item.updated_at, user_name=user_name, matched_count=matched_count, - network_matched_count=0 + network_matched_count=network_matched_count )) return result diff --git a/frontend/src/pages/News.jsx b/frontend/src/pages/News.jsx index 9f9b9fb..d592716 100644 --- a/frontend/src/pages/News.jsx +++ b/frontend/src/pages/News.jsx @@ -1,7 +1,7 @@ /** * News - 资讯列表页面 - * Version: 0.0.5 (2026-04-24) - * 更新:API统一到/api/seek/*,留言功能迁移 + * Version: 0.0.6 (2026-04-24) + * 更新:网络匹配数量正确显示 */ import React, { useState, useEffect } from 'react' @@ -962,7 +962,10 @@ export default function News() {
{comments[item.id].map((c, idx) => (
-
{c.user_name || '匿名用户'}
+
+ {c.user_name || '匿名用户'} + {c.created_at && {new Date(c.created_at).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}} +
{c.content}
))}