fix: 修复network_matched_count显示为0的问题
News.jsx: 0.0.5 → 0.0.6 seek.py: 0.0.6 → 0.0.7
This commit is contained in:
parent
877f314617
commit
3a2258d2d3
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
<div style={{ marginBottom: '8px' }}>
|
||||
{comments[item.id].map((c, idx) => (
|
||||
<div key={c.id || idx} style={{ padding: '8px 0', borderBottom: '1px solid #334155' }}>
|
||||
<div style={{ color: '#3b82f6', fontSize: '12px', marginBottom: '4px' }}>{c.user_name || '匿名用户'}</div>
|
||||
<div style={{ color: '#3b82f6', fontSize: '12px', marginBottom: '4px' }}>
|
||||
{c.user_name || '匿名用户'}
|
||||
{c.created_at && <span style={{ color: '#64748b', marginLeft: '8px' }}>{new Date(c.created_at).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}</span>}
|
||||
</div>
|
||||
<div style={{ color: '#e2e8f0', fontSize: '13px' }}>{c.content}</div>
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Reference in New Issue