appeal.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. package appeal
  2. import (
  3. "go-common/app/service/main/archive/api"
  4. "go-common/library/time"
  5. )
  6. // Appeal state
  7. const (
  8. // StateCreate 用户刚创建申诉
  9. StateCreate = 1
  10. // StateReply 管理员回复,并且用户已读
  11. StateReply = 2
  12. // StateAdminClose 管理员关闭申诉
  13. StateAdminClose = 3
  14. // StateUserFinished 用户已解决申诉(评分)
  15. StateUserFinished = 4
  16. // StateTimeoutClose 超时关闭申诉
  17. StateTimeoutClose = 5
  18. // StateNoRead 管理员回复,用户未读
  19. StateNoRead = 6
  20. // StateUserClosed 用户直接关闭申诉
  21. StateUserClosed = 7
  22. // StateAdminFinished 管理员已通过申诉
  23. StateAdminFinished = 8
  24. // EventStateAdminReply 管理员回复
  25. EventStateAdminReply = 1
  26. // EventStateAdminNote 管理员回复并记录
  27. EventStateAdminNote = 2
  28. // EventStateUserReply 用户回复
  29. EventStateUserReply = 3
  30. // EventStateSystem 系统回复
  31. EventStateSystem = 4
  32. // Business appeal business
  33. Business = 2
  34. // ReplyMsg appeal auto reply msg
  35. ReplyMsg = "您好,您的反馈我们已收到,会尽快核实处理,请您稍等。"
  36. //ReplyEvent 1:管理员回复;2:管理员备注;3:用户回复;4:系统回复
  37. ReplyUserEvent = 3
  38. ReplySystemEvent = 4
  39. )
  40. // AppealMeta for appeal detail.
  41. type AppealMeta struct {
  42. ID int64 `gorm:"column:id" json:"id"`
  43. Tid int32 `gorm:"column:tid" json:"tid"`
  44. Gid int32 `gorm:"column:gid" json:"gid"`
  45. Oid int64 `gorm:"column:oid" json:"oid"`
  46. Mid int64 `gorm:"column:mid" json:"mid"`
  47. State int8 `gorm:"column:state" json:"state"`
  48. Business int8 `gorm:"column:business" json:"business"`
  49. BusinessState int8 `gorm:"column:business_state" json:"business_state"`
  50. Assignee int32 `gorm:"column:assignee_adminid" json:"assignee_adminid"`
  51. Adminid int32 `gorm:"column:adminid" json:"adminid"`
  52. MetaData string `gorm:"column:metadata" json:"metadata"`
  53. Desc string `gorm:"column:description" json:"description"`
  54. Attachments []*Attachment `gorm:"-" json:"attachments"`
  55. Events []*EventNew `gorm:"-" json:"events"`
  56. CTime time.Time `json:"ctime"`
  57. MTime time.Time `json:"mtime"`
  58. }
  59. //EventNew for new.
  60. type EventNew struct {
  61. ID int64 `gorm:"column:id" json:"id"`
  62. Cid int64 `gorm:"column:cid" json:"cid"`
  63. Event int64 `gorm:"column:event" json:"event"`
  64. Adminid int64 `gorm:"column:adminid" json:"adminid"`
  65. Content string `gorm:"column:content" json:"content"`
  66. Attachments string `gorm:"column:attachments" json:"attachments"`
  67. CTime time.Time `gorm:"column:ctime" json:"ctime"`
  68. MTime time.Time `gorm:"column:mtime" json:"mtime"`
  69. }
  70. // Appeal info.
  71. type Appeal struct {
  72. ID int64 `json:"id"`
  73. Oid int64 `json:"oid"`
  74. Cid int64 `json:"cid"`
  75. Mid int64 `json:"mid"`
  76. Aid int64 `json:"aid"`
  77. Tid int8 `json:"tid"`
  78. Title string `json:"title"`
  79. State int8 `json:"state"`
  80. Visit int8 `json:"visit"`
  81. QQ string `json:"qq"`
  82. Email string `json:"email"`
  83. Phone string `json:"phone"`
  84. Pics string `json:"pics"`
  85. Content string `json:"content"`
  86. Description string `json:"description"`
  87. Star int8 `json:"star"`
  88. CTime time.Time `json:"ctime"`
  89. MTime time.Time `json:"mtime"`
  90. Attachments []*Attachment `json:"attachments"`
  91. // event
  92. Events []*Event `json:"events"`
  93. // archive
  94. Archive *api.Arc `json:"archive,omitempty"`
  95. UserInfo *UserInfo `json:"userinfo"`
  96. }
  97. type UserInfo struct {
  98. MID int64 `json:"mid"`
  99. Name string `json:"name"`
  100. Sex string `json:"sex"`
  101. Face string `json:"face"`
  102. Rank int32 `json:"rank"`
  103. Level int32 `json:"level"`
  104. }
  105. // Event appeal work order deal.
  106. type Event struct {
  107. ID int64 `json:"id"`
  108. AdminID int64 `json:"adminid"`
  109. Content string `json:"content"`
  110. ApID int64 `json:"apid"`
  111. Pics string `json:"pics"`
  112. Event int64 `json:"event"`
  113. Attachments string `json:"attachments"`
  114. CTime time.Time `json:"ctime"`
  115. MTime time.Time `json:"mtime"`
  116. }
  117. // Attachment is appeal attachment.
  118. type Attachment struct {
  119. ID int64 `json:"id"`
  120. Cid int64 `json:"cid"`
  121. Path string `json:"path"`
  122. }
  123. // Contact user contacts.
  124. type Contact struct {
  125. Mid int64 `json:"mid"`
  126. Uname string `json:"uname"`
  127. TelPhone string `json:"telPhone"`
  128. Email string `json:"email"`
  129. }
  130. // BusinessAppeal for new arc add appeal.
  131. type BusinessAppeal struct {
  132. BusinessTypeID int64 `json:"business_typeid"`
  133. BusinessMID int64 `json:"business_mid"`
  134. BusinessTitle string `json:"business_title"`
  135. BusinessContent string `json:"business_content "`
  136. }
  137. // IsOpen appeal open state.
  138. func IsOpen(state int8) bool {
  139. return state == StateCreate || state == StateReply || state == StateNoRead
  140. }
  141. // OpenedStates open get appeal
  142. func OpenedStates() (states []int64) {
  143. return []int64{StateCreate, StateReply, StateNoRead}
  144. }
  145. // ClosedStates get appeal
  146. func ClosedStates() (states []int64) {
  147. return []int64{StateAdminClose, StateUserFinished, StateTimeoutClose, StateUserClosed, StateAdminFinished}
  148. }
  149. // IsClosed appeal is close.
  150. func IsClosed(state int8) (is bool) {
  151. if state == StateAdminClose || state == StateUserFinished || state == StateTimeoutClose || state == StateUserClosed || state == StateAdminFinished {
  152. is = true
  153. }
  154. return
  155. }
  156. // Allow archive state in (-2,-4) can add appeal.
  157. func Allow(state int8) bool {
  158. return state == -2 || state == -4
  159. }