dsp.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. package utils
  2. import (
  3. "fmt"
  4. "math/rand"
  5. "time"
  6. )
  7. type DspParam struct {
  8. DspCityCode int `json:"dsp_city_code"`
  9. Deviceid string
  10. DeviceidType int `json:"device_id_type"` // 设备类型
  11. Adspaceid string // 广告位标识
  12. OsType string // 系统类型 Android ios
  13. OsVersion string `json:"os_version"`
  14. Ver string // 软件版本
  15. SdkVersion string // 系统版本号
  16. Source string
  17. PhoneType string
  18. UserAgent string
  19. ScreenWidth int `json:"screen_width"`
  20. ScreenHeight int `json:"screen_height"`
  21. ScreenDensity int `json:"screen_density"`
  22. Channel string
  23. CarrierId int
  24. Lng float64
  25. Lat float64
  26. Placements string
  27. Ip string `json:"ip"`
  28. RequestId string `json:"request_id"`
  29. Advertiser string
  30. UserId int
  31. Num int // 新闻条数
  32. Hongtu int
  33. Is360Circle int `json:"is_360_circle"`// 1 足迹banner 2 圈子广告 3 资讯广告
  34. AdType int `json:"ad_type"`// 广告类型 1 默认开屏
  35. Category string
  36. LocalIp string `json:"local_ip"`
  37. ScreenScale int // 屏幕倍率
  38. SourceFlag int // 0:安卓 1:ios
  39. Imei string
  40. RealMd5Imei string `json:"real_md5_imei"`
  41. OriginImei string `json:"origin_imei"`
  42. Mac string
  43. OriginMac string `json:"origin_mac"`
  44. Idfa string
  45. Model string
  46. Brand string
  47. ScreenSize string `json:"screen_size"`
  48. NetworkType int `json:"network_type"`
  49. Androidid string `json:"android_id"`
  50. Platform int
  51. City string
  52. Province string
  53. Ua string `json:"ua"`
  54. UaOrigin string `json:"ua_client"`
  55. ReqSource string `json:"req_source"`
  56. RealMiFlag int
  57. ReplaceFlag int `json:"replace_flag"`
  58. RealReqSource string `json:"real_req_source"`
  59. SupClickFlag int `json:"sup_click_flag"`
  60. SendPhoneType int
  61. SupShowFlag int `json:"sup_show_flag"`
  62. VideoTimeDuration int
  63. AllDuration int64
  64. }
  65. func (self *DspParam) Init() {
  66. // 获取随机的请求id
  67. randNum := rand.Intn(89999999) + 10000000
  68. self.RequestId = fmt.Sprintf("%d_%d", time.Now().Unix(), randNum)
  69. self.DeviceidType = 1
  70. self.ScreenWidth = 1080
  71. self.ScreenHeight = 1920
  72. self.ScreenDensity = 3
  73. self.Num = 1
  74. self.Is360Circle = 1
  75. self.AdType = 1
  76. self.LocalIp = "__ADS_LP__"
  77. self.SupClickFlag = 1
  78. self.SupShowFlag = 1
  79. }