webClient.go 672 B

123456789101112131415161718192021222324252627282930
  1. package api
  2. import (
  3. "Gwen/model"
  4. "time"
  5. )
  6. type WebClientPeerPayload struct {
  7. ViewStyle string `json:"view-style"`
  8. Tm int64 `json:"tm"`
  9. Info WebClientPeerInfoPayload `json:"info"`
  10. }
  11. type WebClientPeerInfoPayload struct {
  12. Username string `json:"username"`
  13. Hostname string `json:"hostname"`
  14. Platform string `json:"platform"`
  15. }
  16. func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
  17. wcpp.ViewStyle = "shrink"
  18. //24小时前
  19. wcpp.Tm = time.Now().Add(-time.Hour * 24).UnixNano()
  20. wcpp.Info = WebClientPeerInfoPayload{
  21. Username: a.Username,
  22. Hostname: a.Hostname,
  23. Platform: a.Platform,
  24. }
  25. }