webClient.go 723 B

1234567891011121314151617181920212223242526272829303132
  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. Hash string `json:"hash"`
  16. }
  17. func (wcpp *WebClientPeerPayload) FromAddressBook(a *model.AddressBook) {
  18. wcpp.ViewStyle = "shrink"
  19. //24小时前
  20. wcpp.Tm = time.Now().Add(-time.Hour * 24).UnixNano()
  21. wcpp.Info = WebClientPeerInfoPayload{
  22. Username: a.Username,
  23. Hostname: a.Hostname,
  24. Platform: a.Platform,
  25. Hash: a.Hash,
  26. }
  27. }