result.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package search
  2. import (
  3. "go-common/app/interface/main/tv/model"
  4. )
  5. // ResultResponse def .
  6. type ResultResponse struct {
  7. Page int `json:"page"`
  8. Pagesize int `json:"pagesize"`
  9. NumResults int `json:"numResults"`
  10. NumPages int `json:"numPages"`
  11. Seid string `json:"seid"`
  12. }
  13. type pageinfo struct {
  14. Tvpgc *Page `json:"tvpgc"`
  15. Tvugc *Page `json:"tvugc"`
  16. }
  17. // Page struct .
  18. type Page struct {
  19. NumResult int `json:"numResults"`
  20. Total int `json:"total"`
  21. Pages int `json:"pages"`
  22. }
  23. // RespAll def .
  24. type RespAll struct {
  25. Code int `json:"code"`
  26. Msg string `json:"msg"`
  27. *ResultResponse
  28. PageInfo *pageinfo `json:"pageinfo"`
  29. Result *AllResult `json:"result"`
  30. }
  31. // AllResult def .
  32. type AllResult struct {
  33. Pgc []*PgcResult `json:"tvpgc"`
  34. Ugc []*UgcResult `json:"tvugc"`
  35. }
  36. // RespPgc def .
  37. type RespPgc struct {
  38. Code int `json:"code"`
  39. Msg string `json:"msg"`
  40. *ResultResponse
  41. Result []*PgcResult `json:"result"`
  42. }
  43. // RespUgc def .
  44. type RespUgc struct {
  45. Code int `json:"code"`
  46. Msg string `json:"msg"`
  47. *ResultResponse
  48. Result []*UgcResult `json:"result"`
  49. }
  50. // UgcResult def .
  51. type UgcResult struct {
  52. ID int `json:"id"`
  53. Title string `json:"title"`
  54. Cover string `json:"cover"`
  55. Description string `json:"description"`
  56. Pubtime int `json:"pubtime"`
  57. Category int `json:"category"`
  58. }
  59. // PgcResult def .
  60. type PgcResult struct {
  61. *UgcResult
  62. CV string `json:"cv"`
  63. Staff string `json:"staff"`
  64. CornerMark *model.SnVipCorner `json:"cornermark"`
  65. }
  66. // ToCommon transform pgc to common .
  67. func (p *PgcResult) ToCommon() (res *CommonResult) {
  68. return &CommonResult{
  69. PgcResult: p,
  70. Type: "pgc",
  71. }
  72. }
  73. // ToCommon transform pgc to common .
  74. func (p *UgcResult) ToCommon() (res *CommonResult) {
  75. res = &CommonResult{}
  76. res.PgcResult = &PgcResult{
  77. UgcResult: p,
  78. }
  79. res.Type = "ugc"
  80. return
  81. }
  82. // CommonResult is the common result for both pgc & ugc .
  83. type CommonResult struct {
  84. *PgcResult
  85. Type string `json:"type"`
  86. }
  87. // ReqSearch def .
  88. type ReqSearch struct {
  89. SearchType string `form:"search_type" validate:"required"`
  90. Order string `form:"order"`
  91. Category int `form:"category"`
  92. Platform string `form:"platform" validate:"required"`
  93. Build string `form:"build" validate:"required"`
  94. MobiAPP string `form:"mobi_app"`
  95. Device string `form:"device"`
  96. Keyword string `form:"keyword" validate:"required"`
  97. Page int `form:"page" validate:"required,min=1"`
  98. Pagesize int `form:"pagesize"`
  99. }