archive_state.go 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. package archive
  2. const (
  3. // StateOpen 开放浏览
  4. StateOpen = int8(0)
  5. // StateOrange 橙色通过
  6. StateOrange = int8(1)
  7. // StateForbidWait 待审
  8. StateForbidWait = int8(-1)
  9. // StateForbidRecycle 被打回
  10. StateForbidRecycle = int8(-2)
  11. // StateForbidPolice 网警锁定
  12. StateForbidPolice = int8(-3)
  13. // StateForbidLock 被锁定
  14. StateForbidLock = int8(-4)
  15. // StateForbidFackLock 管理员锁定(可浏览)
  16. StateForbidFackLock = int8(-5)
  17. // StateForbidFixed 修复待审
  18. StateForbidFixed = int8(-6)
  19. // StateForbidLater 暂缓审核
  20. StateForbidLater = int8(-7)
  21. // StateForbidPatched 补档待审
  22. StateForbidPatched = int8(-8)
  23. // StateForbidWaitXcode 等待转码
  24. StateForbidWaitXcode = int8(-9)
  25. // StateForbidAdminDelay 延迟审核
  26. StateForbidAdminDelay = int8(-10)
  27. // StateForbidFixing 视频源待修
  28. StateForbidFixing = int8(-11)
  29. // StateForbidStorageFail 转储失败
  30. StateForbidStorageFail = int8(-12)
  31. // StateForbidOnlyComment 允许评论待审
  32. StateForbidOnlyComment = int8(-13)
  33. // StateForbidTmpRecicle 临时回收站
  34. StateForbidTmpRecicle = int8(-14)
  35. // StateForbidDispatch 分发中
  36. StateForbidDispatch = int8(-15)
  37. // StateForbidXcodeFail 转码失败
  38. StateForbidXcodeFail = int8(-16)
  39. // StateForbitUpLoad 创建未提交
  40. StateForbitUpLoad = int8(-20) // NOTE:spell body can judge to change state
  41. // StateForbidSubmit 创建已提交
  42. StateForbidSubmit = int8(-30)
  43. // StateForbidUserDelay 定时发布
  44. StateForbidUserDelay = int8(-40)
  45. // StateForbidUpDelete 用户删除
  46. StateForbidUpDelete = int8(-100)
  47. // AttrYes attribute yes
  48. AttrYes = int32(1)
  49. // AttrNo attribute no
  50. AttrNo = int32(0)
  51. // AttrBitNoRank 禁止排行
  52. AttrBitNoRank = uint(0) // NOTE: double write for archive_forbid
  53. // AttrBitNoDynamic 动态禁止
  54. AttrBitNoDynamic = uint(1) // NOTE: double write for archive_forbid
  55. // AttrBitNoWeb 禁止网页输出
  56. AttrBitNoWeb = uint(2)
  57. // AttrBitNoMobile 禁止客户端列表
  58. AttrBitNoMobile = uint(3)
  59. // AttrBitNoSearch 搜索禁止
  60. AttrBitNoSearch = uint(4)
  61. // AttrBitOverseaLock 海外禁止
  62. AttrBitOverseaLock = uint(5)
  63. // AttrBitNoRecommend 禁止推荐
  64. AttrBitNoRecommend = uint(6) // NOTE: double write for archive_forbid
  65. // AttrBitNoReprint 禁止转载
  66. AttrBitNoReprint = uint(7)
  67. // AttrBitHasHD5 是否高清
  68. AttrBitHasHD5 = uint(8)
  69. // AttrBitIsPGC 是否PGC稿件
  70. AttrBitIsPGC = uint(9)
  71. // AttrBitAllowBp 允许承包
  72. AttrBitAllowBp = uint(10)
  73. // AttrBitIsBangumi 是否番剧
  74. AttrBitIsBangumi = uint(11)
  75. // AttrBitIsPorder 是否私单
  76. AttrBitIsPorder = uint(12)
  77. // AttrBitLimitArea 是否限制地区
  78. AttrBitLimitArea = uint(13)
  79. // AttrBitAllowTag 允许其他人添加tag
  80. AttrBitAllowTag = uint(14)
  81. // AttrBitIsFromArcAPI useless
  82. AttrBitIsFromArcAPI = uint(15) // TODO: delete
  83. // AttrBitJumpURL 跳转
  84. AttrBitJumpURL = uint(16)
  85. // AttrBitIsMovie 是否影视
  86. AttrBitIsMovie = uint(17)
  87. // AttrBitBadgepay 付费
  88. AttrBitBadgepay = uint(18)
  89. //AttrBitPushBlog 推送动态
  90. AttrBitPushBlog = uint(20)
  91. //AttrBitParentMode 家长模式
  92. AttrBitParentMode = uint(21)
  93. //AttrBitUGCPay UGC付费
  94. AttrBitUGCPay = uint(22)
  95. // CopyrightUnknow 未知版权类型
  96. CopyrightUnknow = int8(0)
  97. // CopyrightOriginal 原创
  98. CopyrightOriginal = int8(1)
  99. // CopyrightCopy 转载
  100. CopyrightCopy = int8(2)
  101. // UpFromWeb 网页上传
  102. UpFromWeb = int8(0)
  103. // UpFromPGC PGC上传
  104. UpFromPGC = int8(1)
  105. // UpFromWindows Windows客户端上传
  106. UpFromWindows = int8(2)
  107. // UpFromAPP APP上传
  108. UpFromAPP = int8(3)
  109. // UpFromMAC Mac客户端上传
  110. UpFromMAC = int8(4)
  111. // UpFromSecretPGC 机密PGC上传
  112. UpFromSecretPGC = int8(5)
  113. // UpFromCoopera 合作方嵌套
  114. UpFromCoopera = int8(6)
  115. // UpFromCreator 创作姬上传
  116. UpFromCreator = int8(7)
  117. // UpFromAndroid 安卓上传
  118. UpFromAndroid = int8(8)
  119. // UpFromIOS IOS上传
  120. UpFromIOS = int8(9)
  121. // DelayTypeForAdmin 管理员定时发布
  122. DelayTypeForAdmin = int8(1)
  123. // DelayTypeForUser 用户定时发布
  124. DelayTypeForUser = int8(2)
  125. // RoundBegin 一审阶段
  126. RoundBegin = int8(0)
  127. // RoundAuditSecond 二审:选定分区的多P稿件 及 PGC/活动的单P多P稿件
  128. RoundAuditSecond = int8(10)
  129. // RoundAuditThird 三审:选定分区/PGC/活动 的单P多P稿件
  130. RoundAuditThird = int8(20)
  131. // RoundReviewFlow 私单回查:私单ID大于0
  132. RoundReviewFlow = int8(21)
  133. //RoundReviewBadgepayFlow 付费审核
  134. RoundAuditUGCPayFlow = int8(24)
  135. // RoundReviewFirst 分区回查:粉丝小于配置阈值 如 5000 且 指定分区
  136. RoundReviewFirst = int8(30)
  137. // RoundReviewFirstWaitTrigger 点击/粉丝 等待触发中间状态,7天内达到阈值进列表,未达到自动变99
  138. RoundReviewFirstWaitTrigger = int8(31)
  139. // RoundReviewSecond 社区回查:粉丝大于配置阈值 如 5000 或 优质高危up
  140. RoundReviewSecond = int8(40)
  141. // RoundTriggerFans 粉丝回查:粉丝量达到配置阈值
  142. RoundTriggerFans = int8(80)
  143. // RoundTriggerClick 点击回查:点击量达到配置阈值
  144. RoundTriggerClick = int8(90)
  145. // RoundEnd 结束
  146. RoundEnd = int8(99)
  147. // AccessDefault 非会员可见
  148. AccessDefault = int16(0)
  149. // AccessMember 会员可见
  150. AccessMember = int16(10000)
  151. // LogClientType 日志服务类型
  152. //for buiness
  153. //LogClientVideo 视频business id
  154. LogClientVideo = int(2)
  155. //LogClientArchive 稿件business id
  156. LogClientArchive = int(3)
  157. //LogClientUp up主business id
  158. LogClientUp = int(4)
  159. //LogClientPorder 私单business id
  160. LogClientPorder = int(5)
  161. //LogClientArchiveMusic 稿件bgm business id
  162. LogClientArchiveMusic = int(6)
  163. //LogClientPolicy 策略business id
  164. LogClientPolicy = int(7) //稿件策略组
  165. //LogClientConsumer 一审任务 business id
  166. LogClientConsumer = int(131)
  167. //LogClientTypePorderLog for business type
  168. //LogClientTypePorderLog 私单type id
  169. LogClientTypePorderLog = int(1)
  170. //LogClientTypeVideo 视频 type id
  171. LogClientTypeVideo = int(1)
  172. //LogClientTypeArchive 稿件 type id
  173. LogClientTypeArchive = int(1)
  174. //LogClientTypePorder 私单 id
  175. LogClientTypePorder = int(14)
  176. //LogClientTypePolicy 策略type id
  177. LogClientTypePolicy = int(1) //稿件策略组修改记录
  178. //LogClientArchiveMusicTypeMusic 稿件bgm type id
  179. LogClientArchiveMusicTypeMusic = int(1)
  180. //LogClientArchiveMusicTypeMaterial 稿件bgm素材 type id
  181. LogClientArchiveMusicTypeMaterial = int(2)
  182. //LogClientArchiveMusicTypeCategory 稿件bgm分类 type id
  183. LogClientArchiveMusicTypeCategory = int(3)
  184. //LogClientArchiveMusicTypeMaterialRelation 稿件bgm关联 type id
  185. LogClientArchiveMusicTypeMaterialRelation = int(4)
  186. //LogClientArchiveMusicTypeCategoryRelation 稿件bgm分区关联 type id
  187. LogClientArchiveMusicTypeCategoryRelation = int(5)
  188. //InnerAttrChannelReview 内部属性-频道回查--已删除
  189. InnerAttrChannelReview = uint(0)
  190. //LogClientTypeConsumer 一审任务type id
  191. LogClientTypeConsumer = int(1)
  192. )
  193. var (
  194. _attr = map[int32]int32{
  195. AttrNo: AttrNo,
  196. AttrYes: AttrYes,
  197. }
  198. _access = map[int16]string{
  199. AccessDefault: "非会员可见",
  200. AccessMember: "会员可见",
  201. }
  202. _copyright = map[int8]string{
  203. CopyrightUnknow: "未知",
  204. CopyrightOriginal: "自制",
  205. CopyrightCopy: "转载",
  206. }
  207. _bits = map[uint]string{
  208. AttrBitNoRank: "排行禁止",
  209. AttrBitNoDynamic: "动态禁止",
  210. AttrBitNoWeb: "禁止web端输出",
  211. AttrBitNoMobile: "禁止移动端输出",
  212. AttrBitNoSearch: "禁止搜索",
  213. AttrBitOverseaLock: "海外禁止",
  214. AttrBitNoRecommend: "推荐禁止",
  215. AttrBitNoReprint: "禁止转载",
  216. AttrBitHasHD5: "高清1080P",
  217. // AttrBitVisitorDm: AttrBitVisitorDm,
  218. AttrBitIsPGC: "PGC",
  219. AttrBitAllowBp: "允许承包",
  220. AttrBitIsBangumi: "番剧",
  221. AttrBitIsPorder: "是否私单",
  222. AttrBitLimitArea: "是否地区限制",
  223. AttrBitAllowTag: "允许操作TAG",
  224. // AttrBitIsFromArcAPI: AttrBitIsFromArcAPI,
  225. AttrBitJumpURL: "跳转",
  226. AttrBitIsMovie: "电影",
  227. AttrBitBadgepay: "付费", //pgc付费
  228. AttrBitPushBlog: "禁止粉丝动态",
  229. AttrBitParentMode: "家长模式",
  230. AttrBitUGCPay: "UGC付费",
  231. }
  232. // oversea forbidden typeid
  233. _overseaTypes = map[int16]int16{
  234. 15: 15, //'连载剧集'
  235. 29: 29, //'三次元音乐'
  236. 32: 32, //'完结动画'
  237. 33: 33, //'连载动画'
  238. 34: 34, //'完结剧集'
  239. 37: 37, //'纪录片'
  240. 51: 51, //'资讯'
  241. 54: 54, //'OP/ED/OST'
  242. 71: 71, //'综艺'
  243. 86: 86, //'特摄布袋戏'
  244. 96: 96, //'星海'
  245. 130: 130, //'音乐选集'
  246. 131: 131, //'Korea相关'
  247. 137: 137, //'明星'
  248. 145: 145, //'欧美电影'
  249. 146: 146, //'日本电影'
  250. 147: 147, //'国产电影'
  251. 152: 152, //'官方延伸'
  252. 153: 153, //'国产动画'
  253. }
  254. _upFromTypes = map[int8]string{
  255. UpFromWeb: "网页上传",
  256. UpFromPGC: "PGC上传",
  257. UpFromWindows: "Windows客户端上传",
  258. UpFromAPP: "APP上传",
  259. UpFromMAC: "Mac客户端上传",
  260. UpFromSecretPGC: "机密PGC上传",
  261. UpFromCoopera: "合作方嵌套",
  262. UpFromCreator: "创作姬上传",
  263. UpFromAndroid: "安卓上传",
  264. UpFromIOS: "IOS上传",
  265. }
  266. )
  267. // UpFrom get upfrom desc
  268. func UpFrom(ufID int8) string {
  269. return _upFromTypes[ufID]
  270. }
  271. // Attr attribute
  272. type Attr int32
  273. // InCopyrights in correct copyrights.
  274. func InCopyrights(cp int8) (ok bool) {
  275. _, ok = _copyright[cp]
  276. return
  277. }
  278. // CopyrightsDesc return copyrights desc.
  279. func CopyrightsDesc(cp int8) (desc string) {
  280. desc = _copyright[cp]
  281. return
  282. }
  283. // AccessDesc return acces desc.
  284. func AccessDesc(acces int16) (desc string) {
  285. desc = _access[acces]
  286. return
  287. }
  288. // BitDesc return bit desc.
  289. func BitDesc(bit uint) (desc string) {
  290. return _bits[bit]
  291. }
  292. // InAttr in correct attrs.
  293. func InAttr(attr int32) (ok bool) {
  294. _, ok = _attr[attr]
  295. return
  296. }
  297. // InOverseaType check in oversea forbid type.
  298. func InOverseaType(typeID int16) (ok bool) {
  299. _, ok = _overseaTypes[typeID]
  300. return
  301. }
  302. // NormalState check state.
  303. func NormalState(state int8) bool {
  304. return state == StateOpen || state == StateOrange
  305. }
  306. // NotAllowDelay check need delete dtime of state.
  307. func NotAllowDelay(state int8) bool {
  308. return state == StateForbidRecycle || state == StateForbidLock
  309. }
  310. // AttrSet set attribute.
  311. func (arc *Archive) AttrSet(v int32, bit uint) {
  312. arc.Attribute = arc.Attribute&(^(1 << bit)) | (v << bit)
  313. }
  314. // AttrVal get attribute.
  315. func (arc *Archive) AttrVal(bit uint) int32 {
  316. return (arc.Attribute >> bit) & int32(1)
  317. }
  318. // WithAttr set attribute value with a attr value.
  319. func (arc *Archive) WithAttr(attr Attr) {
  320. arc.Attribute = arc.Attribute | int32(attr)
  321. }
  322. // NotAllowUp check archive is or not allow update state.
  323. func (arc *Archive) NotAllowUp() bool {
  324. return arc.State == StateForbidUpDelete || arc.State == StateForbidLater || arc.State == StateForbidLock || arc.State == StateForbidPolice
  325. }
  326. //InnerAttrSet set inner_attr
  327. func (addit *Addit) InnerAttrSet(v int64, bit uint) {
  328. addit.InnerAttr = addit.InnerAttr&(^(1 << bit)) | (v << bit)
  329. }