's'
This commit is contained in:
@@ -60,7 +60,12 @@ async def nomadvip_payh5(item: dict):
|
||||
@router.post("/payh5/redirect")
|
||||
async def nomadvip_payh5_redirect(item: dict, request: Request):
|
||||
"""nomadvip 专用:ZPAY mapi 接口"""
|
||||
total_fee = float(item.get("total_fee", 8800))
|
||||
logging.info(f"nomadvip payh5/redirect 请求: item={item}")
|
||||
try:
|
||||
total_fee = float(item.get("total_fee", 8800))
|
||||
except (TypeError, ValueError):
|
||||
logging.warning(f"nomadvip payh5/redirect 无效 total_fee: {item.get('total_fee')}")
|
||||
total_fee = 8800.0
|
||||
total_fee_yuan = f"{total_fee / 100:.2f}"
|
||||
user_id = item.get("user_id", "unknown")
|
||||
pay_type = (item.get("type") or "vip").lower()
|
||||
@@ -88,7 +93,9 @@ async def nomadvip_payh5_redirect(item: dict, request: Request):
|
||||
device=device,
|
||||
)
|
||||
if result.get("status") != "ok":
|
||||
raise HTTPException(status_code=500, detail=result.get("msg", "ZPAY mapi 创建订单失败"))
|
||||
err_msg = result.get("msg", "ZPAY mapi 创建订单失败")
|
||||
logging.error(f"nomadvip payh5/redirect ZPAY 创建订单失败: {err_msg}, result={result}")
|
||||
raise HTTPException(status_code=500, detail=err_msg)
|
||||
payurl = result.get("payurl")
|
||||
payurl2 = result.get("payurl2")
|
||||
img = result.get("img")
|
||||
@@ -104,6 +111,7 @@ async def nomadvip_payh5_redirect(item: dict, request: Request):
|
||||
return RedirectResponse(url=payurl2, status_code=302, headers=headers)
|
||||
if payurl:
|
||||
return RedirectResponse(url=payurl, status_code=302, headers=headers)
|
||||
logging.error(f"nomadvip payh5/redirect ZPAY 未返回支付链接: device={device}, channel={channel}, result keys={list(result.keys())}")
|
||||
raise HTTPException(status_code=500, detail="ZPAY 未返回支付链接")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user