req.go 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. package model
  2. import (
  3. "time"
  4. xtime "go-common/library/time"
  5. "github.com/pkg/errors"
  6. )
  7. // MCNSignEntryReq req .
  8. type MCNSignEntryReq struct {
  9. MCNMID int64 `json:"mcn_mid" validate:"min=1"`
  10. BeginDate string `json:"begin_date" validate:"required"` // 0000-00-00
  11. EndDate string `json:"end_date" validate:"required"` // 0000-00-00
  12. SignPayInfo []*SignPayReq `json:"sign_pay_info"`
  13. Permits *Permits `json:"permits"`
  14. UserName string
  15. UID int64
  16. Permission uint32
  17. }
  18. // AttrPermitSet set Permission.
  19. func (req *MCNSignEntryReq) AttrPermitSet() {
  20. req.Permission = req.Permits.GetAttrPermitVal()
  21. }
  22. // MCNSignPermissionReq .
  23. type MCNSignPermissionReq struct {
  24. SignID int64 `json:"sign_id" validate:"required"`
  25. Permits *Permits `json:"permits"`
  26. Permission uint32
  27. UserName string
  28. UID int64
  29. }
  30. // AttrPermitSet set Permission.
  31. func (req *MCNSignPermissionReq) AttrPermitSet() {
  32. req.Permission = req.Permits.GetAttrPermitVal()
  33. }
  34. // MCNUPPermitStateReq .
  35. type MCNUPPermitStateReq struct {
  36. State MCNUPPermissionState `form:"state" validate:"required"`
  37. PageArg
  38. }
  39. // MCNUPPermitOPReq .
  40. type MCNUPPermitOPReq struct {
  41. ID int64 `json:"id" validate:"min=1"`
  42. Action MCNUPPermissionAction `json:"action" validate:"min=1"`
  43. RejectReason string `json:"reject_reason"`
  44. UserName string
  45. UID int64
  46. }
  47. // ParseTime .
  48. func (req *MCNSignEntryReq) ParseTime() (stime, etime xtime.Time, err error) {
  49. var st, et time.Time
  50. if st, err = time.ParseInLocation(TimeFormatDay, req.BeginDate, time.Local); err != nil {
  51. err = errors.Errorf("time.ParseInLocation(%s) error(%+v)", req.BeginDate, err)
  52. return
  53. }
  54. if et, err = time.ParseInLocation(TimeFormatDay, req.EndDate, time.Local); err != nil {
  55. err = errors.Errorf("time.ParseInLocation(%s) error(%+v)", req.EndDate, err)
  56. return
  57. }
  58. stime = xtime.Time(st.Unix())
  59. etime = xtime.Time(et.Unix())
  60. return
  61. }
  62. // SignPayReq .
  63. type SignPayReq struct {
  64. DueDate string `json:"due_date" validate:"required"` // 0000-00-00
  65. PayValue int64 `json:"pay_value" validate:"min=1"` // thousand bit
  66. }
  67. // MCNSignInfoReq req
  68. type MCNSignInfoReq struct {
  69. SignID int64 `form:"sign_id" validate:"min=1"`
  70. }
  71. // MCNSignStateReq req .
  72. type MCNSignStateReq struct {
  73. State MCNSignState `form:"state" validate:"min=0"`
  74. PageArg
  75. }
  76. // MCNSignStateOpReq .
  77. type MCNSignStateOpReq struct {
  78. SignID int64 `json:"sign_id" validate:"min=1"`
  79. Action MCNSignAction `json:"action" validate:"min=0"`
  80. RejectReason string `json:"reject_reason"`
  81. UserName string
  82. UID int64
  83. }
  84. // MCNUPStateReq req .
  85. type MCNUPStateReq struct {
  86. State MCNUPState `form:"state" validate:"min=0"`
  87. PageArg
  88. }
  89. // MCNUPStateOpReq req .
  90. type MCNUPStateOpReq struct {
  91. SignUpID int64 `json:"sign_up_id" validate:"min=1"`
  92. Action MCNUPAction `json:"action" validate:"min=0"`
  93. RejectReason string `json:"reject_reason"`
  94. UserName string
  95. UID int64
  96. }
  97. // MCNListReq req .
  98. type MCNListReq struct {
  99. McnCommonReq
  100. Permits
  101. ExpireSign bool `form:"expire_sign"`
  102. ExpirePay bool `form:"expire_pay"`
  103. FansNumMin int64 `form:"fans_num_min"`
  104. FansNumMax int64 `form:"fans_num_max"`
  105. State MCNSignState `form:"state" default:"-1"`
  106. SortUP string `form:"sort_up"`
  107. SortAllFans string `form:"sort_all_fans"`
  108. SortRiseFans string `form:"sort_rise_fans"`
  109. SortTrueRiseFans string `form:"sort_true_rise_fans"`
  110. SortCheatFans string `form:"sort_cheat_fans"`
  111. Order string `form:"order" default:"s.mtime"`
  112. Sort string `form:"sort" default:"DESC"`
  113. PageArg
  114. ExportArg
  115. }
  116. // MCNPayEditReq req .
  117. type MCNPayEditReq struct {
  118. ID int64 `json:"id" validate:"min=1"`
  119. MCNMID int64 `json:"mcn_mid" validate:"min=1"`
  120. SignID int64 `json:"sign_id" validate:"min=1"`
  121. DueDate string `json:"due_date" validate:"required"`
  122. PayValue int64 `json:"pay_value" validate:"min=1"`
  123. UserName string
  124. UID int64
  125. }
  126. // MCNPayStateEditReq req .
  127. type MCNPayStateEditReq struct {
  128. ID int64 `json:"id" validate:"min=1"`
  129. MCNMID int64 `json:"mcn_mid" validate:"min=1"`
  130. SignID int64 `json:"sign_id" validate:"min=1"`
  131. State int8 `json:"state"`
  132. UserName string
  133. UID int64
  134. }
  135. // MCNStateEditReq req .
  136. type MCNStateEditReq struct {
  137. ID int64 `json:"id" validate:"min=1"`
  138. MCNMID int64 `json:"mcn_mid" validate:"min=1"`
  139. Action MCNSignAction `json:"action"`
  140. State MCNSignState
  141. UserName string
  142. UID int64
  143. }
  144. // MCNRenewalReq req .
  145. type MCNRenewalReq struct {
  146. ID int64 `json:"id" validate:"min=1"`
  147. MCNMID int64 `json:"mcn_mid" validate:"min=1"`
  148. BeginDate string `json:"begin_date" validate:"required"` // 0000-00-00
  149. EndDate string `json:"end_date" validate:"required"` // 0000-00-00
  150. ContractLink string `json:"contract_link" validate:"required"`
  151. SignPayInfo []*SignPayReq `json:"sign_pay_info"`
  152. Permits Permits `json:"permits"`
  153. Permission uint32
  154. UserName string
  155. UID int64
  156. }
  157. // AttrPermitSet set Permission.
  158. func (req *MCNRenewalReq) AttrPermitSet() {
  159. req.Permission = req.Permits.GetAttrPermitVal()
  160. }
  161. // MCNInfoReq req .
  162. type MCNInfoReq struct {
  163. McnCommonReq
  164. ID int64 `form:"id"`
  165. }
  166. // MCNUPListReq req .
  167. type MCNUPListReq struct {
  168. SignID int64 `form:"sign_id" validate:"required"`
  169. DataType int8 `form:"data_type" validate:"min=1"`
  170. State MCNUPState `form:"state" default:"-1"`
  171. ActiveTID int64 `form:"active_tid"`
  172. FansNumMin int64 `form:"fans_num_min"`
  173. FansNumMax int64 `form:"fans_num_max"`
  174. UPMID int64 `form:"up_mid"`
  175. SortFansCount string `form:"sort_fans_count"`
  176. SortFansCountActive string `form:"sort_fans_count_active"`
  177. SortFansIncreaseAccumulate string `form:"sort_fans_increase_accumulate"`
  178. SortArchiveCount string `form:"sort_archive_count"`
  179. SortPlayCount string `form:"sort_play_count"`
  180. SortPubPrice string `form:"sort_pub_price"`
  181. UpType int8 `form:"up_type" default:"-1"`
  182. Order string `form:"order" default:"u.mtime"`
  183. Sort string `form:"sort" default:"DESC"`
  184. Permits
  185. PageArg
  186. ExportArg
  187. }
  188. // MCNUPStateEditReq req .
  189. type MCNUPStateEditReq struct {
  190. ID int64 `json:"id" validate:"required"`
  191. SignID int64 `json:"sign_id" validate:"required"`
  192. MCNMID int64 `json:"mcn_mid" validate:"required"`
  193. UPMID int64 `json:"up_mid" validate:"required"`
  194. Action MCNUPAction `json:"action"`
  195. State MCNUPState
  196. UserName string
  197. UID int64
  198. }
  199. // MCNUPRecommendReq req .
  200. type MCNUPRecommendReq struct {
  201. TID int64 `form:"tid"`
  202. UpMid int64 `form:"up_mid"`
  203. FansMin int64 `form:"fans_min"`
  204. FansMax int64 `form:"fans_max"`
  205. PlayMin int64 `form:"play_min"`
  206. PlayMax int64 `form:"play_max"`
  207. PlayAverageMin int64 `form:"play_average_min"`
  208. PlayAverageMax int64 `form:"play_average_max"`
  209. State MCNUPRecommendState `form:"state"`
  210. Source MCNUPRecommendSource `form:"source"`
  211. Order string `form:"order" default:"mtime"`
  212. Sort string `form:"sort" default:"DESC"`
  213. PageArg
  214. ExportArg
  215. }
  216. // MCNCheatListReq req .
  217. type MCNCheatListReq struct {
  218. McnCommonReq
  219. UPMID int64 `form:"up_mid"`
  220. PageArg
  221. }
  222. // MCNCheatUPListReq struct .
  223. type MCNCheatUPListReq struct {
  224. UPMID int64 `form:"up_mid" validate:"required"`
  225. PageArg
  226. }
  227. // MCNImportUPInfoReq struct .
  228. type MCNImportUPInfoReq struct {
  229. McnCommonReq
  230. UPMID int64 `form:"up_mid" validate:"required"`
  231. }
  232. // MCNImportUPRewardSignReq struct .
  233. type MCNImportUPRewardSignReq struct {
  234. SignID int64 `json:"sign_id" validate:"required"`
  235. UPMID int64 `json:"up_mid" validate:"required"`
  236. UserName string
  237. UID int64
  238. }
  239. // RecommendUpReq req .
  240. type RecommendUpReq struct {
  241. UpMid int64 `json:"up_mid" validate:"min=1"`
  242. UserName string
  243. UID int64
  244. }
  245. // MCNIncreaseListReq struct .
  246. type MCNIncreaseListReq struct {
  247. McnCommonReq
  248. DataType int8 `form:"data_type"`
  249. ActiveTID int64 `form:"active_tid" default:"65535"`
  250. PageArg
  251. }
  252. // RecommendStateOpReq .
  253. type RecommendStateOpReq struct {
  254. UpMids []int64 `json:"up_mids"`
  255. Action MCNUPRecommendAction `json:"action" validate:"min=1"`
  256. UserName string
  257. UID int64
  258. }
  259. // McnGetRankReq req to 获取排行
  260. type McnGetRankReq struct {
  261. McnCommonReq
  262. Tid int16 `form:"tid"` // 分区 1累计,2昨日,3上周,4上月 0全部
  263. DataType DataType `form:"data_type"`
  264. PageArg
  265. ExportArg
  266. }
  267. // McnCommonReq common mcn
  268. type McnCommonReq struct {
  269. SignID int64 `form:"sign_id"`
  270. MCNMID int64 `form:"mcn_mid"`
  271. }
  272. // TotalMcnDataReq .
  273. type TotalMcnDataReq struct {
  274. Date xtime.Time `form:"date" validate:"required"`
  275. }