From 1ae4796e1a7b1f8186336f85efe59ab8ede61cc0 Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 27 Jul 2026 04:57:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20wdlyhdl=20=E4=B8=8D=E5=86=8D=E6=8A=8A?= =?UTF-8?q?=E5=95=86=E5=AE=B6/=E7=AE=A1=E4=BA=8B=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=86=99=E6=88=90=E6=81=92=E4=B8=BA1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- users/views/auth.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/users/views/auth.py b/users/views/auth.py index 4f218c6..a357564 100644 --- a/users/views/auth.py +++ b/users/views/auth.py @@ -658,8 +658,8 @@ class DashouZhuceView(APIView): data['clumber'] = huiyuan_goumai_list data['dashoustatus'] = 1 - data['guanshistatus'] = 1 if hasattr(current_user, 'GuanshiProfile') else 0 - data['shangjiastatus'] = 1 if hasattr(current_user, 'ShangjiaProfile') else 0 + data['guanshistatus'] = 1 if UserGuanshi.query.filter(user=current_user).exists() else 0 + data['shangjiastatus'] = 1 if UserShangjia.query.filter(user=current_user).exists() else 0 return data @@ -1118,10 +1118,10 @@ class WechatLoginAndDashouRegisterView(APIView): except UserBoss.DoesNotExist: pass - # 检查各身份状态(这里用户已是打手,所以都是1) + # 检查各身份状态(已是打手 ≠ 已是商家/管事,必须按表真实查询) dashou_status = 1 - shangjia_status = 1 if UserShangjia.query.filter(user=user_main).exists() else 1 # 确保是1 - guanshi_status = 1 if UserGuanshi.query.filter(user=user_main).exists() else 1 # 确保是1 + shangjia_status = 1 if UserShangjia.query.filter(user=user_main).exists() else 0 + guanshi_status = 1 if UserGuanshi.query.filter(user=user_main).exists() else 0 # 生成token refresh = RefreshToken.for_user(user_main) @@ -1169,10 +1169,10 @@ class WechatLoginAndDashouRegisterView(APIView): except UserBoss.DoesNotExist: pass - # 身份状态(刚注册成功,应该都是1) + # 刚注册成功:仅打手为1;商家/管事按真实身份 dashou_status = 1 - shangjia_status = 1 - guanshi_status = 1 + shangjia_status = 1 if UserShangjia.query.filter(user=user_main).exists() else 0 + guanshi_status = 1 if UserGuanshi.query.filter(user=user_main).exists() else 0 # 获取群配置 group_info = self.huoquQunPeizhi()