互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
583 B

5 years ago
4 years ago
5 years ago
  1. package ws
  2. import (
  3. "fmt"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. "time"
  6. )
  7. type MessageCtl struct {
  8. core.Controller
  9. }
  10. func (t *MessageCtl) Checkin() {
  11. t.DisplayByData(map[string]interface{}{
  12. "version": "1.0.0",
  13. "status": "success",
  14. })
  15. }
  16. func (t *MessageCtl) Receive() {
  17. msg := new(Message)
  18. err := t.RequestToStruct(msg)
  19. if err != nil {
  20. t.DisplayByError(fmt.Sprintf("信息发送失败, error: %v", err), 0)
  21. }
  22. go N.Send(msg)
  23. // 通知特定的大屏幕和用户
  24. t.DisplayByData(map[string]interface{}{
  25. "date": time.Now(),
  26. "msg": "success",
  27. })
  28. }