search.go 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. package model
  2. import (
  3. "encoding/json"
  4. accmdl "go-common/app/service/main/account/model"
  5. )
  6. // WxSearchType .
  7. const WxSearchType = "wechat"
  8. // Search all search.
  9. type Search struct {
  10. Code int `json:"code,omitempty"`
  11. SeID string `json:"seid,omitempty"`
  12. Page int `json:"page,omitempty"`
  13. PageSize int `json:"pagesize,omitempty"`
  14. Total int `json:"total,omitempty"`
  15. NumResults int `json:"numResults"`
  16. NumPages int `json:"numPages"`
  17. SuggestKeyword string `json:"suggest_keyword"`
  18. RqtType string `json:"rqt_type,omitempty"`
  19. CostTime json.RawMessage `json:"cost_time,omitempty"`
  20. ExpList json.RawMessage `json:"exp_list,omitempty"`
  21. EggHit int `json:"egg_hit"`
  22. PageInfo json.RawMessage `json:"pageinfo,omitempty"`
  23. Result json.RawMessage `json:"result,omitempty"`
  24. TopTList json.RawMessage `json:"top_tlist,omitempty"`
  25. EggInfo *struct {
  26. ID int64 `json:"id,omitempty"`
  27. Source int64 `json:"source,omitempty"`
  28. } `json:"egg_info,omitempty"`
  29. ShowColumn int `json:"show_column"`
  30. }
  31. // SearchTypeRes search type res.
  32. type SearchTypeRes struct {
  33. Code int `json:"code,omitempty"`
  34. SeID string `json:"seid,omitempty"`
  35. Page int `json:"page,omitempty"`
  36. PageSize int `json:"pagesize,omitempty"`
  37. Total int `json:"total,omitempty"`
  38. NumResults int `json:"numResults"`
  39. NumPages int `json:"numPages"`
  40. SuggestKeyword string `json:"suggest_keyword"`
  41. RqtType string `json:"rqt_type,omitempty"`
  42. CostTime json.RawMessage `json:"cost_time,omitempty"`
  43. ExpList json.RawMessage `json:"exp_list,omitempty"`
  44. EggHit int `json:"egg_hit"`
  45. PageInfo json.RawMessage `json:"pageinfo,omitempty"`
  46. Result json.RawMessage `json:"result,omitempty"`
  47. ShowColumn int `json:"show_column"`
  48. }
  49. // SearchRec search recommend.
  50. type SearchRec struct {
  51. Code int `json:"code,omitempty"`
  52. SeID string `json:"seid,omitempty"`
  53. Page int `json:"page,omitempty"`
  54. PageSize int `json:"pagesize,omitempty"`
  55. Total int `json:"total,omitempty"`
  56. NumResults int `json:"numResults"`
  57. NumPages int `json:"numPages"`
  58. SuggestKeyword string `json:"suggest_keyword"`
  59. RqtType string `json:"rqt_type,omitempty"`
  60. CostTime json.RawMessage `json:"cost_time,omitempty"`
  61. ExpList json.RawMessage `json:"exp_list,omitempty"`
  62. EggHit int `json:"egg_hit"`
  63. Result json.RawMessage `json:"result,omitempty"`
  64. }
  65. // SearchAllArg search all api arguments.
  66. type SearchAllArg struct {
  67. Pn int `form:"page"`
  68. Keyword string `form:"keyword" validate:"required"`
  69. Rid int `form:"tids"`
  70. Duration int `form:"duration" validate:"gte=0,lte=4"`
  71. FromSource string `form:"from_source"`
  72. Highlight int `form:"highlight"`
  73. SingleColumn int `form:"-"`
  74. }
  75. // SearchTypeArg search type api arguments.
  76. type SearchTypeArg struct {
  77. Pn int `form:"page" validate:"min=1" default:"1"`
  78. SearchType string `form:"search_type" validate:"required"`
  79. Keyword string `form:"keyword" validate:"required"`
  80. Order string `form:"order"`
  81. Rid int64 `form:"tids"`
  82. FromSource string `form:"from_source"`
  83. Platform string `form:"platform" default:"web"`
  84. Duration int `form:"duration" validate:"min=0,max=4"`
  85. // article
  86. CategoryID int64 `form:"category_id"`
  87. // special
  88. VpNum int `form:"vp_num"`
  89. // bili user
  90. BiliUserVl int `form:"bili_user_vl" default:"3"`
  91. UserType int `form:"user_type" validate:"min=0,max=3"`
  92. OrderSort int `form:"order_sort"`
  93. Highlight int `form:"highlight"`
  94. SingleColumn int `form:"-"`
  95. }
  96. // SearchDefault search default
  97. type SearchDefault struct {
  98. Trackid string `json:"seid"`
  99. ID int64 `json:"id"`
  100. ShowName string `json:"show_name"`
  101. Name string `json:"name"`
  102. Type int `json:"type"`
  103. }
  104. // SearchUpRecArg search up rec arg.
  105. type SearchUpRecArg struct {
  106. ServiceArea string `form:"service_area" validate:"required"`
  107. Platform string `form:"platform" validate:"required"`
  108. ContextID int64 `form:"context_id"`
  109. MainTids []int64 `form:"main_tids,split"`
  110. SubTids []int64 `form:"sub_tids,split"`
  111. MobiApp string `form:"mobi_app"`
  112. Device string `form:"device"`
  113. Build int64 `form:"build"`
  114. Ps int `form:"ps" default:"5" validate:"min=1,max=15"`
  115. }
  116. // SearchUpRecRes .
  117. type SearchUpRecRes struct {
  118. UpID int64 `json:"up_id"`
  119. RecReason string `json:"rec_reason"`
  120. Tid int16 `json:"tid"`
  121. SecondTid int16 `json:"second_tid"`
  122. }
  123. // UpRecInfo .
  124. type UpRecInfo struct {
  125. Mid int64 `json:"mid"`
  126. Name string `json:"name"`
  127. Face string `json:"face"`
  128. Official accmdl.OfficialInfo `json:"official"`
  129. Follower int64 `json:"follower"`
  130. Vip struct {
  131. Type int32 `json:"type"`
  132. Status int32 `json:"status"`
  133. } `json:"vip"`
  134. RecReason string `json:"rec_reason"`
  135. Tid int16 `json:"tid"`
  136. Tname string `json:"tname"`
  137. SecondTid int16 `json:"second_tid"`
  138. SecondTname string `json:"second_tname"`
  139. Sign string `json:"sign"`
  140. }
  141. // UpRecData .
  142. type UpRecData struct {
  143. TrackID string `json:"track_id"`
  144. List []*UpRecInfo `json:"list"`
  145. }
  146. // SearchEgg .
  147. type SearchEgg struct {
  148. Plat map[int64][]*struct {
  149. EggID int64 `json:"egg_id"`
  150. Plat int `json:"plat"`
  151. URL string `json:"url"`
  152. MD5 string `json:"md5"`
  153. Size int64 `json:"size"`
  154. } `json:"plat"`
  155. ShowCount int `json:"show_count"`
  156. }
  157. // SearchEggRes .
  158. type SearchEggRes struct {
  159. EggID int64 `json:"egg_id"`
  160. ShowCount int `json:"show_count"`
  161. Source []*SearchEggSource `json:"source"`
  162. }
  163. // SearchEggSource .
  164. type SearchEggSource struct {
  165. URL string `json:"url"`
  166. MD5 string `json:"md5"`
  167. Size int64 `json:"size"`
  168. }
  169. // SearchType search types
  170. const (
  171. SearchTypeAll = "all"
  172. SearchTypeVideo = "video"
  173. SearchTypeBangumi = "media_bangumi"
  174. SearchTypePGC = "media_ft"
  175. SearchTypeLive = "live"
  176. SearchTypeLiveRoom = "live_room"
  177. SearchTypeLiveUser = "live_user"
  178. SearchTypeArticle = "article"
  179. SearchTypeSpecial = "special"
  180. SearchTypeTopic = "topic"
  181. SearchTypeUser = "bili_user"
  182. SearchTypePhoto = "photo"
  183. WxSearchTypeAll = "wx_all"
  184. )
  185. // SearchDefaultArg search default params.
  186. var SearchDefaultArg = map[string]map[string]int{
  187. SearchTypeAll: {
  188. "highlight": 1,
  189. "video_num": 20,
  190. "media_bangumi_num": 3,
  191. "media_ft_num": 3,
  192. "is_new_pgc": 1,
  193. "live_room_num": 1,
  194. "card_num": 1,
  195. "activity": 1,
  196. "bili_user_num": 1,
  197. "bili_user_vl": 3,
  198. "user_num": 1,
  199. "user_video_limit": 3,
  200. "is_star": 1,
  201. },
  202. SearchTypeVideo: {
  203. "highlight": 1,
  204. "pagesize": 20,
  205. "is_new_pgc": 1,
  206. },
  207. SearchTypeBangumi: {
  208. "highlight": 1,
  209. "pagesize": 20,
  210. },
  211. SearchTypePGC: {
  212. "highlight": 1,
  213. "pagesize": 20,
  214. },
  215. SearchTypeLive: {
  216. "highlight": 1,
  217. "live_user_num": 6,
  218. "live_room_num": 40,
  219. },
  220. SearchTypeLiveRoom: {
  221. "highlight": 1,
  222. "pagesize": 40,
  223. },
  224. SearchTypeLiveUser: {
  225. "highlight": 1,
  226. "pagesize": 30,
  227. },
  228. SearchTypeArticle: {
  229. "highlight": 1,
  230. "pagesize": 20,
  231. },
  232. SearchTypeSpecial: {
  233. "pagesize": 20,
  234. },
  235. SearchTypeTopic: {
  236. "pagesize": 20,
  237. },
  238. SearchTypeUser: {
  239. "highlight": 1,
  240. "pagesize": 20,
  241. },
  242. SearchTypePhoto: {
  243. "pagesize": 20,
  244. },
  245. WxSearchTypeAll: {
  246. "video_num": 20,
  247. "media_bangumi_num": 3,
  248. "media_ft_num": 3,
  249. "is_new_pgc": 1,
  250. },
  251. }