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

@@ -91,6 +91,15 @@ func (h *PollingCarddataHandler) Handle(ctx context.Context, t *asynq.Task) erro
updates, flowIncrementMB, isCrossMonth := h.calculateFlowUpdates(card, gatewayFlowMB, now, resetDay)
updates["last_data_check_at"] = now
if h.base.verboseLog && h.gateway != nil {
h.base.logger.Info("流量轮询详情",
zap.Uint("card_id", cardID),
zap.String("iccid", card.ICCID),
zap.Float64("gateway_flow_mb", gatewayFlowMB),
zap.Float64("increment_mb", flowIncrementMB),
zap.Bool("is_cross_month", isCrossMonth))
}
if updateErr := h.iotCardStore.UpdateFields(ctx, cardID, updates); updateErr != nil {
h.base.logger.Error("更新卡流量信息失败", zap.Uint("card_id", cardID), zap.Error(updateErr))
}