tables.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. package mcnmodel
  2. import (
  3. "go-common/app/interface/main/mcn/model"
  4. "go-common/library/time"
  5. )
  6. // go get github.com/abice/go-enum
  7. // go:generate go-enum -f=tables.go
  8. // table names
  9. const (
  10. //TableNameMcnUp up
  11. TableNameMcnUp = "mcn_up"
  12. //TableNameMcnSign sign
  13. TableNameMcnSign = "mcn_sign"
  14. //TableNameMcnDataSummary data summary
  15. TableNameMcnDataSummary = "mcn_data_summary"
  16. //TableNameMcnDataUp data up
  17. TableNameMcnDataUp = "mcn_data_up"
  18. //TableNameUpBaseInfo up base info
  19. TableNameUpBaseInfo = "up_base_info"
  20. //TableNameMcnRankUpFan rank for up fans
  21. TableNameMcnRankUpFan = "mcn_rank_up_fans"
  22. //TableNameMcnRankArchiveLike rank for archive likes
  23. TableNameMcnRankArchiveLike = "mcn_rank_archive_likes"
  24. //TableNameMcnUpRecommendPool up recomment pool
  25. TableNameMcnUpRecommendPool = "mcn_up_recommend_pool"
  26. TableMcnUpPermissionApply = "mcn_up_permission_apply"
  27. )
  28. // DataType 数据类型,1累计,2昨日,3上周,4上月
  29. /* ENUM(
  30. Accumulate = 1
  31. Day = 2
  32. Week = 3
  33. Month = 4
  34. ActiveFans = 5
  35. )*/
  36. const (
  37. // DataTypeAccumulate is a DataType of type Accumulate
  38. DataTypeAccumulate DataType = 1
  39. // DataTypeDay is a DataType of type Day
  40. DataTypeDay DataType = 2
  41. // DataTypeWeek is a DataType of type Week
  42. DataTypeWeek DataType = 3
  43. // DataTypeMonth is a DataType of type Month
  44. DataTypeMonth DataType = 4
  45. // DataTypeActiveFans active fans
  46. DataTypeActiveFans DataType = 5
  47. )
  48. const (
  49. // McnDataTypeDay is a McnDataType of type Day
  50. McnDataTypeDay McnDataType = 1
  51. // McnDataTypeMonth is a McnDataType of type Month
  52. McnDataTypeMonth McnDataType = 2
  53. )
  54. // DataType .
  55. type DataType int8
  56. // McnUp up table
  57. type McnUp struct {
  58. ID int64 `json:"id" gorm:"column:id"`
  59. SignID int64 `json:"sign_id" gorm:"column:sign_id"`
  60. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  61. UpMid int64 `json:"up_mid" gorm:"column:up_mid"`
  62. BeginDate time.Time `json:"begin_date" gorm:"column:begin_date"`
  63. EndDate time.Time `json:"end_date" gorm:"column:end_date"`
  64. ContractLink string `json:"contract_link" gorm:"column:contract_link"`
  65. UpAuthLink string `json:"up_auth_link" gorm:"column:up_auth_link"`
  66. RejectReason string `json:"reject_reason" gorm:"column:reject_reason"`
  67. RejectTime string `json:"reject_time" gorm:"column:reject_time"`
  68. State model.MCNUPState `json:"state" gorm:"column:state"`
  69. UpType int8 `json:"up_type" gorm:"column:up_type"` // 用户类型,0为站内,1为站外
  70. SiteLink string `json:"site_link" gorm:"column:site_link"` //up主站外账号链接, 如果up type为1,该项必填
  71. StateChangeTime time.Time `json:"state_change_time" gorm:"column:state_change_time"`
  72. ConfirmTime time.Time `json:"confirm_time" gorm:"column:confirm_time"`
  73. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  74. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  75. Permission uint32 `gorm:"column:permission" json:"permission"`
  76. PublicationPrice int64 `gorm:"column:publication_price" json:"publication_price"` // 单位:1/1000 元
  77. }
  78. // TableName .
  79. func (s *McnUp) TableName() string {
  80. return TableNameMcnUp
  81. }
  82. // IsBindable check if up canbe bind to other
  83. func (s *McnUp) IsBindable() bool {
  84. return isUpBindable(s.State)
  85. }
  86. // IsBeingBindedWithMcn check this up is in the middle of being binded with mcn,
  87. func (s *McnUp) IsBeingBindedWithMcn(mcn *McnSign) bool {
  88. if mcn == nil {
  89. return false
  90. }
  91. if s.SignID == mcn.ID &&
  92. (s.State == model.MCNUPStateOnReview || s.State == model.MCNUPStateNoAuthorize) {
  93. return true
  94. }
  95. return false
  96. }
  97. // McnSign mcn sign table
  98. type McnSign struct {
  99. ID int64 `json:"id" gorm:"column:id"`
  100. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  101. CompanyName string `json:"company_name" gorm:"column:company_name"`
  102. CompanyLicenseID string `json:"company_license_id" gorm:"column:company_license_id"`
  103. CompanyLicenseLink string `json:"company_license_link" gorm:"column:company_license_link"`
  104. ContractLink string `json:"contract_link" gorm:"column:contract_link"`
  105. ContactName string `json:"contact_name" gorm:"column:contact_name"`
  106. ContactTitle string `json:"contact_title" gorm:"column:contact_title"`
  107. ContactIdcard string `json:"contact_idcard" gorm:"column:contact_idcard"`
  108. ContactPhone string `json:"contact_phone" gorm:"column:contact_phone"`
  109. BeginDate time.Time `json:"begin_date" gorm:"column:begin_date"`
  110. EndDate time.Time `json:"end_date" gorm:"column:end_date"`
  111. RejectReason string `json:"reject_reason" gorm:"column:reject_reason"`
  112. RejectTime time.Time `json:"reject_time" gorm:"column:reject_time"`
  113. State model.MCNSignState `json:"state" gorm:"column:state"`
  114. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  115. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  116. Permission uint32 `json:"permission" gorm:"column:permission"`
  117. }
  118. // TableName table name
  119. func (s *McnSign) TableName() string {
  120. return TableNameMcnSign
  121. }
  122. // McnDataType .
  123. /* ENUM(
  124. Day = 1
  125. Month = 2
  126. )*/
  127. type McnDataType int8
  128. // McnDataSummary table
  129. type McnDataSummary struct {
  130. ID int64 `json:"id" gorm:"column:id"`
  131. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  132. SignID int64 `json:"sign_id" gorm:"column:sign_id"`
  133. UpCount int64 `json:"up_count" gorm:"column:up_count"`
  134. FansCountAccumulate int64 `json:"fans_count_accumulate" gorm:"column:fans_count_accumulate"`
  135. FansCountOnline int64 `json:"fans_count_online" gorm:"column:fans_count_online"`
  136. FansCountReal int64 `json:"fans_count_real" gorm:"column:fans_count_real"`
  137. FansCountCheatAccumulate int64 `json:"fans_count_cheat_accumulate" gorm:"column:fans_count_cheat_accumulate"`
  138. FansCountIncreaseDay int64 `json:"fans_count_increase_day" gorm:"column:fans_count_increase_day"`
  139. PlayCountAccumulate int64 `json:"play_count_accumulate" gorm:"column:play_count_accumulate"`
  140. PlayCountIncreaseDay int64 `json:"play_count_increase_day" gorm:"column:play_count_increase_day"`
  141. ArchiveCountAccumulate int64 `json:"archive_count_accumulate" gorm:"column:archive_count_accumulate"`
  142. ActiveTid int64 `json:"active_tid" gorm:"column:active_tid"`
  143. GenerateDate time.Time `json:"generate_date" gorm:"column:generate_date"`
  144. DataType McnDataType `json:"data_type" gorm:"column:data_type"`
  145. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  146. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  147. }
  148. // TableName table name
  149. func (s *McnDataSummary) TableName() string {
  150. return TableNameMcnDataSummary
  151. }
  152. // McnDataUp table name
  153. type McnDataUp struct {
  154. ID int64 `json:"id" gorm:"column:id"`
  155. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  156. SignID int64 `json:"sign_id" gorm:"column:sign_id"`
  157. UpMid int64 `json:"up_mid" gorm:"column:up_mid"`
  158. DataType DataType `json:"data_type" gorm:"column:data_type"`
  159. FansIncreaseAccumulate int32 `json:"fans_increase_accumulate" gorm:"column:fans_increase_accumulate"`
  160. ArchiveCount int32 `json:"archive_count" gorm:"column:archive_count"`
  161. PlayCount int64 `json:"play_count" gorm:"column:play_count"`
  162. FansIncreaseMonth int64 `json:"fans_increase_month" gorm:"column:fans_increase_month"`
  163. FansCount int64 `json:"fans_count" gorm:"column:fans_count"`
  164. FansCountActive int64 `json:"fans_count_active" gorm:"column:fans_count_active"`
  165. GenerateDate time.Time `json:"generate_date" gorm:"column:generate_date"`
  166. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  167. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  168. }
  169. // TableName table name
  170. func (s *McnDataUp) TableName() string {
  171. return TableNameMcnDataUp
  172. }
  173. // UpBaseInfo struct
  174. type UpBaseInfo struct {
  175. ID uint32 `gorm:"column:id"`
  176. Mid int64 `gorm:"column:mid"`
  177. ActiveTid int64 `gorm:"column:active_tid"`
  178. ArticleCountAccumulate int `gorm:"column:article_count_accumulate"`
  179. Activity int `gorm:"column:activity"`
  180. FansCount int `gorm:"column:fans_count"`
  181. }
  182. // TableName .
  183. func (s *UpBaseInfo) TableName() string {
  184. return TableNameUpBaseInfo
  185. }
  186. // McnRankUpFan .
  187. type McnRankUpFan struct {
  188. ID int64 `json:"id" gorm:"column:id"`
  189. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  190. SignID int64 `json:"sign_id" gorm:"column:sign_id"`
  191. UpMid int64 `json:"up_mid" gorm:"column:up_mid"`
  192. Value1 int64 `json:"value1" gorm:"column:value1"`
  193. Value2 int64 `json:"value2" gorm:"column:value2"`
  194. ActiveTid int16 `json:"active_tid" gorm:"column:active_tid"`
  195. DataType DataType `json:"data_type" gorm:"column:data_type"`
  196. GenerateDate time.Time `json:"generate_date" gorm:"column:generate_date"`
  197. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  198. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  199. }
  200. // TableName .
  201. func (s *McnRankUpFan) TableName() string {
  202. return TableNameMcnRankUpFan
  203. }
  204. // McnRankArchiveLike .
  205. type McnRankArchiveLike struct {
  206. ID int64 `json:"id" gorm:"column:id"`
  207. McnMid int64 `json:"mcn_mid" gorm:"column:mcn_mid"`
  208. SignID int64 `json:"sign_id" gorm:"column:sign_id"`
  209. UpMid int64 `json:"up_mid" gorm:"column:up_mid"`
  210. ArchiveID int64 `json:"archive_id" gorm:"column:avid"`
  211. LikeCount int64 `json:"like_count" gorm:"column:like_count"`
  212. PlayIncr int64 `json:"play_incr" gorm:"column:play_incr" `
  213. DataType DataType `json:"data_type" gorm:"column:data_type"`
  214. Tid int16 `json:"tid" gorm:"column:tid"`
  215. GenerateDate time.Time `json:"generate_date" gorm:"column:generate_date"`
  216. Ctime time.Time `json:"ctime" gorm:"column:ctime"`
  217. Mtime time.Time `json:"mtime" gorm:"column:mtime"`
  218. }
  219. // TableName .
  220. func (s *McnRankArchiveLike) TableName() string {
  221. return TableNameMcnRankArchiveLike
  222. }
  223. // McnUpRecommendPool 推荐池 struct
  224. type McnUpRecommendPool struct {
  225. ID int64 `gorm:"column:id" json:"id"`
  226. UpMid int64 `gorm:"column:up_mid" json:"up_mid"`
  227. FansCount int64 `gorm:"column:fans_count" json:"fans_count"`
  228. FansCountIncreaseMonth int64 `gorm:"column:fans_count_increase_month" json:"fans_count_increase_month"`
  229. ArchiveCount int64 `gorm:"column:archive_count" json:"archive_count"`
  230. PlayCountAccumulate int64 `gorm:"column:play_count_accumulate" json:"play_count_accumulate"`
  231. PlayCountAverage int64 `gorm:"column:play_count_average" json:"play_count_average"`
  232. ActiveTid int16 `gorm:"column:active_tid" json:"active_tid"`
  233. LastArchiveTime time.Time `gorm:"column:last_archive_time" json:"last_archive_time"`
  234. State uint8 `gorm:"column:state" json:"state"`
  235. Source int64 `gorm:"column:source" json:"source"`
  236. GenerateTime time.Time `gorm:"column:generate_time" json:"generate_time"`
  237. Ctime time.Time `gorm:"column:ctime" json:"ctime"`
  238. Mtime time.Time `gorm:"column:mtime" json:"mtime"`
  239. }
  240. // TableName table name.
  241. func (s *McnUpRecommendPool) TableName() string {
  242. return TableNameMcnUpRecommendPool
  243. }
  244. // MCNUPRecommendState 推荐状态
  245. // MCNUPRecommendState .
  246. type MCNUPRecommendState int8
  247. // const .
  248. const (
  249. // MCNUPRecommendStateUnKnown 未知状态
  250. MCNUPRecommendStateUnKnown MCNUPRecommendState = 0
  251. // MCNUPRecommendStateOff 未推荐
  252. MCNUPRecommendStateOff MCNUPRecommendState = 1
  253. // MCNUPRecommendStateOn 推荐中
  254. MCNUPRecommendStateOn MCNUPRecommendState = 2
  255. // MCNUPRecommendStateBan 禁止推荐
  256. MCNUPRecommendStateBan MCNUPRecommendState = 3
  257. // MCNUPRecommendStateDel 移除中
  258. MCNUPRecommendStateDel MCNUPRecommendState = 100
  259. )
  260. // MCNUPRecommendSource
  261. // type MCNUPRecommendSource mcnadminmodel.MCNUPRecommendSource
  262. //McnUpPermissionApply permission
  263. type McnUpPermissionApply struct {
  264. ID int64 `gorm:"column:id" json:"id"`
  265. McnMid int64 `gorm:"column:mcn_mid" json:"mcn_mid"`
  266. UpMid int64 `gorm:"column:up_mid" json:"up_mid"`
  267. SignID int64 `gorm:"column:sign_id" json:"sign_id"`
  268. NewPermission uint32 `gorm:"column:new_permission" json:"new_permission"`
  269. OldPermission uint32 `gorm:"column:old_permission" json:"old_permission"`
  270. RejectReason string `gorm:"-" json:"reject_reason"`
  271. RejectTime time.Time `gorm:"-" json:"reject_time"`
  272. State int8 `gorm:"column:state" json:"state"`
  273. Ctime time.Time `gorm:"column:ctime" json:"ctime"`
  274. Mtime time.Time `gorm:"column:mtime" json:"mtime"`
  275. AdminID int64 `gorm:"-" json:"-"`
  276. AdminName string `gorm:"-" json:"-"`
  277. UpAuthLink string `gorm:"column:up_auth_link" json:"up_auth_link"`
  278. }
  279. // TableName table name.
  280. func (s *McnUpPermissionApply) TableName() string {
  281. return TableMcnUpPermissionApply
  282. }