Compare commits

..

2 Commits

Author SHA1 Message Date
d589a9615e Merge remote-tracking branch 'origin/hotfix' into hotfix 2024-03-22 23:07:00 +08:00
13205e445f 🎨 新增 MQ 开关 2024-03-22 23:06:54 +08:00
3 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,8 @@ task:
# MQ配置 # MQ配置
mq: mq:
# 是否启用
enable: false
# RabbitMQ配置 # RabbitMQ配置
rabbitmq: rabbitmq:
host: 10.0.0.247 host: 10.0.0.247

View File

@ -5,6 +5,7 @@ import "fmt"
// mq // mq
// @description: MQ配置 // @description: MQ配置
type mq struct { type mq struct {
Enable bool `json:"enable" yaml:"enable"` // 是否启用
RabbitMQ rabbitMq `json:"rabbitmq" yaml:"rabbitmq"` // RabbitMQ配置 RabbitMQ rabbitMq `json:"rabbitmq" yaml:"rabbitmq"` // RabbitMQ配置
} }

View File

@ -16,6 +16,10 @@ const exchangeName = "wechat-message"
// Init // Init
// @description: 初始化MQ // @description: 初始化MQ
func Init() { func Init() {
if !config.Conf.Mq.Enable {
log.Println("未启用MQ")
return
}
// 读取MQ连接配置 // 读取MQ连接配置
mqUrl := config.Conf.Mq.RabbitMQ.GetURL() mqUrl := config.Conf.Mq.RabbitMQ.GetURL()
if mqUrl == "" { if mqUrl == "" {