修复订单支付显示方式
All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 7m59s

This commit is contained in:
shanshanzhong 2026-03-04 23:28:37 -08:00
parent 69ac1f104d
commit d962fafe7f
5 changed files with 1 additions and 42 deletions

View File

@ -405,7 +405,6 @@ type (
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
Method string `json:"method"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`

View File

@ -45,7 +45,7 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderRequest) error {
Coupon: req.Coupon,
CouponDiscount: req.CouponDiscount,
PaymentId: req.PaymentId,
Method: normalizeOrderMethod("", paymentMethod.Platform),
Method: paymentMethod.Token,
FeeAmount: req.FeeAmount,
TradeNo: req.TradeNo,
Status: req.Status,

View File

@ -35,15 +35,6 @@ func (l *GetOrderListLogic) GetOrderList(req *types.GetOrderListRequest) (resp *
resp = &types.GetOrderListResponse{}
resp.List = make([]types.Order, 0)
tool.DeepCopy(&resp.List, list)
for index := range resp.List {
resp.List[index].Method = normalizeOrderMethod(resp.List[index].Method, resp.List[index].Payment.Platform)
if resp.List[index].Payment.Platform == "" {
resp.List[index].Payment.Platform = resp.List[index].Method
}
if resp.List[index].Payment.Name == "" {
resp.List[index].Payment.Name = resp.List[index].Method
}
}
resp.Total = total
return
}

View File

@ -1,30 +0,0 @@
package order
import (
"strings"
paymentPlatform "github.com/perfect-panel/server/pkg/payment"
)
func canonicalOrderMethod(method string) string {
method = strings.TrimSpace(method)
if method == "" {
return ""
}
platform := paymentPlatform.ParsePlatform(method)
if platform == paymentPlatform.UNSUPPORTED {
return ""
}
return platform.String()
}
func normalizeOrderMethod(orderMethod string, paymentMethod string) string {
if method := canonicalOrderMethod(paymentMethod); method != "" {
return method
}
if method := canonicalOrderMethod(orderMethod); method != "" {
return method
}
return "unknown"
}

View File

@ -1433,7 +1433,6 @@ type Order struct {
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
Method string `json:"method"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`