sign_up.go 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. package signmodel
  2. import (
  3. "go-common/app/admin/main/up/util"
  4. "go-common/library/time"
  5. )
  6. const (
  7. //TableNameSignTask .
  8. TableNameSignTask = "sign_task"
  9. //TableNameSignTaskHistory .
  10. TableNameSignTaskHistory = "sign_task_history"
  11. //TableNameSignUp .
  12. TableNameSignUp = "sign_up"
  13. //TableNameSignContract .
  14. TableNameSignContract = "sign_contract"
  15. //TableNameSignPay .
  16. TableNameSignPay = "sign_pay"
  17. //TableNameSignTaskAbsence .
  18. TableNameSignTaskAbsence = "sign_task_absence"
  19. )
  20. const (
  21. //TaskTypeAccumulate 0
  22. TaskTypeAccumulate = 0
  23. //TaskTypeDay 1
  24. TaskTypeDay = 1
  25. //TaskTypeWeek 2
  26. TaskTypeWeek = 2
  27. //TaskTypeMonth 3
  28. TaskTypeMonth = 3
  29. //TaskTypeQuarter 4 季度
  30. TaskTypeQuarter = 4
  31. )
  32. //TaskTypeStr get task type str
  33. func TaskTypeStr(taskType int) string {
  34. switch taskType {
  35. case TaskTypeAccumulate:
  36. return "累计"
  37. case TaskTypeDay:
  38. return "每日"
  39. case TaskTypeWeek:
  40. return "每周"
  41. case TaskTypeMonth:
  42. return "每月"
  43. case TaskTypeQuarter:
  44. return "每季度"
  45. }
  46. return "未知"
  47. }
  48. const (
  49. //EmailStateNotSend 0
  50. EmailStateNotSend = 0
  51. //EmailStateSendSucc 1
  52. EmailStateSendSucc = 1
  53. )
  54. //SignUpOnlyID struct
  55. type SignUpOnlyID struct {
  56. ID uint32
  57. }
  58. //SignUpOnlySignID struct
  59. type SignUpOnlySignID struct {
  60. SignID uint32
  61. }
  62. // const sign_up中的state定义
  63. const (
  64. SignStateOnSign = 0
  65. SignStateExpire = 1
  66. )
  67. // const sign_up中的due_warn定义
  68. const (
  69. DueWarnNoWarn = 1
  70. DueWarnWarn = 2
  71. )
  72. // const sign_up中的pay_expire_state定义
  73. const (
  74. // PayExpireStateNormal 未到期
  75. PayExpireStateNormal = 1
  76. // PayExpireStateDue 即将到期
  77. PayExpireStateDue = 2
  78. )
  79. //SignUp struct
  80. type SignUp struct {
  81. ID uint32 `gorm:"column:id"`
  82. Sex int8 `gorm:"column:sex"`
  83. Mid int64 `gorm:"column:mid"`
  84. BeginDate time.Time `gorm:"column:begin_date"`
  85. EndDate time.Time `gorm:"column:end_date"`
  86. State int8 `gorm:"column:state"`
  87. DueWarn int8 `gorm:"column:due_warn"`
  88. PayExpireState int8 `gorm:"column:pay_expire_state"`
  89. Country string `gorm:"column:country"`
  90. Province string `gorm:"column:province"`
  91. City string `gorm:"column:city"`
  92. Note string `gorm:"column:note"`
  93. AdminID int `gorm:"column:admin_id"`
  94. AdminName string `gorm:"column:admin_name"`
  95. EmailState int8 `gorm:"column:email_state"`
  96. Ctime time.Time `gorm:"column:ctime"`
  97. Mtime time.Time `gorm:"column:mtime"`
  98. }
  99. //TableName .
  100. func (s *SignUp) TableName() string {
  101. return TableNameSignUp
  102. }
  103. //SignPay struct
  104. type SignPay struct {
  105. ID uint32 `gorm:"column:id"`
  106. Mid int64 `gorm:"column:mid"`
  107. SignID uint32 `gorm:"column:sign_id"`
  108. DueDate time.Time `gorm:"column:due_date"`
  109. PayValue int64 `gorm:"column:pay_value"`
  110. State int8 `gorm:"column:state"`
  111. Note string `gorm:"column:note"`
  112. EmailState int8 `gorm:"column:email_state"`
  113. Ctime time.Time `gorm:"column:ctime"`
  114. Mtime time.Time `gorm:"column:mtime"`
  115. }
  116. //TableName .
  117. func (s *SignPay) TableName() string {
  118. return TableNameSignPay
  119. }
  120. //SignTaskState sign task's state
  121. type SignTaskState int8
  122. const (
  123. //SignTaskStateInit init
  124. SignTaskStateInit SignTaskState = 0
  125. //SignTaskStateRunning task running
  126. SignTaskStateRunning SignTaskState = 1
  127. //SignTaskStateFinish finish
  128. SignTaskStateFinish SignTaskState = 2
  129. //SignTaskStateDelete delete
  130. SignTaskStateDelete SignTaskState = 100
  131. )
  132. const (
  133. // SignTaskAttrBitBusiness 商单标记
  134. SignTaskAttrBitBusiness = 0
  135. )
  136. //SignTask struct
  137. type SignTask struct {
  138. ID uint32 `gorm:"column:id"`
  139. Mid int64 `gorm:"column:mid"`
  140. SignID uint32 `gorm:"column:sign_id"`
  141. TaskType int8 `gorm:"column:task_type"`
  142. TaskCounter int32 `gorm:"column:task_counter"`
  143. TaskCondition int32 `gorm:"column:task_condition"`
  144. TaskData string `gorm:"column:task_data"`
  145. Attribute int64 `gorm:"column:attribute"`
  146. GenerateDate time.Time `gorm:"column:generate_date"`
  147. State SignTaskState `gorm:"column:state"`
  148. Ctime time.Time `gorm:"column:ctime"`
  149. Mtime time.Time `gorm:"column:mtime"`
  150. }
  151. //IsAttrSet is attribute set, see SignTaskAttrBitXXX above
  152. func (s *SignTask) IsAttrSet(bit int) bool {
  153. return util.IsBitSet64(s.Attribute, uint(bit))
  154. }
  155. //TableName .
  156. func (s *SignTask) TableName() string {
  157. return TableNameSignTask
  158. }
  159. //SignContract struct
  160. type SignContract struct {
  161. ID uint32 `gorm:"column:id"`
  162. Mid int64 `gorm:"column:mid"`
  163. SignID uint32 `gorm:"column:sign_id"`
  164. Filename string `gorm:"column:filename"`
  165. Filelink string `gorm:"column:filelink"`
  166. State int8 `gorm:"column:state"`
  167. Ctime time.Time `gorm:"column:ctime"`
  168. Mtime time.Time `gorm:"column:mtime"`
  169. }
  170. //TableName .
  171. func (s *SignContract) TableName() string {
  172. return TableNameSignContract
  173. }
  174. //SignTaskHistory struct
  175. type SignTaskHistory struct {
  176. ID uint32 `gorm:"column:id"`
  177. Mid int64 `gorm:"column:mid"`
  178. SignID uint32 `gorm:"column:sign_id"`
  179. TaskTemplateID uint32 `gorm:"column:task_template_id"`
  180. TaskType int8 `gorm:"column:task_type"`
  181. TaskCounter int32 `gorm:"column:task_counter"`
  182. TaskCondition int32 `gorm:"column:task_condition"`
  183. TaskData string `gorm:"column:task_data"`
  184. Attribute int64 `gorm:"column:attribute"`
  185. GenerateDate time.Time `gorm:"column:generate_date"`
  186. State SignTaskState `gorm:"column:state"`
  187. Ctime time.Time `gorm:"column:ctime"`
  188. Mtime time.Time `gorm:"column:mtime"`
  189. }
  190. //TableName .
  191. func (s *SignTaskHistory) TableName() string {
  192. return TableNameSignTaskHistory
  193. }
  194. //SignTaskAbsenceState .
  195. type SignTaskAbsenceState int8
  196. const (
  197. //SignTaskAbsenceStateInit initial
  198. SignTaskAbsenceStateInit SignTaskAbsenceState = 0
  199. //SignTaskAbsenceStateDelete deleted
  200. SignTaskAbsenceStateDelete SignTaskAbsenceState = 100
  201. )
  202. //SignTaskAbsence table
  203. type SignTaskAbsence struct {
  204. ID uint32 `gorm:"column:id" json:"id"`
  205. SignId uint32 `gorm:"column:sign_id" json:"sign_id"`
  206. Mid int64 `gorm:"column:mid" json:"mid"`
  207. TaskHistoryId uint32 `gorm:"column:task_history_id" json:"task_history_id"`
  208. AbsenceCount uint32 `gorm:"column:absence_count" json:"absence_count"`
  209. Reason string `gorm:"column:reason" json:"reason"`
  210. State int8 `gorm:"column:state" json:"state"`
  211. AdminId int64 `gorm:"column:admin_id" json:"admin_id"`
  212. AdminName string `gorm:"column:admin_name" json:"admin_name"`
  213. Ctime time.Time `gorm:"column:ctime" json:"ctime"`
  214. Mtime time.Time `gorm:"column:mtime" json:"mtime"`
  215. }
  216. //TableName .
  217. func (s *SignTaskAbsence) TableName() string {
  218. return TableNameSignTaskAbsence
  219. }