This commit is contained in:
poiuty 2023-05-22 16:56:38 +03:00
parent b0ed58805a
commit ec371734fc

View file

@ -236,7 +236,7 @@ func xWorker(workerData Info, u url.URL) {
fmt.Println(err.Error(), workerData.room) fmt.Println(err.Error(), workerData.room)
continue continue
} }
for _, msg := range topmsg.Messages { for _, msg := range topmsg {
inmsg := &Data{} inmsg := &Data{}
if err := json.Unmarshal([]byte(msg.Data), inmsg); err != nil { if err := json.Unmarshal([]byte(msg.Data), inmsg); err != nil {
@ -244,19 +244,20 @@ func xWorker(workerData Info, u url.URL) {
continue continue
} }
// inmsg.User.Username, inmsg.User.Gender, inmsg.User.IsBroadcast, inmsg.Action fmt.Println(inmsg.User.Username, inmsg.User.Gender, inmsg.User.IsBroadcast, inmsg.Action, workerData.room)
if inmsg.User.Username == workerData.room && inmsg.User.IsBroadcast && inmsg.Action == "leave" { if inmsg.User.Username == workerData.room && inmsg.User.IsBroadcast {
if inmsg.Action == "leave" {
fmt.Println("leave, start ticker", workerData.room) fmt.Println("leave, start ticker", workerData.room)
leave.Reset(60 * 5 * time.Second) leave.Reset(60 * 5 * time.Second)
} }
if inmsg.Action == "enter" {
if inmsg.User.Username == workerData.room && inmsg.User.IsBroadcast && inmsg.Action == "enter" {
fmt.Println("enter, stop ticker", workerData.room) fmt.Println("enter, stop ticker", workerData.room)
leave.Reset(60 * 60 * 8 * time.Second) leave.Reset(60 * 60 * 8 * time.Second)
} }
} }
} }
}
if input.Channel == "room:tip_alert:"+workerData.Id { if input.Channel == "room:tip_alert:"+workerData.Id {
tips := []struct { tips := []struct {