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