增加了 用户会员过期队列
This commit is contained in:
@@ -21,6 +21,12 @@ func StartCron() {
|
||||
panic("定时器启动失败:" + err.Error())
|
||||
}
|
||||
|
||||
// 用户会员过期
|
||||
_, err = c.AddFunc("0 0 0 * * *", crontab.UserMemberExpire)
|
||||
if err != nil {
|
||||
panic("定时器启动失败:" + err.Error())
|
||||
}
|
||||
|
||||
// 启动定时任务调度器
|
||||
c.Start()
|
||||
|
||||
|
||||
@@ -49,6 +49,15 @@ func StartRabbitMqConsume() {
|
||||
Handler: consumer.CancelUnPayOrder,
|
||||
}
|
||||
go startConsumer(s)
|
||||
|
||||
// 用户会员过期
|
||||
s = rabbitMq.ConsumeS{
|
||||
QueueName: "user.member.expired.delay.queue",
|
||||
ExchangeName: "amqp.delay.direct",
|
||||
RoutingKey: "UserMemberExpired",
|
||||
Handler: consumer.UserMemberExpire,
|
||||
}
|
||||
go startConsumer(s)
|
||||
}
|
||||
|
||||
// startConsumer 启动指定的消费者协程
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ import (
|
||||
func Redis() {
|
||||
global.Redis = redis.NewClient(&redis.Options{
|
||||
Addr: config.C.Redis.Host + ":" + strconv.Itoa(config.C.Redis.Port),
|
||||
Password: config.C.Redis.Password, // no password set
|
||||
DB: config.C.Redis.Db, // use default DB
|
||||
Password: config.C.Redis.Password,
|
||||
DB: config.C.Redis.Db,
|
||||
PoolSize: config.C.Redis.PoolSize,
|
||||
})
|
||||
_, err := global.Redis.Ping(context.Background()).Result()
|
||||
|
||||
Reference in New Issue
Block a user