add 事件总线

This commit is contained in:
yxh
2024-02-18 11:31:58 +08:00
parent d9fd196bac
commit 23b1391e7d
6 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
/**
* @Company: 云南奇讯科技有限公司
* @Author: yxf
* @Description:
* @Date: 2024/1/25 16:22
*/
package eventBus
import (
"github.com/asaskevich/EventBus"
"github.com/tiger1103/gfast/v3/internal/app/common/service"
)
func init() {
service.RegisterEventBus(EventBus.New())
}

View File

@@ -8,6 +8,7 @@ import (
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/bigUpload"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/cache"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/captcha"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/eventBus"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/middleware"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/snowIDGen"
_ "github.com/tiger1103/gfast/v3/internal/app/common/logic/sysConfig"

View File

@@ -0,0 +1,23 @@
// ================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// You can delete these comments if you wish manually maintain this interface file.
// ================================================================================
package service
import (
eventBus "github.com/asaskevich/EventBus"
)
var localEventBus eventBus.Bus
func EventBus() eventBus.Bus {
if localEventBus == nil {
panic("implement not found for interface EventBus, forgot register?")
}
return localEventBus
}
func RegisterEventBus(i eventBus.Bus) {
localEventBus = i
}