相关问题优化以及新功能开发
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m57s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m57s
迁移 155- 157
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
@@ -619,11 +618,11 @@ func (s *Service) Resubmit(ctx context.Context, id uint, req *dto.ResubmitRefund
|
||||
}
|
||||
refundVoucherKey := refund.RefundVoucherKey
|
||||
if req.RefundVoucherKey != nil {
|
||||
refundVoucherKey = *req.RefundVoucherKey
|
||||
}
|
||||
refundVoucherKey, err = normalizeRefundVoucherKey(refundVoucherKey)
|
||||
if err != nil {
|
||||
return err
|
||||
normalized, normErr := normalizeRefundVoucherKey(*req.RefundVoucherKey)
|
||||
if normErr != nil {
|
||||
return normErr
|
||||
}
|
||||
refundVoucherKey = normalized
|
||||
}
|
||||
|
||||
order, err := s.orderStore.GetByID(ctx, refund.OrderID)
|
||||
@@ -914,15 +913,14 @@ func validateApprovedRefundAmount(approvedAmount int64, requestedRefundAmount in
|
||||
return validateRequestedRefundAmountByOrder(approvedAmount, order)
|
||||
}
|
||||
|
||||
func normalizeRefundVoucherKey(voucherKey string) (string, error) {
|
||||
normalized := strings.TrimSpace(voucherKey)
|
||||
if normalized == "" {
|
||||
return "", errors.New(errors.CodeInvalidParam, "退款申请必须上传退款凭证")
|
||||
func normalizeRefundVoucherKey(keys []string) (model.StringJSONBArray, error) {
|
||||
if len(keys) == 0 {
|
||||
return nil, errors.New(errors.CodeInvalidParam, "退款申请必须上传退款凭证")
|
||||
}
|
||||
if len(normalized) > 500 {
|
||||
return "", errors.New(errors.CodeInvalidParam, "退款凭证长度不能超过500")
|
||||
if len(keys) > 5 {
|
||||
return nil, errors.New(errors.CodeInvalidParam, "退款凭证最多上传5个")
|
||||
}
|
||||
return normalized, nil
|
||||
return model.StringJSONBArray(keys), nil
|
||||
}
|
||||
|
||||
// buildRefundResponse 将退款 Model 转换为 DTO 响应
|
||||
@@ -949,7 +947,7 @@ func buildRefundResponse(r *model.RefundRequest) *dto.RefundResponse {
|
||||
ActualReceivedAmount: r.ActualReceivedAmount,
|
||||
RequestedRefundAmount: r.RequestedRefundAmount,
|
||||
ApprovedRefundAmount: r.ApprovedRefundAmount,
|
||||
RefundVoucherKey: r.RefundVoucherKey,
|
||||
RefundVoucherKey: []string(r.RefundVoucherKey),
|
||||
RefundReason: r.RefundReason,
|
||||
Status: r.Status,
|
||||
StatusName: constants.GetRefundStatusName(r.Status),
|
||||
|
||||
Reference in New Issue
Block a user