RegisterValidate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\validate\register;
  3. use app\api\validate\register\RegisterList;
  4. use app\api\response\ZskkErrorResponse;
  5. use app\api\validate\register\RegisterInfo;
  6. use app\api\validate\register\RegisterId;
  7. use app\api\validate\register\RegisterEditInfo;
  8. class RegisterValidate {
  9. public static function checkList($params) {
  10. # code...
  11. $validate = new RegisterList;
  12. if (!$validate->check($params)) {
  13. $msg = $validate->getError();
  14. ZskkErrorResponse::throwParamsError(2001,$msg);
  15. }
  16. }
  17. public static function checkAddInfo($params) {
  18. # code...
  19. $validate = new RegisterInfo;
  20. if (!$validate->check($params)) {
  21. $msg = $validate->getError();
  22. ZskkErrorResponse::throwParamsError(2001,$msg);
  23. }
  24. }
  25. public static function checkId($params)
  26. {
  27. $validate = new RegisterId;
  28. if (!$validate->check($params)) {
  29. $msg = $validate->getError();
  30. ZskkErrorResponse::throwParamsError(2001,$msg);
  31. }
  32. }
  33. public static function checkEditInfo($params)
  34. {
  35. $validate = new RegisterEditInfo;
  36. if (!$validate->check($params)) {
  37. $msg = $validate->getError();
  38. ZskkErrorResponse::throwParamsError(2001,$msg);
  39. }
  40. }
  41. }