fix: 移除 /merchant-staff/me 每次请求全量同步角色权限,修复 4s 卡顿拖垮 worker

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-09 04:43:53 +08:00
parent b24501b48f
commit 45ce0183d8

View File

@@ -84,6 +84,7 @@ class StaffBindView(APIView):
shangjia = UserShangjia.query.filter(user__UserUID=inv.merchant_id).first()
if ctx and shangjia:
ctx['merchant_display'] = {'nicheng': shangjia.nicheng, 'merchant_id': inv.merchant_id}
ensure_merchant_roles(inv.merchant_id)
audit_staff(member, 'STAFF_BIND', request, resource_id=invite_code)
return Response({'code': 0, 'msg': '绑定成功', 'data': {'staff_context': ctx}})
except MerchantStaffInvite.DoesNotExist:
@@ -101,9 +102,6 @@ class StaffMeView(APIView):
if not ctx:
return Response({'code': 404, 'msg': '非子客服身份', 'data': None})
member = get_active_staff_member(request.user)
ensure_merchant_roles(member.merchant_id)
member.refresh_from_db()
ctx = resolve_staff_context(request.user)
shangjia = UserShangjia.query.filter(user__UserUID=member.merchant_id).first()
ctx['merchant_display'] = {
'nicheng': shangjia.nicheng if shangjia else '',