修复订单支付显示方式
Build docker and publish / build (20.15.1) (push) Has been cancelled

This commit is contained in:
2026-03-04 23:20:36 -08:00
parent 70c0483ca9
commit 69ac1f104d
7 changed files with 56 additions and 9 deletions
@@ -45,7 +45,7 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderRequest) error {
Coupon: req.Coupon,
CouponDiscount: req.CouponDiscount,
PaymentId: req.PaymentId,
Method: paymentMethod.Token,
Method: normalizeOrderMethod("", paymentMethod.Platform),
FeeAmount: req.FeeAmount,
TradeNo: req.TradeNo,
Status: req.Status,
@@ -35,6 +35,15 @@ 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
}
+30
View File
@@ -0,0 +1,30 @@
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"
}
@@ -112,20 +112,26 @@ func (l *BindEmailWithVerificationLogic) BindEmailWithVerification(req *types.Bi
return nil, errors.Wrapf(xerr.NewErrCode(xerr.FamilyAlreadyBound), "email already bound to current user")
}
mergeHelper := newAccountMergeHelper(l.ctx, l.svcCtx)
if _, err = mergeHelper.mergeIntoOwner(existingMethod.UserId, u.Id, "bind_email_with_verification"); err != nil {
if err = familyHelper.validateJoinFamily(existingMethod.UserId, u.Id); err != nil {
return nil, err
}
token, err := l.refreshBindSessionToken(existingMethod.UserId)
joinResult, err := familyHelper.joinFamily(existingMethod.UserId, u.Id, "bind_email_with_verification")
if err != nil {
return nil, err
}
token, err := l.refreshBindSessionToken(u.Id)
if err != nil {
return nil, err
}
return &types.BindEmailWithVerificationResponse{
Success: true,
Message: "email bound successfully",
Token: token,
UserId: existingMethod.UserId,
Success: true,
Message: "joined family successfully",
Token: token,
UserId: u.Id,
FamilyJoined: true,
FamilyId: joinResult.FamilyId,
OwnerUserId: joinResult.OwnerUserId,
}, nil
}