修复支付以及订单相关的问题
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Failing after 1s

This commit is contained in:
2026-05-08 10:15:03 +08:00
parent 348cb4e670
commit 7c85a8cf29
6 changed files with 204 additions and 12 deletions

View File

@@ -35,6 +35,7 @@ type Service struct {
orderStore *postgres.OrderStore
rechargeOrderStore *postgres.RechargeOrderStore
agentRechargeStore *postgres.AgentRechargeStore
paymentStore *postgres.PaymentStore
auditService AuditServiceInterface
redis *redis.Client
logger *zap.Logger
@@ -46,6 +47,7 @@ func New(
orderStore *postgres.OrderStore,
rechargeOrderStore *postgres.RechargeOrderStore,
agentRechargeStore *postgres.AgentRechargeStore,
paymentStore *postgres.PaymentStore,
auditService AuditServiceInterface,
rdb *redis.Client,
logger *zap.Logger,
@@ -55,6 +57,7 @@ func New(
orderStore: orderStore,
rechargeOrderStore: rechargeOrderStore,
agentRechargeStore: agentRechargeStore,
paymentStore: paymentStore,
auditService: auditService,
redis: rdb,
logger: logger,
@@ -512,6 +515,17 @@ func (s *Service) GetConfigForCallback(ctx context.Context, orderNo string) (*mo
// resolvePaymentConfigID 按订单号前缀从对应表中取 payment_config_id
func (s *Service) resolvePaymentConfigID(ctx context.Context, orderNo string) (*uint, error) {
if s.paymentStore != nil {
payment, err := s.paymentStore.GetByPaymentNo(ctx, orderNo)
if err == nil {
if payment.PaymentConfigID != nil {
return payment.PaymentConfigID, nil
}
} else if err != gorm.ErrRecordNotFound {
return nil, err
}
}
switch {
case len(orderNo) >= 3 && orderNo[:3] == "ORD":
order, err := s.orderStore.GetByOrderNo(ctx, orderNo)