相关问题优化以及新功能开发
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m57s

迁移 155- 157
This commit is contained in:
2026-06-22 17:21:13 +09:00
parent 2885b503b3
commit 5c2ef97c24
45 changed files with 1201 additions and 82 deletions

View File

@@ -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),