ReportValidate.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace app\api\validate\report;
  3. use app\api\validate\report\Report;
  4. use app\api\validate\report\SaveReport;
  5. use app\api\response\ZskkErrorResponse;
  6. class ReportValidate {
  7. public static function check($params) {
  8. # code...
  9. $validate = new Report;
  10. if (!$validate->check($params)) {
  11. $msg = $validate->getError();
  12. ZskkErrorResponse::throwParamsError(2001,$msg);
  13. }
  14. }
  15. public static function checkSave($params) {
  16. # code...
  17. $validate = new SaveReport;
  18. if (!$validate->check($params)) {
  19. $msg = $validate->getError();
  20. ZskkErrorResponse::throwParamsError(2001,$msg);
  21. }
  22. }
  23. public static function checkConfirm($params)
  24. {
  25. $validate = new ConfirmReport;
  26. if (!$validate->check($params)) {
  27. $msg = $validate->getError();
  28. ZskkErrorResponse::throwParamsError(2001,$msg);
  29. }
  30. }
  31. public static function stageConfirm($params)
  32. {
  33. $validate = new StageReport;
  34. if (!$validate->check($params)) {
  35. $msg = $validate->getError();
  36. ZskkErrorResponse::throwParamsError(2001,$msg);
  37. }
  38. }
  39. public static function checkPrint($params)
  40. {
  41. $validate = new PrintReport;
  42. if (!$validate->check($params)) {
  43. $msg = $validate->getError();
  44. ZskkErrorResponse::throwParamsError(2001,$msg);
  45. }
  46. }
  47. public static function checkVideo($params)
  48. {
  49. $validate = new SaveVideo();
  50. if (!$validate->check($params)) {
  51. $msg = $validate->getError();
  52. ZskkErrorResponse::throwParamsError(2001,$msg);
  53. }
  54. }
  55. }