showcase/wwwroot/api/showcase_post_update.dspy

15 lines
599 B
Plaintext

try:
data = {"id": params_kw.get('id', '')}
for f in ['title', 'description', 'content_url', 'thumbnail_url', 'tags',
'category', 'media_type', 'status', 'is_featured', 'price']:
v = params_kw.get(f)
if v is not None:
data[f] = v
if 'price' in data:
data['price'] = float(data['price'])
data['updated_at'] = curDateString()
result = await update_showcase_post(data)
return result
except Exception as e:
return {"widgettype":"Error","options":{"title":"操作失败","message":str(e),"cwidth":16,"cheight":9,"timeout":3}}