fix: kefu permissions use legacy permission table instead of gvsdsdk

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-28 23:59:32 +08:00
parent c336a893a0
commit 42cb117a8a
6 changed files with 183 additions and 207 deletions

View File

@@ -6926,13 +6926,14 @@ class KefuStatsView(APIView):
logger.warning(f"统计接口 phone 不匹配: 请求phone={phone}, 用户phone={current_user.Phone}")
return Response({'detail': '认证失败'}, status=status.HTTP_401_UNAUTHORIZED)
# 4. 验证用户类型是否为客服
if current_user.UserType not in ('kefu', 'admin'):
# 4. 验证是否为后台客服账号
from jituan.services.admin_context import is_kefu_backend_account, is_system_super_admin
if not is_kefu_backend_account(current_user):
logger.warning(f"统计接口用户类型非客服: {current_user.UserUID}")
return Response({'detail': '认证失败'}, status=status.HTTP_401_UNAUTHORIZED)
# 5. 尝试获取客服扩展表数据(管理员跳过)
is_admin = current_user.UserType == 'admin' or current_user.IsSuperuser
is_admin = is_system_super_admin(current_user)
if is_admin:
return Response({
'code': 0,