优化:列表接口移除网络匹配实时计算,提升加载速度
- seek.py /list 端点不再实时计算 network_matched_count
- 网络匹配仅在点击时通过 /network-match/{id} 单独查询
This commit is contained in:
parent
e6a0b4fb34
commit
41b3353613
|
|
@ -102,15 +102,7 @@ def get_seek_list(
|
||||||
user = db.query(User).filter(User.f99_90_id == item.user_id).first()
|
user = db.query(User).filter(User.f99_90_id == item.user_id).first()
|
||||||
user_name = user.f01_01_name if user else '匿名用户'
|
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_self_collections_count(db, current_user.f99_90_id, item.expect_number)
|
|
||||||
network_matched_count = match_collections_count_from_coolbot(item.expect_number)
|
|
||||||
|
|
||||||
# 构建响应
|
|
||||||
result.append(SeekInfoResponse(
|
result.append(SeekInfoResponse(
|
||||||
id=item.id,
|
id=item.id,
|
||||||
user_id=item.user_id,
|
user_id=item.user_id,
|
||||||
|
|
@ -131,8 +123,8 @@ def get_seek_list(
|
||||||
created_at=item.created_at,
|
created_at=item.created_at,
|
||||||
updated_at=item.updated_at,
|
updated_at=item.updated_at,
|
||||||
user_name=user_name,
|
user_name=user_name,
|
||||||
matched_count=matched_count,
|
matched_count=0,
|
||||||
network_matched_count=network_matched_count
|
network_matched_count=0
|
||||||
))
|
))
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue