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.

34 lines
601 B

5 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. var now = time.Now()
  11. func (t *MessageCtl) Checkin() {
  12. t.DisplayByData(map[string]interface{}{
  13. "version": now,
  14. "status": "success",
  15. })
  16. }
  17. func (t *MessageCtl) Receive() {
  18. msg := new(Message)
  19. err := t.RequestToStruct(msg)
  20. if err != nil {
  21. t.DisplayByError(fmt.Sprintf("信息发送失败, error: %v", err), 0)
  22. }
  23. go N.Send(msg)
  24. // 通知特定的大屏幕和用户
  25. t.DisplayByData(map[string]interface{}{
  26. "date": time.Now(),
  27. "msg": "success",
  28. })
  29. }