fix: 集团任职硬删除,杜绝 NULL 重复冒出多条
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -382,13 +382,13 @@ class ClubAdminAssignmentListView(APIView):
|
||||
if not yonghuid:
|
||||
return Response({'code': 400, 'msg': '需要 yonghuid 或 target_phone'})
|
||||
club_id = request.data.get('club_id')
|
||||
if club_id is not None and str(club_id).strip() == '':
|
||||
club_id = None
|
||||
elif club_id is not None:
|
||||
if club_id is None or str(club_id).strip() == '':
|
||||
club_id = ''
|
||||
else:
|
||||
club_id = str(club_id).strip()
|
||||
role_code = (request.data.get('role_code') or 'CLUB_ADMIN').strip()
|
||||
data_scope = (request.data.get('data_scope') or DATA_SCOPE_SINGLE).strip()
|
||||
if club_id is None:
|
||||
if not club_id:
|
||||
data_scope = DATA_SCOPE_ALL
|
||||
is_primary = bool(request.data.get('is_primary', False))
|
||||
_, err = create_or_reactivate_assignment(
|
||||
@@ -401,6 +401,8 @@ class ClubAdminAssignmentListView(APIView):
|
||||
)
|
||||
if err:
|
||||
return Response({'code': 400, 'msg': err})
|
||||
from jituan.services.admin_assignments import dedupe_active_assignments
|
||||
dedupe_active_assignments()
|
||||
return Response({'code': 0, 'msg': '任职已添加'})
|
||||
|
||||
if action == 'delete':
|
||||
@@ -410,8 +412,9 @@ class ClubAdminAssignmentListView(APIView):
|
||||
ok, err = deactivate_assignment(assignment_id)
|
||||
if not ok:
|
||||
return Response({'code': 404, 'msg': err or '停用失败'})
|
||||
from jituan.services.admin_assignments import dedupe_active_assignments
|
||||
dedupe_active_assignments()
|
||||
return Response({'code': 0, 'msg': '任职已停用'})
|
||||
return Response({'code': 0, 'msg': '任职已删除'})
|
||||
|
||||
if action == 'update':
|
||||
assignment_id = request.data.get('id')
|
||||
|
||||
Reference in New Issue
Block a user