fix: preserve all-tenant expiry scan

This commit is contained in:
zhx 2026-07-10 11:38:19 +08:00
parent 34f07f0dd3
commit 59ed58fd44

View File

@ -127,8 +127,12 @@ func (s *Service) ExpireRedPackets(ctx context.Context, appCode string, batchSiz
if s.repository == nil {
return ledger.RedPacketExpireResult{}, xerr.New(xerr.Unavailable, "wallet repository is not configured")
}
appCode = appcode.Normalize(appCode)
ctx = appcode.WithContext(ctx, appCode)
// 空 app_code 专用于内部 worker 的跨租户扫描;显式 RPC 仍归一化并保持单租户边界。
appCode = strings.ToLower(strings.TrimSpace(appCode))
if appCode != "" {
appCode = appcode.Normalize(appCode)
ctx = appcode.WithContext(ctx, appCode)
}
return s.repository.ExpireRedPackets(ctx, appCode, batchSize)
}