fix: 不轮询清单审查问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m31s

- 写清单 ON CONFLICT 的部分索引谓词改为字面量:预编译语句的通用执行计划下参数化谓词匹配不到部分唯一索引,第 6 次起关闭轮询全部失败
- 轮询开关审计允许 Worker、开放接口、C 端与支付回调来源;导入与自动恢复补审计操作者
- 文件导入按 19/20 位 ICCID 匹配
- 钱包重复支付不再恢复轮询

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
邹进
2026-10-26 03:18:54 +09:00
parent 7ddb9312e3
commit 4139732719
5 changed files with 49 additions and 3 deletions

View File

@@ -1772,6 +1772,7 @@ func (s *Service) createWalletPaymentRecord(tx *gorm.DB, order *model.Order, pay
}
func (s *Service) WalletPay(ctx context.Context, orderID uint, buyerType string, buyerID uint) (err error) {
alreadyPaid := false
order, err := s.orderStore.GetByID(ctx, orderID)
if err != nil {
if err == gorm.ErrRecordNotFound {
@@ -1852,6 +1853,7 @@ func (s *Service) WalletPay(ctx context.Context, orderID uint, buyerType string,
switch currentOrder.PaymentStatus {
case model.PaymentStatusPaid:
alreadyPaid = true
return nil
case model.PaymentStatusCancelled:
return errors.New(errors.CodeInvalidStatus, "订单已取消,无法支付")
@@ -1912,6 +1914,7 @@ func (s *Service) WalletPay(ctx context.Context, orderID uint, buyerType string,
switch currentOrder.PaymentStatus {
case model.PaymentStatusPaid:
alreadyPaid = true
return nil
case model.PaymentStatusCancelled:
return errors.New(errors.CodeInvalidStatus, "订单已取消,无法支付")
@@ -1974,7 +1977,10 @@ func (s *Service) WalletPay(ctx context.Context, orderID uint, buyerType string,
if err != nil {
return err
}
s.afterOrderActivated(ctx, order, false)
if !alreadyPaid {
// 重复支付请求不再恢复轮询,避免把运营在两次请求之间刚关闭的轮询重新打开。
s.afterOrderActivated(ctx, order, false)
}
return nil
}

View File

@@ -3,6 +3,7 @@ package polling
import (
"context"
stderrors "errors"
"github.com/break/junhong_cmp_fiber/pkg/auditcontext"
"time"
"go.uber.org/zap"
@@ -259,6 +260,10 @@ func (s *AssetPollingService) RestoreAssetPolling(ctx context.Context, assetType
return false
}
ctx = pollingpause.WithOrigin(ctx, pollingpause.Origin{Source: source, Reason: constants.PollingToggleSourceName(source) + ",自动恢复轮询"})
if auditcontext.From(ctx).ActorKind == "" {
ctx = auditcontext.With(ctx, auditcontext.Context{ActorKind: constants.AuditActorSystemTask, ActorID: "polling_auto_restore",
ActorName: "套餐生效自动恢复轮询", Source: constants.AuditSourceWorker})
}
restored := false
switch assetType {
case constants.AssetTypeIotCard: