extra.go 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. package model
  2. import (
  3. "net/url"
  4. xtime "go-common/library/time"
  5. )
  6. // ChannelInfoResult .
  7. type ChannelInfoResult struct {
  8. *CommonResponse
  9. Data map[int64]*ArchiveChannelData
  10. }
  11. // ArchiveChannelData .
  12. type ArchiveChannelData struct {
  13. Tids []int64 `json:"tids"`
  14. ChannelMap map[int64]*Channel `json:"channels"`
  15. Archive *Archive `json:"-"`
  16. }
  17. // Channel .
  18. type Channel struct {
  19. //Tid int64 `json:"tid"`
  20. TName string `json:"tname"`
  21. //HitRule string `json:"hit_rule"`
  22. //HitNames []string `json:"hit_names"`
  23. HitRules []string `json:"hit_rules"`
  24. Archive *Archive `json:"archive"`
  25. }
  26. // Review review struct
  27. // http://info.bilibili.co/pages/viewpage.action?pageId=5417343
  28. type Review struct {
  29. ReviewID int64 `json:"review_id"`
  30. Type int8 `json:"type"`
  31. Mid int64 `json:"mid"`
  32. MediaName string `json:"media_name"`
  33. Title string `json:"title"`
  34. Content string `json:"content"`
  35. Status int8 `json:"status"`
  36. IsDelete int8 `json:"is_delete"`
  37. CTime xtime.Time `json:"ctime"`
  38. MTime xtime.Time `json:"mtime"`
  39. TypeName string `json:"type_name"`
  40. Author string `json:"author"`
  41. Composer *Account `json:"-"`
  42. }
  43. // MultiReviewInfoResult response of multi review info api
  44. type MultiReviewInfoResult struct {
  45. Code int `json:"code"`
  46. Result map[int64]*Review `json:"result"`
  47. Message string `json:"message"`
  48. TTL int64 `json:"ttl"`
  49. }
  50. // SpecialTag .
  51. type SpecialTag struct {
  52. MID int64 `json:"mid"`
  53. GroupTag string `json:"group_tag"`
  54. BGColor string `json:"bg_color"`
  55. FontColor string `json:"font_color"`
  56. GroupID int `json:"group_id"`
  57. }
  58. // UperSpecial .
  59. // http://info.bilibili.co/pages/viewpage.action?pageId=8479274
  60. type UperSpecial struct {
  61. Code int `json:"code"`
  62. Message string `json:"message"`
  63. TTL int64 `json:"ttl"`
  64. Data struct {
  65. Page Page `json:"page"`
  66. Items []*SpecialTag `json:"items"`
  67. } `json:"data"`
  68. }
  69. // Account account info struct
  70. // http://info.bilibili.co/pages/viewpage.action?pageId=8465956#V3HTTP接口-用户全量信息含计数ProfileStat
  71. // ignore unused field
  72. type Account struct {
  73. Mid int64 `json:"mid"`
  74. Name string `json:"name"`
  75. Rank int32 `json:"rank"`
  76. Follower int64 `json:"follower"`
  77. Official *Official `json:"official"`
  78. SpecialTag []*SpecialTag `json:"special_tag"`
  79. }
  80. // Official .
  81. type Official struct {
  82. Role int8 `json:"role"`
  83. }
  84. // Relation .
  85. // http://info.bilibili.co/pages/viewpage.action?pageId=8742464
  86. type Relation struct {
  87. Follower int `json:"follower"`
  88. }
  89. // AccountInfosResult response of account info api
  90. type AccountInfosResult struct {
  91. Code int `json:"code"`
  92. Data *Account `json:"data"`
  93. Message string `json:"message"`
  94. TTL int64 `json:"ttl"`
  95. }
  96. // ArchiveComplainGroup is the model for archvie appeal group view
  97. type ArchiveComplainGroup struct {
  98. Group
  99. Archive *Archive `json:"archive"`
  100. ChallengeTags ChallTagSlice `json:"challenge_tags"`
  101. }
  102. // ArchiveAppealGroup is the model for archvie appeal group view
  103. type ArchiveAppealGroup struct {
  104. ArchiveComplainGroup
  105. // Appeal Related
  106. Cid int64 `json:"cid"`
  107. AppealReason string `json:"appeal_reason"`
  108. AppealAttachments []string `json:"appeal_attachments"`
  109. }
  110. // ArchiveListPage is the model for archive list result
  111. type ArchiveListPage struct {
  112. Items interface{} `json:"items"`
  113. Page *Page `json:"page"`
  114. }
  115. // Archive is archive info struct
  116. // http://info.bilibili.co/pages/viewpage.action?pageId=3686646
  117. type Archive struct {
  118. Author string `json:"author"`
  119. State int32 `json:"state"`
  120. Mid int64 `json:"mid"`
  121. TypeID int32 `json:"tid"`
  122. Type string `json:"type"`
  123. Title string `json:"title"`
  124. RejectReason string `json:"reject_reason"`
  125. Composer *Account `json:"-"`
  126. OPName string `json:"op_name"`
  127. OPContent string `json:"op_content"`
  128. OPRemark string `json:"op_remark"`
  129. }
  130. // ArchiveResult is response of archive info api
  131. type ArchiveResult struct {
  132. *Archive `json:"archive"`
  133. }
  134. // MultiArchiveInfoResult is response of multi archive info api
  135. type MultiArchiveInfoResult struct {
  136. Code int `json:"code"`
  137. Data map[int64]*ArchiveResult `json:"data"`
  138. Message string `json:"message"`
  139. TTL int64 `json:"ttl"`
  140. }
  141. // ArchiveType archive type struct
  142. type ArchiveType struct {
  143. ID int64 `json:"id"`
  144. PID int64 `json:"pid"`
  145. Name string `json:"name"`
  146. Description string `json:"description"`
  147. }
  148. // ArchiveTypeResult response of archive type api
  149. type ArchiveTypeResult struct {
  150. Code int `json:"code"`
  151. Data map[int32]*ArchiveType `json:"data"`
  152. Message string `json:"message"`
  153. TTL int64 `json:"ttl"`
  154. }
  155. // FixAttachments will fix attachments url as user friendly
  156. // ignore https case
  157. // FIXME: this should be removed after attachment url is be normed
  158. func (ag *ArchiveAppealGroup) FixAttachments() {
  159. if ag.AppealAttachments == nil {
  160. return
  161. }
  162. fixed := make([]string, 0, len(ag.AppealAttachments))
  163. for _, a := range ag.AppealAttachments {
  164. u, err := url.Parse(a)
  165. if err != nil {
  166. continue
  167. }
  168. u.Scheme = "http"
  169. fixed = append(fixed, u.String())
  170. }
  171. ag.AppealAttachments = fixed
  172. }
  173. // CreditMeta .
  174. type CreditMeta struct {
  175. *Business
  176. Producer *Account `json:"producer"`
  177. }
  178. // BlockInfoResp .
  179. type BlockInfoResp struct {
  180. *CommonResponse
  181. Data *struct {
  182. Mid int64 `json:"mid"`
  183. Status int64 `json:"status"`
  184. StartTime int64 `json:"start_time"`
  185. EndTime int64 `json:"end_time"`
  186. BlockedSum int64 `json:"blocked_sum"`
  187. } `json:"data"`
  188. }
  189. // BlockNumResp .
  190. type BlockNumResp struct {
  191. *CommonResponse
  192. Data *struct {
  193. BlockedSum int64 `json:"blockedSum"`
  194. } `json:"data"`
  195. }
  196. // BlockCaseAdd .
  197. // http://info.bilibili.co/pages/viewpage.action?pageId=5417571
  198. type BlockCaseAdd struct {
  199. Aid int64 `json:"aid"`
  200. Mid int64 `json:"mid"`
  201. Operator string `json:"operator"`
  202. OperID int64 `json:"oper_id"`
  203. OriginType int64 `json:"origin_type"`
  204. OriginContent string `json:"origin_content"`
  205. OriginTitle string `json:"origin_title"`
  206. OriginURL string `json:"origin_url"`
  207. ReasonType int64 `json:"reason_type"`
  208. Oid int64 `json:"oid"`
  209. RpID int64 `json:"rp_id"`
  210. TagID int64 `json:"tag_id"`
  211. Type int64 `json:"type"`
  212. Page int64 `json:"page"`
  213. BusinessTime int64 `json:"business_time"`
  214. }