This commit is contained in:
parent
70c0483ca9
commit
69ac1f104d
@ -21,7 +21,7 @@ env:
|
|||||||
SSH_PASSWORD: ${{ github.ref_name == 'main' && vars.SSH_PASSWORD || vars.DEV_SSH_PASSWORD }}
|
SSH_PASSWORD: ${{ github.ref_name == 'main' && vars.SSH_PASSWORD || vars.DEV_SSH_PASSWORD }}
|
||||||
# TG通知
|
# TG通知
|
||||||
TG_BOT_TOKEN: 8114337882:AAHkEx03HSu7RxN4IHBJJEnsK9aPPzNLIk0
|
TG_BOT_TOKEN: 8114337882:AAHkEx03HSu7RxN4IHBJJEnsK9aPPzNLIk0
|
||||||
TG_CHAT_ID: "-49402438031"
|
TG_CHAT_ID: "-4940243803"
|
||||||
# Go构建变量
|
# Go构建变量
|
||||||
SERVICE: vpn
|
SERVICE: vpn
|
||||||
SERVICE_STYLE: vpn
|
SERVICE_STYLE: vpn
|
||||||
|
|||||||
@ -405,6 +405,7 @@ type (
|
|||||||
CouponDiscount int64 `json:"coupon_discount"`
|
CouponDiscount int64 `json:"coupon_discount"`
|
||||||
Commission int64 `json:"commission,omitempty"`
|
Commission int64 `json:"commission,omitempty"`
|
||||||
Payment PaymentMethod `json:"payment"`
|
Payment PaymentMethod `json:"payment"`
|
||||||
|
Method string `json:"method"`
|
||||||
FeeAmount int64 `json:"fee_amount"`
|
FeeAmount int64 `json:"fee_amount"`
|
||||||
TradeNo string `json:"trade_no"`
|
TradeNo string `json:"trade_no"`
|
||||||
Status uint8 `json:"status"`
|
Status uint8 `json:"status"`
|
||||||
|
|||||||
@ -45,7 +45,7 @@ func (l *CreateOrderLogic) CreateOrder(req *types.CreateOrderRequest) error {
|
|||||||
Coupon: req.Coupon,
|
Coupon: req.Coupon,
|
||||||
CouponDiscount: req.CouponDiscount,
|
CouponDiscount: req.CouponDiscount,
|
||||||
PaymentId: req.PaymentId,
|
PaymentId: req.PaymentId,
|
||||||
Method: paymentMethod.Token,
|
Method: normalizeOrderMethod("", paymentMethod.Platform),
|
||||||
FeeAmount: req.FeeAmount,
|
FeeAmount: req.FeeAmount,
|
||||||
TradeNo: req.TradeNo,
|
TradeNo: req.TradeNo,
|
||||||
Status: req.Status,
|
Status: req.Status,
|
||||||
|
|||||||
@ -35,6 +35,15 @@ func (l *GetOrderListLogic) GetOrderList(req *types.GetOrderListRequest) (resp *
|
|||||||
resp = &types.GetOrderListResponse{}
|
resp = &types.GetOrderListResponse{}
|
||||||
resp.List = make([]types.Order, 0)
|
resp.List = make([]types.Order, 0)
|
||||||
tool.DeepCopy(&resp.List, list)
|
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
|
resp.Total = total
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
30
internal/logic/admin/order/method.go
Normal file
30
internal/logic/admin/order/method.go
Normal 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")
|
return nil, errors.Wrapf(xerr.NewErrCode(xerr.FamilyAlreadyBound), "email already bound to current user")
|
||||||
}
|
}
|
||||||
|
|
||||||
mergeHelper := newAccountMergeHelper(l.ctx, l.svcCtx)
|
if err = familyHelper.validateJoinFamily(existingMethod.UserId, u.Id); err != nil {
|
||||||
if _, err = mergeHelper.mergeIntoOwner(existingMethod.UserId, u.Id, "bind_email_with_verification"); err != nil {
|
|
||||||
return nil, err
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &types.BindEmailWithVerificationResponse{
|
return &types.BindEmailWithVerificationResponse{
|
||||||
Success: true,
|
Success: true,
|
||||||
Message: "email bound successfully",
|
Message: "joined family successfully",
|
||||||
Token: token,
|
Token: token,
|
||||||
UserId: existingMethod.UserId,
|
UserId: u.Id,
|
||||||
|
FamilyJoined: true,
|
||||||
|
FamilyId: joinResult.FamilyId,
|
||||||
|
OwnerUserId: joinResult.OwnerUserId,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1433,6 +1433,7 @@ type Order struct {
|
|||||||
CouponDiscount int64 `json:"coupon_discount"`
|
CouponDiscount int64 `json:"coupon_discount"`
|
||||||
Commission int64 `json:"commission,omitempty"`
|
Commission int64 `json:"commission,omitempty"`
|
||||||
Payment PaymentMethod `json:"payment"`
|
Payment PaymentMethod `json:"payment"`
|
||||||
|
Method string `json:"method"`
|
||||||
FeeAmount int64 `json:"fee_amount"`
|
FeeAmount int64 `json:"fee_amount"`
|
||||||
TradeNo string `json:"trade_no"`
|
TradeNo string `json:"trade_no"`
|
||||||
Status uint8 `json:"status"`
|
Status uint8 `json:"status"`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user