PddControllerValidate.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Http\Validate\Pdd;
  3. use App\Http\Validate\BaseValidate;
  4. use Illuminate\Support\Facades\Validator;
  5. class PddControllerValidate extends BaseValidate
  6. {
  7. /**
  8. * 商品列表参数校验
  9. * @param $data
  10. */
  11. public function getGoodsList($data)
  12. {
  13. $validate = Validator::make($data,
  14. [
  15. "page"=>"required|integer|min:1",
  16. ]
  17. );
  18. if($validate->fails()){
  19. //验证错误
  20. $this->setError($validate->errors()->first());
  21. return false;
  22. }
  23. return true;
  24. }
  25. /**
  26. * 商品推广链接参数校验
  27. * @param $data
  28. */
  29. public function getGoodsRecommendUrl($data)
  30. {
  31. $validate = Validator::make($data,
  32. [
  33. "goods_sign"=>"required",
  34. ]
  35. );
  36. if($validate->fails()){
  37. //验证错误
  38. $this->setError($validate->errors()->first());
  39. return false;
  40. }
  41. return true;
  42. }
  43. }