微信支付回调修复
This commit is contained in:
parent
235fe0f594
commit
93f8813c01
@ -297,28 +297,28 @@ async def wxpay_notify(request: Request):
|
|||||||
|
|
||||||
|
|
||||||
# 获取数据库连接
|
# 获取数据库连接
|
||||||
connection = get_connection()
|
# connection = get_connection()
|
||||||
cursor = connection.cursor(dictionary=True)
|
# cursor = connection.cursor(dictionary=True)
|
||||||
|
#
|
||||||
# 查询订单并锁定
|
# # 查询订单并锁定
|
||||||
cursor.execute("""
|
# cursor.execute("""
|
||||||
SELECT order_id, payable_price
|
# SELECT order_id, payable_price
|
||||||
FROM orders
|
# FROM orders
|
||||||
WHERE out_trade_no = %s
|
# WHERE out_trade_no = %s
|
||||||
FOR UPDATE""", (out_trade_no,))
|
# FOR UPDATE""", (out_trade_no,))
|
||||||
order = cursor.fetchone()
|
# order = cursor.fetchone()
|
||||||
|
#
|
||||||
cursor.execute("""
|
# cursor.execute("""
|
||||||
UPDATE orders SET
|
# UPDATE orders SET
|
||||||
order_status = 'completed',
|
# order_status = 'completed',
|
||||||
payment_method = 'wechat',
|
# payment_method = 'wechat',
|
||||||
wx_transaction_id = %s,
|
# wx_transaction_id = %s,
|
||||||
settlement_time = NOW()
|
# settlement_time = NOW()
|
||||||
WHERE order_id = %s""",
|
# WHERE order_id = %s""",
|
||||||
(transaction_id, order['order_id']))
|
# (transaction_id, order['order_id']))
|
||||||
|
#
|
||||||
|
#
|
||||||
connection.commit()
|
# connection.commit()
|
||||||
|
|
||||||
# 返回微信要求的成功响应
|
# 返回微信要求的成功响应
|
||||||
return JSONResponse(content={"code": "SUCCESS", "message": "OK"})
|
return JSONResponse(content={"code": "SUCCESS", "message": "OK"})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user