feat: update refund

This commit is contained in:
Rogee
2025-05-06 21:22:14 +08:00
parent 811ed3a41f
commit 1f8f2b0e96
2 changed files with 2 additions and 20 deletions

View File

@@ -52,16 +52,7 @@ func (ctl *orders) Refund(ctx fiber.Ctx, id int64) error {
OutTradeNo(order.OrderNo). OutTradeNo(order.OrderNo).
TransactionID(order.TransactionID). TransactionID(order.TransactionID).
CNYRefundAmount(refundTotal, refundTotal). CNYRefundAmount(refundTotal, refundTotal).
RefundReason("管理员退款"). RefundReason(fmt.Sprintf("%s 退款", post.Title))
RefundGoods([]wepay.RefundGoodsInfo{
{
MerchantGoodsID: fmt.Sprintf("%d", order.PostID),
GoodsName: post.Title,
RefundQuantity: 1,
RefundAmount: refundTotal,
UnitPrice: order.Price,
},
})
}) })
if err != nil { if err != nil {
return err return err

View File

@@ -2,7 +2,6 @@ package http
import ( import (
_ "embed" _ "embed"
"fmt"
"strconv" "strconv"
"time" "time"
@@ -280,15 +279,7 @@ func (ctl *posts) Buy(ctx fiber.Ctx, id int64, user *model.Users) (*wechat.JSAPI
Description(post.Title). Description(post.Title).
OutTradeNo(order.OrderNo). OutTradeNo(order.OrderNo).
Payer(user.OpenID). Payer(user.OpenID).
CNYAmount(payPrice). CNYAmount(payPrice)
Detail([]wepay.GoodsInfo{
{
GoodsName: post.Title,
UnitPrice: payPrice,
MerchantGoodsID: fmt.Sprintf("%d", post.ID),
Quantity: 1,
},
})
}) })
if err != nil { if err != nil {
log.Errorf("wepay.V3TransactionJsapi err: %v", err) log.Errorf("wepay.V3TransactionJsapi err: %v", err)