fix: icon_key 无效时回传具体 key,并提示需更新接单池背景相关版本

便于定位是空 key 还是服务器未 pull/未重启导致 grab_card_* 未注册。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-25 20:56:00 +08:00
parent 3c017e2ad4
commit 0f7e5c503c

View File

@@ -98,9 +98,20 @@ class ClubMiniappIconManageView(APIView):
action = (request.data.get('action') or 'upload').strip()
club_id = resolve_effective_club_id(request, request.user)
icon_key = (request.data.get('icon_key') or '').strip()
raw_key = request.data.get('icon_key')
if raw_key is None or raw_key == '':
raw_key = request.query_params.get('icon_key')
if isinstance(raw_key, (list, tuple)):
raw_key = raw_key[0] if raw_key else ''
icon_key = str(raw_key or '').strip()
if icon_key not in MINIAPP_ICON_LABELS:
return Response({'code': 400, 'msg': 'icon_key 无效'})
return Response({
'code': 400,
'msg': (
f'icon_key 无效: {icon_key or "(空)"}'
'若上传接单池卡背景,请确认 Django 已 pull 到含 grab_card_* 的提交并重启进程'
),
})
if action == 'save_meta':
description = (request.data.get('description') or '').strip()