package mq import ( "context" "git.noahlan.cn/northlan/ntools-go/kafka" "github.com/zeromicro/go-zero/core/logx" pbMq "live-service/app/pb/mq" "live-service/app/user_center/rpc/internal/config" kfk "live-service/common/kafka" ) type ( RewardPool struct { producer *kafka.Producer // kafka logx.Logger } ) func NewRewardPoolMq(cfg config.KafkaProducer) *RewardPool { return &RewardPool{ producer: kafka.NewKafkaProducer(kfk.DefaultProducerConfig, cfg.RewardPool.Addr, cfg.RewardPool.Topic), Logger: logx.WithContext(context.Background()), } } func (m *RewardPool) RewardPoolChanged(req *pbMq.MqRewardPool) { err := m.producer.SendMessageAsync(req) if err != nil { m.Logger.Error("发送通知奖池变更消息失败") } }