req.go 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. package mcnmodel
  2. import (
  3. mcnadminmodel "go-common/app/admin/main/mcn/model"
  4. "go-common/app/interface/main/mcn/model"
  5. "go-common/app/interface/main/mcn/tool/validate"
  6. "go-common/library/time"
  7. )
  8. //CookieMidInterface cookie set interface, set mid from cookie to arg
  9. type CookieMidInterface interface {
  10. SetMid(midFromCookie int64)
  11. }
  12. //McnCommonReq common mcn
  13. type McnCommonReq struct {
  14. McnCheatReq
  15. SignID int64 `form:"sign_id"`
  16. McnMid int64
  17. }
  18. //CheatInterface cheat interface
  19. type CheatInterface interface {
  20. // Cheat return true if cheated, false if not cheated
  21. Cheat() bool
  22. }
  23. //McnCheatReq cheat
  24. type McnCheatReq struct {
  25. TMcnMid int64 `form:"t_mcn_mid"`
  26. }
  27. //Cheat .
  28. func (m *McnCommonReq) Cheat() bool {
  29. if m.TMcnMid == 0 {
  30. return false
  31. }
  32. m.SetMid(m.TMcnMid)
  33. return true
  34. }
  35. //SetMid set mid
  36. func (m *McnCommonReq) SetMid(midFromCookie int64) {
  37. m.McnMid = midFromCookie
  38. }
  39. //UpCommonReq common up
  40. type UpCommonReq struct {
  41. UpMid int64
  42. }
  43. //SetMid set mid
  44. func (m *UpCommonReq) SetMid(midFromCookie int64) {
  45. m.UpMid = midFromCookie
  46. }
  47. //GetStateReq get state
  48. type GetStateReq struct {
  49. McnCommonReq
  50. }
  51. //McnApplyReq apply req
  52. type McnApplyReq struct {
  53. McnCommonReq
  54. CompanyName string `form:"company_name"`
  55. CompanyLicenseID string `form:"company_license_id"`
  56. ContactName string `form:"contact_name"`
  57. ContactTitle string `form:"contact_title"`
  58. ContactIdcard string `form:"contact_idcard" validate:"idcheck"`
  59. ContactPhone string `form:"contact_phone" validate:"phonecheck"`
  60. CompanyLicenseLink string `form:"company_license_link" validate:"httpcheck"`
  61. ContractLink string `form:"contract_link" validate:"httpcheck"`
  62. }
  63. //CopyTo .
  64. func (m *McnApplyReq) CopyTo(v *McnSign) {
  65. if v == nil {
  66. return
  67. }
  68. v.McnMid = m.McnMid
  69. v.CompanyName = m.CompanyName
  70. v.CompanyLicenseID = m.CompanyLicenseID
  71. v.ContactName = m.ContactName
  72. v.ContactTitle = m.ContactTitle
  73. v.ContactIdcard = m.ContactIdcard
  74. v.ContactPhone = m.ContactPhone
  75. v.CompanyLicenseLink = m.CompanyLicenseLink
  76. v.ContractLink = m.ContractLink
  77. }
  78. //McnBindUpApplyReq .
  79. type McnBindUpApplyReq struct {
  80. McnCommonReq
  81. UpMid int64 `form:"up_mid"`
  82. BeginDate time.Time `form:"begin_date"`
  83. EndDate time.Time `form:"end_date"`
  84. ContractLink string `form:"contract_link"` // 手动检查http格式
  85. UpAuthLink string `form:"up_auth_link"` // 手动检查http格式
  86. UpType int8 `form:"up_type"` // 用户类型,0为站内,1为站外
  87. SiteLink string `form:"site_link"` //up主站外账号链接, 如果up type为1,该项必填
  88. mcnadminmodel.Permits
  89. PublicationPrice int64 `form:"publication_price"` // 单位:1/1000 元
  90. }
  91. //IsSiteInfoOk 检查站外up主信息是否OK,如果不是站外Up主,直接返回ok
  92. func (m *McnBindUpApplyReq) IsSiteInfoOk() bool {
  93. if m.UpType == 0 {
  94. return true
  95. }
  96. return validate.RegHTTPCheck.MatchString(m.SiteLink)
  97. }
  98. //CopyTo .
  99. func (m *McnBindUpApplyReq) CopyTo(v *McnUp) {
  100. v.UpMid = m.UpMid
  101. v.McnMid = m.McnMid
  102. v.BeginDate = m.BeginDate
  103. v.EndDate = m.EndDate
  104. v.ContractLink = m.ContractLink
  105. v.UpAuthLink = m.UpAuthLink
  106. v.UpType = m.UpType
  107. v.SiteLink = m.SiteLink
  108. v.Permission = uint32(m.GetAttrPermitVal())
  109. v.PublicationPrice = m.PublicationPrice
  110. }
  111. //McnUpConfirmReq .
  112. type McnUpConfirmReq struct {
  113. UpCommonReq
  114. BindID int64 `form:"bind_id"`
  115. Choice bool `form:"choice"`
  116. }
  117. //McnUpGetBindReq .
  118. type McnUpGetBindReq struct {
  119. UpCommonReq
  120. BindID int64 `form:"bind_id"`
  121. }
  122. // McnGetDataSummaryReq req
  123. type McnGetDataSummaryReq = McnCommonReq
  124. //McnGetUpListReq req
  125. type McnGetUpListReq struct {
  126. McnCommonReq
  127. UpMid int64 `form:"up_mid"`
  128. model.PageArg
  129. }
  130. //McnGetAccountReq req
  131. type McnGetAccountReq struct {
  132. Mid int64 `form:"mid"`
  133. }
  134. // McnGetMcnOldInfoReq req
  135. type McnGetMcnOldInfoReq struct {
  136. McnCommonReq
  137. }
  138. // McnGetRankReq req to 获取排行
  139. type McnGetRankReq struct {
  140. McnCommonReq
  141. Tid int16 `form:"tid"` // 分区
  142. DataType DataType `form:"data_type"`
  143. }
  144. // McnGetRecommendPoolReq get recommend pool
  145. type McnGetRecommendPoolReq struct {
  146. McnCommonReq
  147. model.PageArg
  148. Tid int16 `form:"tid"`
  149. OrderField string `form:"order_field"`
  150. Sort string `form:"sort"`
  151. }
  152. // McnGetRecommendPoolTidListReq common req
  153. type McnGetRecommendPoolTidListReq = McnCommonReq
  154. // ------inner request
  155. // McnGetRankAPIReq req to 获取排行
  156. type McnGetRankAPIReq struct {
  157. SignID int64 `form:"sign_id"`
  158. Tid int16 `form:"tid"` // 分区
  159. DataType DataType `form:"data_type"`
  160. }
  161. // 播放/弹幕/评论/分享/硬币/收藏/点赞数
  162. const (
  163. ActionTypePlay = "play" //播放
  164. ActionTypeDanmu = "danmu" //弹幕
  165. ActionTypeReply = "reply" //评论
  166. ActionTypeShare = "share" //分享
  167. ActionTypeCoin = "coin" //硬币
  168. ActionTypeFav = "fav" //收藏
  169. ActionTypeLike = "like" //点赞数
  170. )
  171. const (
  172. // UserTypeGuest .
  173. UserTypeGuest = "guest" // 游客
  174. // UserTypeFans .
  175. UserTypeFans = "fans" // 粉丝
  176. )
  177. //McnGetIndexIncReq 增量趋势
  178. type McnGetIndexIncReq struct {
  179. McnCommonReq
  180. Type string `form:"type"`
  181. }
  182. //McnGetIndexSourceReq 来源分区
  183. type McnGetIndexSourceReq = McnGetIndexIncReq
  184. //McnGetPlaySourceReq 稿件播放来源占比
  185. type McnGetPlaySourceReq struct {
  186. McnCommonReq
  187. }
  188. //McnGetMcnFansReq mcn
  189. type McnGetMcnFansReq = McnCommonReq
  190. //McnGetMcnFansIncReq mcn粉丝按天关注数
  191. type McnGetMcnFansIncReq = McnCommonReq
  192. //McnGetMcnFansDecReq mcn粉丝按天取关数
  193. type McnGetMcnFansDecReq = McnCommonReq
  194. //McnGetMcnFansAttentionWayReq mcn粉丝关注渠道
  195. type McnGetMcnFansAttentionWayReq = McnCommonReq
  196. // McnGetBaseFansAttrReq mcn 游客和粉丝基本数据请求
  197. type McnGetBaseFansAttrReq struct {
  198. McnCommonReq
  199. UserType string `form:"user_type"`
  200. }
  201. // McnGetFansAreaReq mcn 地区分布请求
  202. type McnGetFansAreaReq = McnGetBaseFansAttrReq
  203. // McnGetFansTypeReq mcn 游客/粉丝倾向分布请求
  204. type McnGetFansTypeReq = McnGetBaseFansAttrReq
  205. // McnGetFansTagReq mcn 游客/粉丝标签地图分布请求
  206. type McnGetFansTagReq = McnGetBaseFansAttrReq
  207. //McnChangePermitReq change permit
  208. type McnChangePermitReq struct {
  209. McnCommonReq
  210. UpMid int64 `form:"up_mid"`
  211. mcnadminmodel.Permits
  212. UpAuthLink string `form:"up_auth_link" validate:"httpcheck"`
  213. }
  214. //McnPublicationPriceChangeReq change publication price
  215. type McnPublicationPriceChangeReq struct {
  216. McnCommonReq
  217. Price int64 `form:"price"`
  218. UpMid int64 `form:"up_mid"`
  219. }