fix: 不轮询清单审查问题
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 9m31s
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:
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/csv"
|
||||
"encoding/json"
|
||||
stderrors "errors"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/auditcontext"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -77,6 +78,8 @@ func (h *PollingStatusImportHandler) Handle(ctx context.Context, t *asynq.Task)
|
||||
}
|
||||
rowCtx := pollingpause.WithOrigin(ctx, pollingpause.Origin{Source: constants.PollingToggleSourceImport, Reason: task.Reason,
|
||||
ImportTaskID: task.ID, OperatorID: task.Creator})
|
||||
rowCtx = auditcontext.With(rowCtx, auditcontext.Context{ActorKind: constants.AuditActorSystemTask, ActorID: constants.TaskTypePollingStatusImport,
|
||||
ActorName: "轮询开关导入任务", Source: constants.AuditSourceWorker, CorrelationID: task.TaskNo})
|
||||
results := make(model.PollingStatusImportResults, 0, len(identifiers))
|
||||
success, skipped, failed := 0, 0, 0
|
||||
for index, identifier := range identifiers {
|
||||
@@ -131,8 +134,16 @@ func (h *PollingStatusImportHandler) resolve(ctx context.Context, assetType, ide
|
||||
err := h.db.WithContext(ctx).Select("id").Where("imei = ? OR virtual_no = ?", identifier, identifier).Order("id").First(&device).Error
|
||||
return device.ID, err
|
||||
}
|
||||
// 与 IotCardStore.GetByICCID 同口径:19 位按 iccid_19、20 位按 iccid_20 匹配(联通卡两种位数都可识别)。
|
||||
column := "iccid"
|
||||
switch len(identifier) {
|
||||
case 19:
|
||||
column = "iccid_19"
|
||||
case 20:
|
||||
column = "iccid_20"
|
||||
}
|
||||
var card model.IotCard
|
||||
err := h.db.WithContext(ctx).Select("id").Where("iccid = ?", identifier).First(&card).Error
|
||||
err := h.db.WithContext(ctx).Select("id").Where(column+" = ?", identifier).First(&card).Error
|
||||
return card.ID, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user