mirror of
https://github.com/wonli/aqi.git
synced 2024-06-28 09:57:05 +08:00
30 lines
394 B
Go
30 lines
394 B
Go
|
package ws
|
||
|
|
||
|
func Msg(action, msg string) []byte {
|
||
|
res := &Action{
|
||
|
Action: action,
|
||
|
Msg: msg,
|
||
|
}
|
||
|
|
||
|
return res.json()
|
||
|
}
|
||
|
|
||
|
func Code(action string, code int, msg string) []byte {
|
||
|
res := &Action{
|
||
|
Action: action,
|
||
|
Code: code,
|
||
|
Msg: msg,
|
||
|
}
|
||
|
|
||
|
return res.json()
|
||
|
}
|
||
|
|
||
|
func Data(action string, data any) []byte {
|
||
|
res := &Action{
|
||
|
Action: action,
|
||
|
Data: data,
|
||
|
}
|
||
|
|
||
|
return res.json()
|
||
|
}
|