feat: 俱乐部订单单向互通抢单(集团配置 + 接单池/抢单校验)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -124,8 +124,9 @@ class DashouDingdanHuoquView(APIView):
|
||||
yonghuid, club_id=club_id,
|
||||
)
|
||||
|
||||
# 2. 构建基础查询条件
|
||||
base_query = Q(Status__in=[1, 7])
|
||||
# 2. 构建基础查询条件:本店待抢单 + 集团配置的单向互通店
|
||||
from jituan.services.order_grab_share import order_club_q_for_grabber
|
||||
base_query = Q(Status__in=[1, 7]) & order_club_q_for_grabber(club_id)
|
||||
if leixing_id is not None:
|
||||
base_query &= Q(ProductTypeID=leixing_id)
|
||||
|
||||
@@ -469,6 +470,13 @@ class QiangdanView(APIView):
|
||||
return Response({'code': 400, 'msg': order_result})
|
||||
order = order_result
|
||||
|
||||
# 2.1 俱乐部互通:只能抢本店或已授权可抢的对方店订单
|
||||
from jituan.services.club_context import resolve_effective_club_id
|
||||
from jituan.services.order_grab_share import can_grabber_take_order_club
|
||||
grabber_club = resolve_effective_club_id(request, request.user)
|
||||
if not can_grabber_take_order_club(grabber_club, getattr(order, 'ClubID', None)):
|
||||
return Response({'code': 403, 'msg': '无权抢该俱乐部订单'})
|
||||
|
||||
validation_result = self._validate_order_requirements(order, dashou_profile, request.user.UserUID)
|
||||
if not validation_result['success']:
|
||||
return Response({'code': 400, 'msg': validation_result['message']})
|
||||
|
||||
Reference in New Issue
Block a user