feat: 为四种现有轮询 Handler 添加 verbose log 输出

realname: verbose log 移入 gateway 块内,避免 gateway=nil 时输出零值
carddata: 添加 && h.gateway != nil 门卫,确保仅 gateway 查询成功时输出
package: verbose log 在 freshCard 加载后、EvaluateAndAct 之前输出
protect: 引入 actionTaken 变量,字段名 network_status → network_status_at_check,新增 action_taken

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-15 12:22:25 +08:00
parent 6292443f69
commit 71559547b6
4 changed files with 41 additions and 0 deletions

View File

@@ -72,6 +72,7 @@ func (h *PollingRealnameHandler) Handle(ctx context.Context, t *asynq.Task) erro
}
var newStatus int
var realStatusBool bool
if h.gateway != nil {
result, gwErr := h.gateway.QueryRealnameStatus(ctx, &gateway.CardStatusReq{CardNo: card.ICCID})
if gwErr != nil {
@@ -80,11 +81,20 @@ func (h *PollingRealnameHandler) Handle(ctx context.Context, t *asynq.Task) erro
h.base.updateStats(ctx, constants.TaskTypePollingRealname, false, time.Since(startTime))
return h.base.requeueCard(ctx, cardID, constants.TaskTypePollingRealname)
}
realStatusBool = result.RealStatus
if result.RealStatus {
newStatus = constants.RealNameStatusVerified
} else {
newStatus = constants.RealNameStatusNotVerified
}
if h.base.verboseLog {
h.base.logger.Info("实名状态轮询详情",
zap.Uint("card_id", cardID),
zap.String("iccid", card.ICCID),
zap.Bool("real_status", realStatusBool),
zap.Int("new_status", newStatus),
zap.Bool("changed", newStatus != card.RealNameStatus))
}
} else {
newStatus = card.RealNameStatus
}