n
This commit is contained in:
Binary file not shown.
@@ -709,9 +709,17 @@ class OrderViewSet(viewsets.ModelViewSet):
|
|||||||
order.save()
|
order.save()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# 动态生成描述
|
||||||
|
if order.config:
|
||||||
|
description = f"购买 {order.config.name} x {order.quantity}"
|
||||||
|
elif order.course:
|
||||||
|
description = f"报名 {order.course.title}"
|
||||||
|
else:
|
||||||
|
description = f"支付订单 {order.id}"
|
||||||
|
|
||||||
# 统一下单 (JSAPI)
|
# 统一下单 (JSAPI)
|
||||||
code, message = wxpay.pay(
|
code, message = wxpay.pay(
|
||||||
description=f"购买 {order.config.name} x {order.quantity}",
|
description=description,
|
||||||
out_trade_no=out_trade_no,
|
out_trade_no=out_trade_no,
|
||||||
amount={'total': amount_in_cents, 'currency': 'CNY'},
|
amount={'total': amount_in_cents, 'currency': 'CNY'},
|
||||||
payer={'openid': user.openid}, # 小程序支付必须传 openid
|
payer={'openid': user.openid}, # 小程序支付必须传 openid
|
||||||
|
|||||||
Reference in New Issue
Block a user