更换事件包

main
落雨楓 2 years ago
parent ab6215d611
commit 2e34dcad41

@ -3,7 +3,7 @@ package context
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
socketio "github.com/googollee/go-socket.io" socketio "github.com/googollee/go-socket.io"
eventemitter "github.com/vansante/go-event-emitter" eventemitter "github.com/hyperzlib/go-event-emitter"
) )
type ServerContext struct { type ServerContext struct {

@ -263,12 +263,7 @@ func (c *ClientSocketController) BindPlayer(user string, code string) (string, e
} }
} }
func (c *ClientSocketController) OnBindUser(eventObj ...interface{}) { func (c *ClientSocketController) OnBindUser(event events.BindUserEvent) {
event, err := utils.GetEvent[events.BindUserEvent](eventObj)
if err != nil {
log.Panicln("Cannot get event in OnBindUser:", err.Error())
}
userName := event.User userName := event.User
userInfo := c.storeModel.GetUserInfo(event.User) userInfo := c.storeModel.GetUserInfo(event.User)
if userInfo == nil { if userInfo == nil {

@ -2,9 +2,9 @@ package controller
import ( import (
socketio "github.com/googollee/go-socket.io" socketio "github.com/googollee/go-socket.io"
eventemitter "github.com/hyperzlib/go-event-emitter"
"github.com/hyperzlib/isekai-remote-playback/context" "github.com/hyperzlib/isekai-remote-playback/context"
"github.com/hyperzlib/isekai-remote-playback/store" "github.com/hyperzlib/isekai-remote-playback/store"
eventemitter "github.com/vansante/go-event-emitter"
) )
type SocketController struct { type SocketController struct {

@ -11,10 +11,11 @@ require (
github.com/gin-gonic/gin v1.8.1 github.com/gin-gonic/gin v1.8.1
github.com/go-redis/redis/v8 v8.11.5 github.com/go-redis/redis/v8 v8.11.5
github.com/googollee/go-socket.io v1.6.2 github.com/googollee/go-socket.io v1.6.2
github.com/hyperzlib/go-event-emitter v0.0.0-20221216091038-517774b059d3
github.com/mileusna/useragent v1.2.1
github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/mapstructure v1.5.0
github.com/pochard/commons v1.1.2 github.com/pochard/commons v1.1.2
github.com/spf13/viper v1.14.0 github.com/spf13/viper v1.14.0
github.com/vansante/go-event-emitter v1.0.2
golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb golang.org/x/exp v0.0.0-20221204150635-6dcec336b2bb
) )
@ -39,7 +40,6 @@ require (
github.com/magiconair/properties v1.8.6 // indirect github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mileusna/useragent v1.2.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect

@ -191,6 +191,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hyperzlib/go-event-emitter v0.0.0-20221216091038-517774b059d3 h1:3F8JhZDgR6O85DMCnp6Rsjjm599jdmYEWQqjmnKn2cA=
github.com/hyperzlib/go-event-emitter v0.0.0-20221216091038-517774b059d3/go.mod h1:8HTsW17c5LMvrIUYn/ZKubdjLNMrsEArComp0nmfVy4=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
@ -318,8 +320,6 @@ github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
github.com/vansante/go-event-emitter v1.0.2 h1:Qh/B4aM2OKyWWqToiIgS9XCf5sR8/R6vAp/rOpSuwss=
github.com/vansante/go-event-emitter v1.0.2/go.mod h1:DC2i7ES4CtpdPHgm/BvbemeJKxKyAWSYpO24qdkqT/s=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

@ -6,12 +6,12 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
socketio "github.com/googollee/go-socket.io" socketio "github.com/googollee/go-socket.io"
eventemitter "github.com/hyperzlib/go-event-emitter"
"github.com/hyperzlib/isekai-remote-playback/context" "github.com/hyperzlib/isekai-remote-playback/context"
"github.com/hyperzlib/isekai-remote-playback/middleware" "github.com/hyperzlib/isekai-remote-playback/middleware"
"github.com/hyperzlib/isekai-remote-playback/routes" "github.com/hyperzlib/isekai-remote-playback/routes"
"github.com/hyperzlib/isekai-remote-playback/store" "github.com/hyperzlib/isekai-remote-playback/store"
"github.com/spf13/viper" "github.com/spf13/viper"
eventemitter "github.com/vansante/go-event-emitter"
) )
func initConfig() { func initConfig() {

Loading…
Cancel
Save