saving campaign #153
|
@ -0,0 +1,21 @@
|
|||
package client
|
||||
|
||||
import (
|
||||
"git.selly.red/Selly-Modules/natsio"
|
||||
"git.selly.red/Selly-Modules/natsio/model"
|
||||
"git.selly.red/Selly-Modules/natsio/subject"
|
||||
)
|
||||
|
||||
// Socket ...
|
||||
type Socket struct{}
|
||||
|
||||
// GetSocket ...
|
||||
func GetSocket() Socket {
|
||||
return Socket{}
|
||||
}
|
||||
|
||||
// EmitSocketEventDataReward ...
|
||||
func (s Socket) EmitSocketEventDataReward(p model.PayloadEmitSocketEvent) error {
|
||||
_, err := natsio.GetServer().Request(subject.Socket.EmitEventReward, toBytes(p))
|
||||
return err
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package model
|
||||
|
||||
// PayloadEmitSocketEvent ...
|
||||
type PayloadEmitSocketEvent struct {
|
||||
User string `json:"user"`
|
||||
Message string `json:"message"`
|
||||
Data string `json:"data"`
|
||||
IsNotRemove bool `json:"isNotRemove"`
|
||||
}
|
|
@ -18,6 +18,7 @@ var prefixes = struct {
|
|||
Queue string
|
||||
Campaign string
|
||||
Affiliate string
|
||||
Socket string
|
||||
}{
|
||||
Communication: "communication",
|
||||
Order: "order",
|
||||
|
@ -36,4 +37,5 @@ var prefixes = struct {
|
|||
Queue: "queue",
|
||||
Campaign: "campaign",
|
||||
Affiliate: "affiliate",
|
||||
Socket: "socket",
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package subject
|
||||
|
||||
import "fmt"
|
||||
|
||||
func getSocketValue(val string) string {
|
||||
return fmt.Sprintf("%s.%s", prefixes.Socket, val)
|
||||
}
|
||||
|
||||
// Socket ...
|
||||
var Socket = struct {
|
||||
EmitEventReward string
|
||||
}{
|
||||
EmitEventReward: getSocketValue("emit_event_reward"),
|
||||
}
|
Loading…
Reference in New Issue