fix
This commit is contained in:
parent
740464a8ec
commit
0bc383eba4
@ -62,6 +62,7 @@ func (l *PaymentLogic) Payment(req *types.PaymentReq) (resp *types.PaymentResp,
|
||||
orderReq := &service.CreateOrderRequest{
|
||||
PayMethod: payMethod,
|
||||
ProductEn: data.Product,
|
||||
OrderNo: outTradeNo,
|
||||
}
|
||||
|
||||
orderResp, err := l.svcCtx.PayService.CreateOrder(l.ctx, orderReq)
|
||||
|
@ -116,7 +116,7 @@ func (p *PayService) CreateOrder(ctx context.Context, req *CreateOrderRequest) (
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("获取用户失败: %v", err)
|
||||
}
|
||||
var outTradeNo string
|
||||
outTradeNo := req.OrderNo
|
||||
var orderID int64
|
||||
amount := product.SellPrice
|
||||
if user.Inside == 1 {
|
||||
@ -129,15 +129,15 @@ func (p *PayService) CreateOrder(ctx context.Context, req *CreateOrderRequest) (
|
||||
switch req.PayMethod {
|
||||
case "alipay":
|
||||
orderReq := &payment.AlipayCreateOrderRequest{
|
||||
Amount: amount,
|
||||
Subject: product.ProductName,
|
||||
Platform: payment.PlatformH5,
|
||||
Amount: amount,
|
||||
Subject: product.ProductName,
|
||||
Platform: payment.PlatformH5,
|
||||
OutTradeNo: outTradeNo,
|
||||
}
|
||||
resp, err := p.alipayService.CreateOrder(ctx, orderReq)
|
||||
if err != nil {
|
||||
return fmt.Errorf("创建支付宝订单失败: %v", err)
|
||||
}
|
||||
outTradeNo = resp.OrderNo
|
||||
payData = resp.PayParams
|
||||
case "wechat":
|
||||
orderReq := &payment.Order{
|
||||
@ -465,6 +465,7 @@ const (
|
||||
type CreateOrderRequest struct {
|
||||
PayMethod PayMethod `json:"pay_method"` // 支付方式:alipay, wechat, apple
|
||||
ProductEn string `json:"product_en"` // 商品英文名
|
||||
OrderNo string `json:"order_no"` // 订单号
|
||||
}
|
||||
|
||||
type CreateOrderResponse struct {
|
||||
|
Loading…
Reference in New Issue
Block a user