FeedbackValidate.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\api;
  12. use think\Validate;
  13. class FeedbackValidate extends Validate
  14. {
  15. protected $failException = true;
  16. protected $rule = [
  17. 'type|类型' => 'require',
  18. 'content|详情' => 'require|>:10',
  19. 'images|图片' => 'array|max:6',
  20. 'realname|姓名' => 'require|>:1',
  21. 'contact|联系方式' => 'require|checkContact'
  22. ];
  23. protected function checkContact($val)
  24. {
  25. if ($this->regex($val, 'mobile') || $this->filter($val, 'email'))
  26. return true;
  27. else
  28. return '请输入正确的联系方式';
  29. }
  30. }