feat: 封禁原因字段与身份状态刷新接口

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-27 05:40:50 +08:00
parent 40c489de39
commit 5b0db2c8fd
5 changed files with 84 additions and 4 deletions

View File

@@ -317,6 +317,7 @@ class KefuGetDashouDetailView(APIView):
'zaixianzhuangtai': dashou.zaixianzhuangtai,
'zhanghaozhuangtai': dashou.zhanghaozhuangtai,
'zhuangtai': dashou.zhuangtai,
'fengjin_yuanyin': getattr(dashou, 'fengjin_yuanyin', '') or '',
'nicheng': dashou.nicheng or '',
'chenghao': dashou.chenghao or '',
'dianhua': dashou.dianhua or '',
@@ -585,20 +586,33 @@ class KefuUpdateDashouView(APIView):
new_status = int(value)
if new_status not in [0, 1]:
return Response({'code': 400, 'msg': '状态值无效0=封禁,1=正常)'})
yuanyin = (request.data.get('yuanyin') or request.data.get('fengjin_yuanyin') or '').strip()
dashou_profile.zhanghaozhuangtai = new_status
dashou_profile.save()
if new_status == 0:
dashou_profile.fengjin_yuanyin = yuanyin[:200]
else:
dashou_profile.fengjin_yuanyin = ''
dashou_profile.save(update_fields=['zhanghaozhuangtai', 'fengjin_yuanyin'])
status_label = '正常' if new_status == 1 else '封禁'
old_label = '正常' if before['zhanghaozhuangtai'] == 1 else '封禁'
reason_part = f',原因={yuanyin}' if (new_status == 0 and yuanyin) else ''
write_xiugai_log(
yonghuid=dashou_id,
xiugaiid=kefu.user.Phone,
leixing=XIUGAI_LEIXING_DASHOU,
qitashuoming=(
f'【后台】修改打手账号状态:{old_label}{status_label}'
f'【后台】修改打手账号状态:{old_label}{status_label}{reason_part}'
f'打手ID={dashou_id},操作人={kefu.user.Phone}'
),
)
return Response({'code': 0, 'msg': '修改账号状态成功', 'data': {'new_zhanghaozhuangtai': new_status}})
return Response({
'code': 0,
'msg': '修改账号状态成功',
'data': {
'new_zhanghaozhuangtai': new_status,
'fengjin_yuanyin': dashou_profile.fengjin_yuanyin or '',
},
})
elif caozuo == 'gai_zaixianzhuangtai':
if '001ee' not in permissions: