123456789101112131415161718192021222324252627 |
- package worker
- import (
- "Wine-Server/utils"
- "Wine-Server/utils/tables"
- "github.com/gorilla/websocket"
- )
- func Handle(msg utils.WsMsg, conn *websocket.Conn, manager *tables.ManagerTable) {
- switch msg.Event {
- case "adminWorkerQuery":
- query(conn, manager, msg.Data)
- break
- case "adminWorkerUpdate":
- update(conn, msg.Data)
- break
- case "adminWorkerDelete":
- remove(conn, msg.Data)
- break
- case "adminWorkerAdd":
- add(conn, manager, msg.Data)
- break
- default:
- _ = conn.WriteJSON(utils.WsError("unrecognized event"))
- break
- }
- }
|