params.go 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. package model
  2. import (
  3. "go-common/app/admin/main/member/model/block"
  4. xtime "go-common/library/time"
  5. )
  6. // ArgMid is.
  7. type ArgMid struct {
  8. Mid int64 `form:"mid" validate:"min=1,required"`
  9. }
  10. // ArgMids is.
  11. type ArgMids struct {
  12. Mid []int64 `form:"mid,split" validate:"dive,gt=0"`
  13. Operator string `form:"operator"`
  14. OperatorID int64 `form:"operator_id"`
  15. }
  16. // ArgExpSet is.
  17. type ArgExpSet struct {
  18. Mid int64 `form:"mid" validate:"min=1"`
  19. Exp float64 `form:"exp" validate:"required"`
  20. Reason string `form:"reason" validate:"required"`
  21. Operator string `form:"operator"`
  22. OperatorID int64 `form:"operator_id"`
  23. IP string `form:"ip"`
  24. }
  25. // ArgMoralSet is.
  26. type ArgMoralSet struct {
  27. Mid int64 `form:"mid" validate:"min=1"`
  28. Moral float64 `form:"moral" validate:"required"`
  29. Reason string `form:"reason" validate:"required"`
  30. Operator string `form:"operator"`
  31. OperatorID int64 `form:"operator_id"`
  32. IP string `form:"ip"`
  33. }
  34. // ArgRankSet is.
  35. type ArgRankSet struct {
  36. Mid int64 `form:"mid" validate:"min=1"`
  37. Rank int64 `form:"rank" validate:"required"`
  38. Reason string `form:"reason" validate:"required"`
  39. Operator string `form:"operator"`
  40. OperatorID int64 `form:"operator_id"`
  41. IP string `form:"ip"`
  42. }
  43. // ArgCoinSet is.
  44. type ArgCoinSet struct {
  45. Mid int64 `form:"mid" validate:"min=1"`
  46. Coins float64 `form:"coins" validate:"required"`
  47. Reason string `form:"reason" validate:"required"`
  48. Operator string `form:"operator"`
  49. OperatorID int64 `form:"operator_id"`
  50. IP string `form:"ip"`
  51. }
  52. // ArgAdditRemarkSet is.
  53. type ArgAdditRemarkSet struct {
  54. Mid int64 `form:"mid" validate:"min=1"`
  55. Remark string `form:"remark"`
  56. }
  57. // ArgBaseReview is.
  58. type ArgBaseReview struct {
  59. Mid []int64 `form:"mid,split"`
  60. StartMid int64 `form:"start_mid" validate:"min=0"`
  61. EndMid int64 `form:"end_mid" validate:"min=0"`
  62. }
  63. // Mids mid list.
  64. func (amr *ArgBaseReview) Mids() []int64 {
  65. mids := amr.Mid
  66. for i := amr.StartMid; i <= amr.EndMid; i++ {
  67. mids = append(mids, i)
  68. }
  69. return mids
  70. }
  71. // ArgList is.
  72. type ArgList struct {
  73. Mid int64 `form:"mid"`
  74. Keyword string `form:"keyword"`
  75. PN int64 `form:"pn"`
  76. PS int64 `form:"ps"`
  77. }
  78. // ArgOfficial is.
  79. type ArgOfficial struct {
  80. Mid int64 `form:"mid"`
  81. Role []int64 `form:"role,split"`
  82. STime xtime.Time `form:"stime"`
  83. ETime xtime.Time `form:"etime"`
  84. Pn int `form:"pn"`
  85. Ps int `form:"ps"`
  86. }
  87. // ArgOfficialDoc is.
  88. type ArgOfficialDoc struct {
  89. Mid int64 `form:"mid"`
  90. Role []int64 `form:"role,split"`
  91. State []int64 `form:"state,split"`
  92. STime xtime.Time `form:"stime"`
  93. ETime xtime.Time `form:"etime"`
  94. Uname string `form:"uname"`
  95. Pn int `form:"pn"`
  96. Ps int `form:"ps"`
  97. }
  98. // ArgOfficialAudit is.
  99. type ArgOfficialAudit struct {
  100. Mid int64 `form:"mid" validate:"min=1"`
  101. State int8 `form:"state" validate:"min=1"`
  102. UID int64 `form:"uid" validate:"min=1"`
  103. Uname string `form:"uname" validate:"min=1"`
  104. Reason string `form:"reason"`
  105. Source string `form:"source"`
  106. IsInternal bool `form:"is_internal"`
  107. }
  108. // ArgOfficialEdit is.
  109. type ArgOfficialEdit struct {
  110. Mid int64 `form:"mid" validate:"min=1,required"`
  111. Role int8 `form:"role" validate:"min=0"`
  112. Name string `form:"name" validate:"gt=1,required"`
  113. Title string `form:"title" validate:"gt=1,required"`
  114. Desc string `form:"desc"`
  115. // extra
  116. Telephone string `form:"telephone"`
  117. Email string `form:"email"`
  118. Address string `form:"address"`
  119. Supplement string `form:"supplement"`
  120. Company string `form:"company"`
  121. Operator string `form:"operator"`
  122. CreditCode string `form:"credit_code"`
  123. Organization string `form:"organization"`
  124. OrganizationType string `form:"organization_type"`
  125. BusinessLicense string `form:"business_license"`
  126. BusinessScale string `form:"business_scale"`
  127. BusinessLevel string `form:"business_level"`
  128. BusinessAuth string `form:"business_auth"`
  129. OfficalSite string `form:"official_site"`
  130. RegisteredCapital string `form:"registered_capital"`
  131. SendMessage bool `form:"send_msg"`
  132. MessageTitle string `form:"msg_title"`
  133. MessageContent string `form:"msg_content"`
  134. UID int64 `form:"uid" validate:"min=1"`
  135. Uname string `form:"uname" validate:"min=1"`
  136. IsInternal bool `form:"is_internal"`
  137. }
  138. // ArgOfficialSubmit arg submit official doc
  139. type ArgOfficialSubmit struct {
  140. Mid int64 `form:"mid"`
  141. Name string `form:"name"`
  142. Role int8 `form:"role"`
  143. Title string `form:"title"`
  144. Desc string `form:"desc"`
  145. // extra
  146. Realname int8 `form:"realname"`
  147. Operator string `form:"operator"`
  148. Telephone string `form:"telephone"`
  149. Email string `form:"email"`
  150. Address string `form:"address"`
  151. Company string `form:"company"`
  152. CreditCode string `form:"credit_code"` // 社会信用代码
  153. Organization string `form:"organization"` // 政府或组织名称
  154. OrganizationType string `form:"organization_type"` // 组织或机构类型
  155. BusinessLicense string `form:"business_license"` // 企业营业执照
  156. BusinessScale string `form:"business_scale"` // 企业规模
  157. BusinessLevel string `form:"business_level"` // 企业登记
  158. BusinessAuth string `form:"business_auth"` // 企业授权函
  159. Supplement string `form:"supplement"` // 其他补充材料
  160. Professional string `form:"professional"` // 专业资质
  161. Identification string `form:"identification"` // 身份证明
  162. OfficalSite string `form:"official_site"`
  163. RegisteredCapital string `form:"registered_capital"`
  164. UID int64 `form:"uid"`
  165. Uname string `form:"uname"`
  166. IsInternal bool `form:"is_internal"`
  167. SubmitSource string `form:"submit_source"`
  168. }
  169. // ArgFaceHistory is.
  170. type ArgFaceHistory struct {
  171. Mid int64 `form:"mid"`
  172. Operator string `form:"operator"`
  173. Status []int8 `form:"status,split"`
  174. STime xtime.Time `form:"stime" validate:"min=0"`
  175. ETime xtime.Time `form:"etime" validate:"min=0"`
  176. PS int `form:"ps" validate:"min=0,max=50"`
  177. PN int `form:"pn" validate:"min=0"`
  178. }
  179. // ArgMonitor is.
  180. type ArgMonitor struct {
  181. Mid int64 `form:"mid"`
  182. Pn int `form:"pn"`
  183. Ps int `form:"ps"`
  184. }
  185. // ArgAddMonitor is.
  186. type ArgAddMonitor struct {
  187. Mid int64 `form:"mid" validate:"min=1,required"`
  188. Operator string `form:"operator"`
  189. OperatorID int64 `form:"operator_id"`
  190. Remark string `form:"remark"`
  191. }
  192. // ArgDelMonitor is.
  193. type ArgDelMonitor struct {
  194. Mid int64 `form:"mid" validate:"min=1,required"`
  195. Operator string `form:"operator"`
  196. OperatorID int64 `form:"operator_id"`
  197. Remark string `form:"remark"`
  198. }
  199. // ArgReviewList is.
  200. type ArgReviewList struct {
  201. Mid int64 `form:"mid"`
  202. Property []int8 `form:"property,split"`
  203. Operator string `form:"operator"`
  204. State []int8 `form:"state,split"`
  205. IsDesc bool `form:"is_desc"`
  206. IsMonitor bool `form:"is_monitor"`
  207. ForceDB bool `form:"force_db"`
  208. STime xtime.Time `form:"stime" validate:"min=0"`
  209. ETime xtime.Time `form:"etime" validate:"min=0"`
  210. Ps int `form:"ps" validate:"min=0,max=50"`
  211. Pn int `form:"pn" validate:"min=0"`
  212. }
  213. // ArgReviewAudit is.
  214. type ArgReviewAudit struct {
  215. ID []int64 `form:"id,split" validate:"dive,gt=0"`
  216. State int8 `form:"state" validate:"min=1"`
  217. Operator string `form:"operator"`
  218. OperatorID int64 `form:"operator_id"`
  219. Remark string `form:"remark"`
  220. BlockUser bool `form:"block_user"`
  221. //for block
  222. ArgBatchBlock
  223. }
  224. // ArgBatchBlock .
  225. type ArgBatchBlock struct {
  226. Source block.BlockMgrSource `form:"block_source"`
  227. Area block.BlockArea `form:"block_area"`
  228. Reason string `form:"block_reason"`
  229. Comment string `form:"block_comment"`
  230. Action block.BlockAction `form:"block_action"`
  231. Duration int64 `form:"block_duration"` // 单位:天
  232. Notify bool `form:"block_notify"`
  233. }
  234. // Validate .
  235. func (p *ArgBatchBlock) Validate() bool {
  236. // p.MIDs = intsSet(p.MIDs)
  237. // if len(p.MIDs) == 0 || len(p.MIDs) > 200 {
  238. // return false
  239. // }
  240. // if p.AdminID <= 0 {
  241. // return false
  242. // }
  243. // if p.AdminName == "" {
  244. // return false
  245. // }
  246. if p.Source != block.BlockMgrSourceSys && p.Source != block.BlockMgrSourceCredit {
  247. return false
  248. }
  249. if !p.Area.Contain() {
  250. return false
  251. }
  252. if p.Comment == "" {
  253. return false
  254. }
  255. if p.Action != block.BlockActionForever && p.Action != block.BlockActionLimit {
  256. return false
  257. }
  258. if p.Action == block.BlockActionLimit {
  259. if p.Duration <= 0 {
  260. return false
  261. }
  262. }
  263. return true
  264. }
  265. // ArgReview is.
  266. type ArgReview struct {
  267. ID int64 `form:"id" validate:"min=1"`
  268. }
  269. // ArgPubExpMsg is.
  270. type ArgPubExpMsg struct {
  271. Event string `form:"event" validate:"min=1,required"`
  272. Mid int64 `form:"mid" validate:"min=1,required"`
  273. IP string `form:"ip"`
  274. Ts int64 `form:"ts"`
  275. }
  276. // Mode is.
  277. func (a *ArgFaceHistory) Mode() string {
  278. if a.Mid > 0 && a.Operator != "" {
  279. return "op"
  280. }
  281. if a.Mid > 0 {
  282. return "mid"
  283. }
  284. return "op"
  285. }
  286. // ArgBatchFormal is
  287. type ArgBatchFormal struct {
  288. FileData []byte
  289. Operator string `form:"operator"`
  290. OperatorID int64 `form:"operator_id"`
  291. }
  292. // ArgRealnameSubmit is
  293. type ArgRealnameSubmit struct {
  294. Mid int64 `form:"mid" validate:"required"`
  295. Realname string `form:"realname" validate:"required"`
  296. CardType int8 `form:"card_type"`
  297. CardNum string `form:"card_num" validate:"required"`
  298. Country int16 `form:"country"`
  299. FrontImageToken string `form:"front_image_token" validate:"required"`
  300. BackImageToken string `form:"back_image_token" validate:"required"`
  301. HandImageToken string `form:"hand_image_token"`
  302. Operator string `form:"operator" validate:"required"`
  303. OperatorID int64 `form:"operator_id" validate:"required"`
  304. Remark string `form:"remark" validate:"required"`
  305. }