From 7972638e80c68e137ae4dbbac060d5354895a196 Mon Sep 17 00:00:00 2001 From: aaron <> Date: Mon, 17 Feb 2025 13:52:14 +0800 Subject: [PATCH] update --- app/api/endpoints/user.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/endpoints/user.py b/app/api/endpoints/user.py index 8988a28..c2f214f 100644 --- a/app/api/endpoints/user.py +++ b/app/api/endpoints/user.py @@ -121,7 +121,6 @@ async def get_user_info( ): """获取用户信息""" - # 获取用户默认地址 default_address = db.query(AddressDB, CommunityDB.name.label('community_name')).join( CommunityDB, @@ -134,6 +133,11 @@ async def get_user_info( # 构建返回数据 user_info = UserInfo.model_validate(current_user) user_data = user_info.model_dump() + + # 获取用户归属小区信息 + if current_user.community_id: + user_data['community_id'] = current_user.community_id + user_data['community_name'] = db.query(CommunityDB.name).filter(CommunityDB.id == current_user.community_id).first().name # 处理默认地址 if default_address: