report.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package report
  2. // table name .
  3. const (
  4. ArchiveClick = "archive_click"
  5. ActiveDuration = "active_duration"
  6. PlayDuration = "play_duration"
  7. VisitEvent = "visit_event"
  8. )
  9. // DpCheckJobResult .
  10. type DpCheckJobResult struct {
  11. Code int `json:"code"`
  12. Msg string `json:"msg"`
  13. StatusID int `json:"statusId"`
  14. StatusMsg string `json:"statusMsg"`
  15. Files []string `json:"hdfsPath"`
  16. }
  17. // ArcClickParam .
  18. func ArcClickParam(b [][]byte) (res map[string]interface{}) {
  19. key := []string{"r_type", "avid", "cid", "part", "mid", "stime", "did", "ip", "ua", "buvid", "cookie_sid", "refer", "type", "sub_type", "sid", "epid", "platform", "device", "request_uri", "time_iso", "ip", "version", "buvid", "fts", "proid", "chid", "pid", "brand", "deviceid", "model", "osver", "ctime", "mid", "ver", "net", "oid", "eid", "start_time", "end_time", "duration", "openudid", "idfa", "mac", "is_coldstart", "session_id", "buvid_ext", "stime", "build", "buvid", "mobi_app", "platform", "session", "mid", "aid", "cid", "sid", "epid", "type", "sub_type", "quality", "total_time", "paused_time", "played_time", "video_duration", "play_type", "network_type", "last_play_progress_time", "max_play_progress_time", "device", "epid_status", "play_status", "user_status", "actual_played_time", "auto_play", "detail_play_time", "list_play_time", "request_uri", "time_iso", "ip", "version", "buvid", "fts", "proid", "chid", "pid", "brand", "deviceid", "model", "osver", "ctime", "mid", "ver", "net", "oid", "page_name", "page_arg", "ua", "h5_chid"}
  20. value := make([]string, len(b))
  21. res = make(map[string]interface{}, 4)
  22. mac := make(map[string]string, 18)
  23. mad := make(map[string]string, 28)
  24. mpd := make(map[string]string, 30)
  25. mve := make(map[string]string, 22)
  26. for k, v := range b {
  27. value[k] = string(v)
  28. }
  29. for k := range key {
  30. if k < len(value) {
  31. if k < 18 {
  32. mac[key[k]] = value[k]
  33. } else if k >= 18 && k < 46 {
  34. mad[key[k]] = value[k]
  35. } else if k >= 46 && k < 76 {
  36. mpd[key[k]] = value[k]
  37. } else if k >= 76 && k < 98 {
  38. mve[key[k]] = value[k]
  39. }
  40. }
  41. }
  42. res[ArchiveClick] = mac
  43. res[ActiveDuration] = mad
  44. res[PlayDuration] = mpd
  45. res[VisitEvent] = mve
  46. return
  47. }