fix: 未上传的配置型大背景后台列表不再返回假默认图
避免图标管理预览 404,并明确 is_uploaded 状态,方便前端展示上传按钮。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -12,6 +12,7 @@ from jituan.services.club_context import resolve_effective_club_id
|
||||
from jituan.services.display_config import forbid_display_write_in_all_scope, list_response_meta
|
||||
from jituan.services.miniapp_assets import (
|
||||
ICON_FOLDER,
|
||||
CONFIG_ONLY_DELIVERY_KEYS,
|
||||
MINIAPP_ICON_LABELS,
|
||||
MINIAPP_ICON_META,
|
||||
POSTER_FOLDER,
|
||||
@@ -49,13 +50,21 @@ class ClubMiniappIconListView(APIView):
|
||||
items = []
|
||||
for key, label in MINIAPP_ICON_META:
|
||||
row = icons_db.get(key)
|
||||
uploaded = bool(row and row.is_uploaded and (row.image_path or '').strip())
|
||||
if uploaded:
|
||||
image_path = row.image_path.strip()
|
||||
elif key in CONFIG_ONLY_DELIVERY_KEYS:
|
||||
# 未上传的大背景不回默认路径,避免后台预览 404、误以为已配置
|
||||
image_path = ''
|
||||
else:
|
||||
image_path = (row.image_path if row else '') or default_icon_path(key)
|
||||
items.append({
|
||||
'icon_key': key,
|
||||
'label': label,
|
||||
'image_path': (row.image_path if row else '') or default_icon_path(key),
|
||||
'image_path': image_path,
|
||||
'description': (row.description if row else '') or '',
|
||||
'is_active': row.is_active if row else True,
|
||||
'is_uploaded': row.is_uploaded if row else False,
|
||||
'is_uploaded': uploaded,
|
||||
'id': row.id if row else None,
|
||||
})
|
||||
return Response({
|
||||
|
||||
Reference in New Issue
Block a user