discount/wwwroot/api/gen_promo_from_mkt.dspy

18 lines
791 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 从营销方案直接生成促销码toolbar 工具按钮调用)
marketing_id = params_kw.get('marketing_id', '')
if not marketing_id:
return {"widgettype": "Error", "options": {"title": "操作失败", "message": "缺少方案ID", "cwidth": 16, "cheight": 9, "timeout": 3}}
result = await generate_promo_code(request, {"marketing_id": marketing_id})
if result.get("status") == "success":
return {
"widgettype": "Message",
"options": {
"title": "促销码已生成",
"message": "促销码: " + result["code"],
"type": "success",
"timeout": 5
}
}
return {"widgettype": "Error", "options": {"title": "操作失败", "message": str(result.get("message", "")), "cwidth": 16, "cheight": 9, "timeout": 3}}