GoodsReviewsValidate.php 767 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\api\validate;
  3. use app\common\validate\BaseValidate;
  4. /**
  5. * GoodsReviews验证器
  6. * Class GoodsReviewsValidate
  7. * @package app\api\validate
  8. */
  9. class GoodsReviewsValidate extends BaseValidate
  10. {
  11. /**
  12. * 设置校验规则
  13. * @var string[]
  14. */
  15. protected $rule = [
  16. 'sn' => 'require',
  17. 'rating' => 'require',
  18. 'comment'=>'require',
  19. ];
  20. /**
  21. * 参数描述
  22. * @var string[]
  23. */
  24. protected $field = [
  25. 'sn' => '参数错误',
  26. 'rating' => '星级',
  27. 'comment' => '评论内容',
  28. ];
  29. /**
  30. * @notes 添加场景
  31. * @return GoodsValidate
  32. */
  33. public function sceneAdd()
  34. {
  35. return $this->only(['sn','rating','comment']);
  36. }
  37. }