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()