verify.go 1.5 KB

12345678910111213141516171819202122
  1. package utils
  2. var (
  3. IdVerify = Rules{"ID": []string{NotEmpty()}}
  4. ApiVerify = Rules{"Path": {NotEmpty()}, "Description": {NotEmpty()}, "ApiGroup": {NotEmpty()}, "Method": {NotEmpty()}}
  5. MenuVerify = Rules{"Path": {NotEmpty()}, "ParentId": {NotEmpty()}, "Name": {NotEmpty()}, "Component": {NotEmpty()}, "Sort": {Ge("0")}}
  6. MenuMetaVerify = Rules{"Title": {NotEmpty()}}
  7. LoginVerify = Rules{"CaptchaId": {NotEmpty()}, "Username": {NotEmpty()}, "Password": {NotEmpty()}}
  8. RegisterVerify = Rules{"Username": {NotEmpty()}, "NickName": {NotEmpty()}, "Password": {NotEmpty()}, "AuthorityId": {NotEmpty()}}
  9. PageInfoVerify = Rules{"Page": {NotEmpty()}, "PageSize": {NotEmpty()}}
  10. CustomerVerify = Rules{"CustomerName": {NotEmpty()}, "CustomerPhoneData": {NotEmpty()}}
  11. AutoCodeVerify = Rules{"Abbreviation": {NotEmpty()}, "StructName": {NotEmpty()}, "PackageName": {NotEmpty()}, "Fields": {NotEmpty()}}
  12. AutoPackageVerify = Rules{"PackageName": {NotEmpty()}}
  13. AuthorityVerify = Rules{"AuthorityId": {NotEmpty()}, "AuthorityName": {NotEmpty()}}
  14. AuthorityIdVerify = Rules{"AuthorityId": {NotEmpty()}}
  15. OldAuthorityVerify = Rules{"OldAuthorityId": {NotEmpty()}}
  16. ChangePasswordVerify = Rules{"Password": {NotEmpty()}, "NewPassword": {NotEmpty()}}
  17. SetUserAuthorityVerify = Rules{"AuthorityId": {NotEmpty()}}
  18. //
  19. UserIdVerify = Rules{"uid": {RegexpMatch(`^\d{4}$`)}}
  20. EmailVerify = Rules{"emails": {RegexpMatch(`^(?=.{1,50}$)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$`)}}
  21. )