realname.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. package model
  2. import (
  3. "time"
  4. )
  5. // RealnameStatus is.
  6. type RealnameStatus int8
  7. const (
  8. // RealnameStatusFalse is.
  9. RealnameStatusFalse RealnameStatus = 0
  10. // RealnameStatusTrue is.
  11. RealnameStatusTrue RealnameStatus = 1
  12. )
  13. // RealnameApplyStatus is.
  14. type RealnameApplyStatus int8
  15. const (
  16. // RealnameApplyStatusPending is.
  17. RealnameApplyStatusPending RealnameApplyStatus = iota
  18. // RealnameApplyStatusPass is.
  19. RealnameApplyStatusPass
  20. // RealnameApplyStatusBack is.
  21. RealnameApplyStatusBack
  22. // RealnameApplyStatusNone is.
  23. RealnameApplyStatusNone
  24. )
  25. // IsPass return is apply passed
  26. func (r RealnameApplyStatus) IsPass() bool {
  27. switch r {
  28. case RealnameApplyStatusPass:
  29. return true
  30. default:
  31. return false
  32. }
  33. }
  34. // RealnameChannel is
  35. type RealnameChannel int8
  36. // RealnameChannel enum
  37. const (
  38. RealnameChannelMain RealnameChannel = iota
  39. RealnameChannelAlipay
  40. )
  41. // RealnameApplyStatusInfo is.
  42. type RealnameApplyStatusInfo struct {
  43. Status RealnameApplyStatus `json:"status"`
  44. Remark string `json:"remark"`
  45. Realname string `json:"realname"`
  46. Card string `json:"card"`
  47. }
  48. // RealnameCacheInfo model in cache
  49. type RealnameCacheInfo struct {
  50. *RealnameInfo
  51. RealCard string `json:"real_card"`
  52. }
  53. // RealnameBrief is.
  54. type RealnameBrief struct {
  55. Realname string `json:"realname"`
  56. Card string `json:"card"`
  57. CardType int `json:"card_type"`
  58. Status RealnameStatus `json:"status"`
  59. }
  60. // RealnameInfo is.
  61. type RealnameInfo struct {
  62. ID int64 `json:"id"`
  63. MID int64 `json:"mid"`
  64. Channel RealnameChannel `json:"channel"`
  65. Realname string `json:"realname"`
  66. Country int `json:"country"`
  67. CardType int `json:"card_type"`
  68. Card string `json:"card"`
  69. CardMD5 string `json:"card_md5"`
  70. Status RealnameApplyStatus `json:"status"`
  71. Reason string `json:"reason"`
  72. CTime time.Time `json:"ctime"`
  73. MTime time.Time `json:"mtime"`
  74. }
  75. // RealnameDetail is.
  76. type RealnameDetail struct {
  77. *RealnameBrief
  78. Gender string `json:"gender"`
  79. HandIMG string `json:"hand_img"`
  80. }
  81. // RealnameApply is.
  82. type RealnameApply struct {
  83. ID int64 `json:"id"`
  84. MID int64 `json:"mid"`
  85. Realname string `json:"realname"`
  86. Country int16 `json:"country"`
  87. CardType int8 `json:"card_type"`
  88. CardNum string `json:"card_num"`
  89. CardMD5 string `json:"card_md5"`
  90. HandIMG int `json:"hand_img"`
  91. FrontIMG int `json:"front_img"`
  92. BackIMG int `json:"back_img"`
  93. Status RealnameApplyStatus `json:"status"`
  94. Operator string `json:"operator"`
  95. OperatorID int64 `json:"operator_id"`
  96. OperatorTime time.Time `json:"operator_time"`
  97. Remark string `json:"remark"`
  98. RemarkStatus int8 `json:"remark_status"`
  99. CTime time.Time `json:"ctime"`
  100. MTime time.Time `json:"mtime"`
  101. }
  102. // IsPass is.
  103. func (r *RealnameApply) IsPass() bool {
  104. switch r.Status {
  105. case RealnameApplyStatusPass:
  106. return true
  107. default:
  108. return false
  109. }
  110. }
  111. // RealnameApplyImage is.
  112. type RealnameApplyImage struct {
  113. ID int64
  114. IMGData string
  115. CTime time.Time
  116. MTime time.Time
  117. }
  118. // RealnameCapture is.
  119. type RealnameCapture struct {
  120. Code int
  121. CodeCTime time.Time
  122. Times []time.Time
  123. }
  124. // RealnameAlipayApply is
  125. type RealnameAlipayApply struct {
  126. ID int64 `json:"id"`
  127. MID int64 `json:"mid"`
  128. Realname string `json:"realname"`
  129. Card string `json:"card"`
  130. IMG string `json:"img"`
  131. Status RealnameApplyStatus `json:"status"`
  132. Reason string `json:"reason"`
  133. Bizno string `json:"bizno"`
  134. CTime time.Time `json:"ctime"`
  135. MTime time.Time `json:"mtime"`
  136. }
  137. // IsPass is.
  138. func (r *RealnameAlipayApply) IsPass() bool {
  139. switch r.Status {
  140. case RealnameApplyStatusPass:
  141. return true
  142. default:
  143. return false
  144. }
  145. }
  146. // RealnameAlipayInfo is
  147. type RealnameAlipayInfo struct {
  148. Bizno string
  149. }
  150. const (
  151. // RealnameCountryChina is.
  152. RealnameCountryChina = 0
  153. // RealnameCardTypeIdentity is.
  154. RealnameCardTypeIdentity = 0
  155. )
  156. // RealnameAdultType is.
  157. type RealnameAdultType uint8
  158. const (
  159. // RealnameAdultTypeFalse is.
  160. RealnameAdultTypeFalse RealnameAdultType = iota // 未成年
  161. // RealnameAdultTypeTrue is.
  162. RealnameAdultTypeTrue // 已成年
  163. //RealnameAdultTypeUnknown is.
  164. RealnameAdultTypeUnknown // 未知(未绑定身份证)
  165. )
  166. // http param
  167. // ParamRealnameCheck is.
  168. type ParamRealnameCheck struct {
  169. MID int64 `form:"mid" validate:"required"`
  170. CardType int8 `form:"card_type" default:"-1"`
  171. CardCode string `form:"card_code" validate:"required"`
  172. }
  173. // ParamRealnameSyncImage is.
  174. type ParamRealnameSyncImage struct {
  175. Data string `form:"data" validate:"required"`
  176. }
  177. // ParamRealnameTelCaptureCheck is.
  178. type ParamRealnameTelCaptureCheck struct {
  179. MID int64 `form:"mid" validate:"required"`
  180. Capture int `form:"capture" validate:"required"`
  181. }