banner.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package banner
  2. import (
  3. "encoding/json"
  4. resource "go-common/app/service/main/resource/model"
  5. )
  6. type Banner struct {
  7. ID int64 `json:"id"`
  8. Title string `json:"title"`
  9. Image string `json:"image"`
  10. Hash string `json:"hash"`
  11. URI string `json:"uri"`
  12. RequestID string `json:"request_id,omitempty"`
  13. CreativeID int `json:"creative_id,omitempty"`
  14. SrcID int `json:"src_id,omitempty"`
  15. IsAd bool `json:"is_ad,omitempty"`
  16. IsAdLoc bool `json:"is_ad_loc,omitempty"`
  17. AdCb string `json:"ad_cb,omitempty"`
  18. ShowURL string `json:"show_url,omitempty"`
  19. ClickURL string `json:"click_url,omitempty"`
  20. ClientIP string `json:"client_ip,omitempty"`
  21. ServerType int `json:"server_type"`
  22. ResourceID int `json:"resource_id,omitempty"`
  23. Index int `json:"index,omitempty"`
  24. CmMark int `json:"cm_mark"`
  25. Extra json.RawMessage `json:"extra,omitempty"`
  26. }
  27. func (b *Banner) Change(banner *resource.Banner) {
  28. b.ID = int64(banner.ID)
  29. b.Title = banner.Title
  30. b.Image = banner.Image
  31. b.Hash = banner.Hash
  32. b.URI = banner.URI
  33. b.ResourceID = banner.ResourceID
  34. b.RequestID = banner.RequestId
  35. b.CreativeID = banner.CreativeId
  36. b.SrcID = banner.SrcId
  37. b.IsAd = banner.IsAd
  38. b.IsAdLoc = banner.IsAdLoc
  39. b.CmMark = banner.CmMark
  40. b.AdCb = banner.AdCb
  41. b.ShowURL = banner.ShowUrl
  42. b.ClickURL = banner.ClickUrl
  43. b.ClientIP = banner.ClientIp
  44. b.Index = banner.Index
  45. b.ServerType = banner.ServerType
  46. b.Extra = banner.Extra
  47. }