WechatQuery

This commit is contained in:
ziming 2025-06-06 09:31:12 +08:00
parent b70eda503b
commit 11ff1c8540
3 changed files with 8 additions and 8 deletions

View File

@ -26,11 +26,11 @@ func NewRdbConsumer(
) *RdbConsumer { ) *RdbConsumer {
manager := rdsmq.NewConsumerManager() manager := rdsmq.NewConsumerManager()
if cf := voucherService.GetConfig(); cf != nil { if cf := voucherService.GetWechatQueryConfig(); cf != nil {
manager.Add(cf) manager.Add(cf)
} }
if cf2 := voucherService.GetWechatConfig(); cf2 != nil { if cf2 := voucherService.GetWechatRetryConfig(); cf2 != nil {
manager.Add(cf2) manager.Add(cf2)
} }

View File

@ -7,7 +7,7 @@ import (
"voucher/internal/pkg/rdsmq" "voucher/internal/pkg/rdsmq"
) )
func (s *VoucherService) GetConfig() *rdsmq.ConsumeConfig { func (s *VoucherService) GetWechatQueryConfig() *rdsmq.ConsumeConfig {
queue := s.bc.RdsMQ.GetWechatQuery() queue := s.bc.RdsMQ.GetWechatQuery()
if queue == nil { if queue == nil {
@ -25,12 +25,12 @@ func (s *VoucherService) GetConfig() *rdsmq.ConsumeConfig {
NumWorkers: queue.NumWorkers, NumWorkers: queue.NumWorkers,
WaitTime: queue.GetWaitTime().AsDuration(), WaitTime: queue.GetWaitTime().AsDuration(),
RetryNum: queue.RetryNum, RetryNum: queue.RetryNum,
Fn: s.Handle, Fn: s.WechatQueryHandle,
Logger: s.logHelper, Logger: s.logHelper,
} }
} }
func (s *VoucherService) Handle(ctx context.Context, batchNo string) error { func (s *VoucherService) WechatQueryHandle(ctx context.Context, batchNo string) error {
if batchNo == "" { if batchNo == "" {
s.logHelper.Errorf("wechat query error: batchNo is empty") s.logHelper.Errorf("wechat query error: batchNo is empty")

View File

@ -7,7 +7,7 @@ import (
"voucher/internal/pkg/rdsmq" "voucher/internal/pkg/rdsmq"
) )
func (s *VoucherService) GetWechatConfig() *rdsmq.ConsumeConfig { func (s *VoucherService) GetWechatRetryConfig() *rdsmq.ConsumeConfig {
queue := s.bc.RdsMQ.GetWechatRetry() queue := s.bc.RdsMQ.GetWechatRetry()
if queue == nil { if queue == nil {
@ -25,12 +25,12 @@ func (s *VoucherService) GetWechatConfig() *rdsmq.ConsumeConfig {
NumWorkers: queue.NumWorkers, NumWorkers: queue.NumWorkers,
WaitTime: queue.GetWaitTime().AsDuration(), WaitTime: queue.GetWaitTime().AsDuration(),
RetryNum: queue.RetryNum, RetryNum: queue.RetryNum,
Fn: s.HandleWechat, Fn: s.HandleWechatRetry,
Logger: s.logHelper, Logger: s.logHelper,
} }
} }
func (s *VoucherService) HandleWechat(ctx context.Context, batchNo string) error { func (s *VoucherService) HandleWechatRetry(ctx context.Context, batchNo string) error {
if batchNo == "" { if batchNo == "" {
s.logHelper.Errorf("RdsMQ keySend error: batchNo is empty") s.logHelper.Errorf("RdsMQ keySend error: batchNo is empty")