staff.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. package archive
  2. // staff state .
  3. const (
  4. APPLYSTATEOPEN = int8(0)
  5. APPLYSTATEACCEPT = int8(1)
  6. APPLYSTATEREFUSE = int8(2)
  7. //场景是 staff未上线前 up直接删除
  8. APPLYSTATEDEL = int8(3)
  9. APPLYSTATEIGNORE = int8(4)
  10. DEALSTATEOPEN = int8(1)
  11. DEALSTATEDONE = int8(2)
  12. DEALSTATEIGNORE = int8(3)
  13. STATEON = int8(1)
  14. STATEOFF = int8(2)
  15. TYPEUPADD = int8(1)
  16. TYPEUPDEL = int8(2)
  17. TYPEUPMODIFY = int8(3)
  18. TYPESTAFFDEL = int8(4)
  19. TYPEADMINDEL = int8(5)
  20. STAFFLogBizID = int(84)
  21. STAFFLogBizType1 = int(1)
  22. STAFFLogBizType2 = int(2)
  23. STAFFLogBizType3 = int(3)
  24. STAFFLogBizType4 = int(4)
  25. UPRELATIONBLACK = int64(128)
  26. )
  27. //Staff . 正式staff
  28. type Staff struct {
  29. ID int64 `json:"id"`
  30. AID int64 `json:"aid"`
  31. MID int64 `json:"mid"`
  32. StaffMID int64 `json:"staff_mid"`
  33. StaffTitle string `json:"staff_title"`
  34. StaffName string `json:"staff_name"`
  35. StaffTitleID int64 `json:"staff_title_id"`
  36. State int8 `json:"state"`
  37. }
  38. //StaffParam 提交的staff参数
  39. type StaffParam struct {
  40. //apply_id 建议前端传 为后面预留
  41. ApplyID int64 `json:"apply_id"`
  42. Title string `json:"title"`
  43. MID int64 `json:"mid"`
  44. TitleID int64 `json:"title_id"`
  45. }
  46. //StaffBatchParam 批量提交的staff参数
  47. type StaffBatchParam struct {
  48. AID int64 `json:"aid"`
  49. SyncAttr bool `json:"sync_attr"`
  50. Staffs []*StaffParam `json:"staffs"`
  51. }
  52. //ApplyParam 提交申请单参数
  53. type ApplyParam struct {
  54. ID int64 `form:"id"`
  55. Type int8 `form:"type"`
  56. ASID int64 `form:"as_id"`
  57. ApplyAID int64 `form:"apply_aid"`
  58. ApplyStaffMID int64 `form:"apply_staff_mid" validate:"required"`
  59. ApplyUpMID int64 `form:"apply_up_mid"`
  60. ApplyTitle string `form:"apply_title"`
  61. OldTitle string `form:"old_title"`
  62. ApplyTitleID int64 `form:"apply_title_id"`
  63. State int8 `form:"state"`
  64. DealState int8 `form:"deal_state"`
  65. RefuseMid int64 `form:"refuse_mid"`
  66. FlagRefuse bool `form:"flag_refuse"`
  67. FlagAddBlack bool `form:"flag_add_black"`
  68. NoNotify bool `form:"no_notify"`
  69. SyncStaff bool `form:"sync_staff"`
  70. CleanCache bool `form:"clean_cache"`
  71. SyncDynamic bool `form:"sync_dynamic"`
  72. MsgId int `form:"msg_id"`
  73. StaffState int8 `json:"staff_state"`
  74. StaffTitle string `json:"staff_title"`
  75. Archive *Archive `json:"archive"`
  76. UpName string `json:"up_name"`
  77. StaffName string `json:"staff_name"`
  78. StaffsName string `json:"staffs_name"`
  79. NotifyUp bool `json:"notify_up"`
  80. }
  81. type SearchApplyIndex struct {
  82. Indexs []*Index `json:"creative_archive"`
  83. }
  84. type Index struct {
  85. ID int64 `json:"id"`
  86. Item []*IndexItem `json:"apply_staff"`
  87. }
  88. type IndexItem struct {
  89. DealState int8 `json:"deal_state"`
  90. ApplyStaffMID int64 `json:"apply_staff_mid"`
  91. }
  92. //StaffApply 申请单
  93. type StaffApply struct {
  94. ID int64 `json:"id"`
  95. Type int8 `json:"apply_type"`
  96. ASID int64 `json:"apply_as_id"`
  97. ApplyAID int64 `json:"apply_aid"`
  98. ApplyUpMID int64 `json:"apply_up_mid"`
  99. ApplyStaffMID int64 `json:"apply_staff_mid"`
  100. ApplyTitle string `json:"apply_title"`
  101. ApplyTitleID int64 `json:"apply_title_id"`
  102. State int8 `json:"apply_state"`
  103. DealState int8 `json:"deal_state"`
  104. StaffState int8 `json:"staff_state"`
  105. StaffTitle string `json:"staff_title"`
  106. }
  107. //Copy . apply转化成staff
  108. func (s *Staff) Copy(v *ApplyParam) {
  109. s.AID = v.ApplyAID
  110. s.MID = v.ApplyUpMID
  111. s.StaffMID = v.ApplyStaffMID
  112. s.ID = v.ASID
  113. s.StaffTitle = v.ApplyTitle
  114. s.StaffTitleID = v.ApplyTitleID
  115. switch v.State {
  116. case APPLYSTATEACCEPT:
  117. switch v.Type {
  118. case TYPEUPADD:
  119. s.State = STATEON
  120. case TYPEUPMODIFY:
  121. s.State = STATEON
  122. case TYPEUPDEL, TYPEADMINDEL, TYPESTAFFDEL:
  123. s.State = STATEOFF
  124. }
  125. case APPLYSTATEREFUSE:
  126. switch v.Type {
  127. case TYPEUPADD:
  128. s.State = STATEOFF
  129. case TYPEUPMODIFY:
  130. s.State = STATEON
  131. case TYPEUPDEL, TYPEADMINDEL, TYPESTAFFDEL:
  132. s.State = STATEON
  133. }
  134. case APPLYSTATEDEL:
  135. switch v.Type {
  136. case TYPEADMINDEL, TYPESTAFFDEL:
  137. s.State = STATEOFF
  138. }
  139. default:
  140. s.State = STATEOFF
  141. }
  142. }
  143. //Copy . 稿件编辑时用
  144. func (s *ApplyParam) Copy(v *StaffApply) {
  145. s.ApplyAID = v.ApplyAID
  146. s.ApplyStaffMID = v.ApplyStaffMID
  147. s.ASID = v.ASID
  148. s.ApplyTitle = v.ApplyTitle
  149. s.ApplyTitleID = v.ApplyTitleID
  150. s.State = v.State
  151. s.Type = v.Type
  152. }