FeedbackValidate.php 687 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/5/28
  7. *
  8. *
  9. */
  10. namespace app\validate\api;
  11. use think\Validate;
  12. class FeedbackValidate extends Validate
  13. {
  14. protected $failException = true;
  15. protected $rule = [
  16. 'type|类型' => 'require',
  17. 'content|详情' => 'require|>:10',
  18. 'images|图片' => 'array|max:6',
  19. 'realname|姓名' => 'require|>:1',
  20. 'contact|联系方式' => 'require|checkContact'
  21. ];
  22. protected function checkContact($val)
  23. {
  24. if ($this->regex($val, 'mobile') || $this->filter($val, 'email'))
  25. return true;
  26. else
  27. return '请输入正确的联系方式';
  28. }
  29. }