进行了完整的视图拆分,同步了 merchant_ops 的修改
This commit is contained in:
@@ -35,7 +35,6 @@ class StaffBindView(APIView):
|
||||
|
||||
def post(self, request):
|
||||
try:
|
||||
assert_can_bind_staff(request.user)
|
||||
invite_code = str(request.data.get('inviteCode') or request.data.get('invite_code') or '').strip()
|
||||
if not invite_code or invite_code == 'XQKF2026':
|
||||
return Response({'code': 400, 'msg': '请使用商家提供的一次性邀请码', 'data': None})
|
||||
@@ -44,6 +43,7 @@ class StaffBindView(APIView):
|
||||
inv = MerchantStaffInvite.objects.select_for_update().get(
|
||||
invite_code=invite_code, status=INVITE_STATUS_UNUSED,
|
||||
)
|
||||
assert_can_bind_staff(request.user, invite_merchant_id=inv.merchant_id)
|
||||
if inv.expire_at and inv.expire_at < timezone.now():
|
||||
inv.status = 3
|
||||
inv.save(update_fields=['status'])
|
||||
|
||||
Reference in New Issue
Block a user