oper.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. package archive
  2. import (
  3. "fmt"
  4. "go-common/app/admin/main/videoup/model/utils"
  5. )
  6. // .
  7. const (
  8. // OperTypeMission 活动id被修改
  9. OperTypeMission = int8(1)
  10. // OperTypeTag tag被修改
  11. OperTypeTag = int8(2)
  12. // OperTypeCopyright 版权类型被修改
  13. OperTypeCopyright = int8(3)
  14. // OperTypeTypeID 分区ID被修改
  15. OperTypeTypeID = int8(4)
  16. // OperTypeRejectReason 打回理由被修改
  17. OperTypeRejectReason = int8(5)
  18. // OperTypeForwardID 转车跳转被修改
  19. OperTypeForwardID = int8(6)
  20. // OperTypeFlowID 私单类型被修改
  21. OperTypeFlowID = int8(7)
  22. // OperTypeDelay 定时发布被修改
  23. OperTypeDelay = int8(8)
  24. // OperTypePtime 发布时间被修改
  25. OperTypePtime = int8(10)
  26. // OperTypeAccess 可见属性被修改
  27. OperTypeAccess = int8(11)
  28. // OperTypeAduitReason 审核理由被修改
  29. OperTypeAduitReason = int8(12)
  30. // OperTypeRecicleTag 打回理由被修改
  31. OperTypeRecicleTag = int8(13)
  32. // OperTypeTaskID 任务ID被修改
  33. OperTypeTaskID = int8(14)
  34. // OperTypeOpenTag 通过Tag被修改
  35. OperTypeOpenTag = int8(15)
  36. // OperTypeDynamic 动态描述被修改
  37. OperTypeDynamic = int8(16)
  38. OperNotify = int8(17)
  39. //私单
  40. OperPorderIndustryID = int8(18)
  41. OperPorderOfficial = int8(19)
  42. OperPorderBrandID = int8(20)
  43. OperPorderBrandName = int8(21)
  44. OperPorderShowType = int8(22)
  45. OperPorderAdvertiser = int8(23)
  46. OperPorderAgent = int8(24)
  47. OperPorderShowFront = int8(25)
  48. //频道回查属性
  49. OperFlowAttrNoChannel = int8(26)
  50. OperFlowAttrNoHot = int8(27)
  51. // OperStyleOne 操作展示类型1:[%s]从[%v]设为[%v]
  52. OperStyleOne = int8(1)
  53. // OperStyleTwo 操作展示类型2:[%s]%v:%v
  54. OperStyleTwo = int8(2)
  55. )
  56. var (
  57. //FlowOperType flow oper id
  58. FlowOperType = map[int64]int8{
  59. FlowGroupNoChannel: OperFlowAttrNoChannel,
  60. FlowGroupNoHot: OperFlowAttrNoHot,
  61. }
  62. _operType = map[int8]string{
  63. OperTypeMission: "活动ID",
  64. OperTypeTag: "TAG内容",
  65. OperTypeCopyright: "投稿类型",
  66. OperTypeTypeID: "分区类型",
  67. OperTypeRejectReason: "回查理由",
  68. OperTypeForwardID: "撞车跳转",
  69. OperTypeFlowID: "流量TAG",
  70. OperTypeDelay: "定时发布",
  71. OperTypePtime: "发布时间",
  72. OperTypeAccess: "可见属性",
  73. OperTypeAduitReason: "审核理由",
  74. OperTypeRecicleTag: "打回Tag",
  75. OperTypeTaskID: "任务ID",
  76. OperTypeOpenTag: "通过Tag",
  77. OperTypeDynamic: "动态描述",
  78. OperNotify: "系统通知",
  79. OperPorderIndustryID: "推广行业",
  80. OperPorderOfficial: "是否官方",
  81. OperPorderBrandID: "推广品牌ID",
  82. OperPorderBrandName: "推广品牌",
  83. OperPorderShowType: "推广形式",
  84. OperPorderAdvertiser: "广告主",
  85. OperPorderAgent: "代理商",
  86. OperPorderShowFront: "是否前端展示",
  87. OperFlowAttrNoChannel: "频道禁止",
  88. OperFlowAttrNoHot: "热门禁止",
  89. }
  90. )
  91. // ArcOper archive oper.
  92. type ArcOper struct {
  93. ID int64
  94. Aid int64
  95. UID int64
  96. TypeID int16
  97. State int16
  98. Content string
  99. Round int8
  100. Attribute int32
  101. LastID int64
  102. Remark string
  103. }
  104. // VideoOper video oper.
  105. type VideoOper struct {
  106. ID int64 `json:"id"`
  107. AID int64 `json:"aid"`
  108. UID int64 `json:"uid"`
  109. VID int64 `json:"vid"`
  110. Status int16 `json:"status"`
  111. Content string `json:"content"`
  112. Attribute int32 `json:"attribute"`
  113. LastID int64 `json:"last_id"`
  114. Remark string `json:"remark"`
  115. CTime utils.FormatTime `json:"ctime"`
  116. }
  117. // Operformat oper format.
  118. func Operformat(tagID int8, old, new interface{}, style int8) (cont string) {
  119. var template string
  120. switch style {
  121. case OperStyleOne:
  122. template = "[%s]从[%v]设为[%v]"
  123. case OperStyleTwo:
  124. template = "[%s]%v:%v"
  125. }
  126. cont = fmt.Sprintf(template, _operType[tagID], old, new)
  127. return
  128. }
  129. // AccessState get orange state
  130. func AccessState(state int8, access int16) (newState int16) {
  131. if NormalState(state) && access == AccessMember {
  132. newState = access
  133. return
  134. }
  135. newState = int16(state)
  136. return
  137. }