From bdebbb934861d2cfa686d7a347e2b82b2dac2859 Mon Sep 17 00:00:00 2001 From: XingQue Date: Mon, 22 Jun 2026 16:50:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=8B=E6=9C=BA=E5=8F=B7=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E8=A7=84=E5=88=99=E8=A1=A5=E5=AD=90=E5=AE=A2=E6=9C=8D?= =?UTF-8?q?=E4=B8=8E=E6=89=93=E6=89=8B=E5=8E=86=E5=8F=B2=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- config/views.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/config/views.py b/config/views.py index 44437ed..7acb9ce 100644 --- a/config/views.py +++ b/config/views.py @@ -3234,6 +3234,7 @@ class CheckPhoneAuthView(APIView): 管事:已是管事(存在管事扩展表) 组长:已是组长(存在组长扩展表) 老板:有下单记录(alldingdan > 0) + 子客服:已是有效商家客服(merchant_staff_member 活跃) """ permission_classes = [IsAuthenticated] @@ -3254,18 +3255,32 @@ class CheckPhoneAuthView(APIView): return Response({'code': 0, 'need_auth': True}) if self._boss_meets_threshold(user): return Response({'code': 0, 'need_auth': True}) + if self._staff_meets_threshold(user): + return Response({'code': 0, 'need_auth': True}) return Response({'code': 0, 'need_auth': False}) + def _staff_meets_threshold(self, user): + """子客服:已是有效商家客服""" + try: + from merchant_ops.services.authz import get_active_staff_member + return get_active_staff_member(user) is not None + except Exception: + return False + def _dashou_meets_threshold(self, user): - """打手:有会员记录,或押金 > 0""" + """打手:有会员记录、押金 > 0、或有过接单/成交订单""" try: dashou = UserDashou.query.get(user=user) except UserDashou.DoesNotExist: return False if dashou.yajin and dashou.yajin > 0: return True - return Huiyuangoumai.query.filter(yonghu_id=user.UserUID).exists() + if Huiyuangoumai.query.filter(yonghu_id=user.UserUID).exists(): + return True + if (dashou.jiedanzongliang or 0) > 0 or (dashou.chengjiaozongliang or 0) > 0: + return True + return Order.query.filter(PlayerID=user.UserUID).exists() def _shangjia_meets_threshold(self, user): """商家:已是商家身份"""