fix: 添加后台用户不再硬编码绑定客服角色,按所选俱乐部角色分配
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -870,11 +870,13 @@ class AddAdminUserView(APIView):
|
||||
|
||||
if not isinstance(role_codes, list):
|
||||
return Response({'code': 400, 'msg': 'role_codes 格式错误'})
|
||||
if not role_codes:
|
||||
return Response({'code': 400, 'msg': '请至少选择一个角色'})
|
||||
|
||||
# 分配角色(默认客服 + 所选角色,去重;任一角色找不到则整单拒绝)
|
||||
# 仅绑定前端所选角色(各俱乐部角色名不同,勿硬编码「客服」)
|
||||
role_names_to_bind = []
|
||||
seen_names = set()
|
||||
for name in (['客服'] if '客服' not in role_codes else []) + list(role_codes):
|
||||
for name in role_codes:
|
||||
n = (name or '').strip()
|
||||
if n and n not in seen_names:
|
||||
seen_names.add(n)
|
||||
|
||||
Reference in New Issue
Block a user