ads.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. avmdl "go-common/app/interface/main/app-view/model"
  5. )
  6. // ads const
  7. const (
  8. // ads plat
  9. VdoAdsPC = int8(0)
  10. VdoAdsIPhone = int8(1)
  11. VdoAdsAndroid = int8(2)
  12. VdoAdsIPad = int8(3)
  13. // ads type
  14. VdoAdsTypeBangumi = int8(0)
  15. VdoAdsTypeNologin = int8(1)
  16. VdoAdsTypeNothing = int8(2)
  17. VdoAdsTypeOther = int8(3)
  18. // ads target
  19. VdoAdsTargetArchive = int8(1)
  20. VdoAdsTargetBangumi = int8(2)
  21. VdoAdsTargetType = int8(3)
  22. )
  23. // VideoAD is Ads of videos.
  24. type VideoAD struct {
  25. Name string `json:"name"`
  26. ContractID string `json:"contract_id"`
  27. Aid int64 `json:"aid"`
  28. SeasonID int `json:"season_id"`
  29. TypeID int16 `json:"type _id"`
  30. AdCid int64 `json:"ad_cid"`
  31. AdStrategy int `json:"ad_strategy"`
  32. AdURL string `json:"ad_url"`
  33. AdOrder int `json:"ad_order"`
  34. Skipable int8 `json:"skipable"`
  35. Note string `json:"note"`
  36. AgencyName string `json:"agency_name"`
  37. AgencyCountry int `json:"agency_country"`
  38. AgencyArea int `json:"agency_area"`
  39. Price float32 `json:"price"`
  40. Verified int `json:"verified"`
  41. State int `json:"state"`
  42. FrontAid int64 `json:"front_aid"`
  43. Target int8 `json:"target"`
  44. Platform int8 `json:"platform"`
  45. Type int8 `json:"type"`
  46. UserSet int8 `json:"user_set"`
  47. PlayCount int64 `json:"play_count"`
  48. MTime xtime.Time `json:"mtime"`
  49. Aids string `json:"-"`
  50. }
  51. // Paster struct
  52. type Paster struct {
  53. AID int64 `json:"aid"`
  54. CID int64 `json:"cid"`
  55. Duration int64 `json:"duration"`
  56. Type int8 `json:"type"`
  57. AllowJump int8 `json:"allow_jump"`
  58. URL string `json:"url"`
  59. }
  60. // PasterPlat exchange plat to video_ads
  61. func PasterPlat(plat int8) int8 {
  62. switch plat {
  63. case PlatWEB:
  64. return VdoAdsPC
  65. case avmdl.PlatIPad, avmdl.PlatIpadHD, avmdl.PlatIPadI: // 2、9、6 -> 3
  66. return VdoAdsIPad
  67. case avmdl.PlatIPhone, avmdl.PlatIPhoneI: // 1、5 -> 1
  68. return VdoAdsIPhone
  69. case avmdl.PlatAndroid, avmdl.PlatAndroidG, avmdl.PlatAndroidI, avmdl.PlatAndroidTV, avmdl.PlatWPhone: // 0、4、8、7、3 -> 2
  70. return VdoAdsAndroid
  71. }
  72. return VdoAdsIPhone // 1
  73. }