WechatNewsValidate.php 838 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-03-26
  7. *
  8. *
  9. */
  10. namespace app\validate\admin;
  11. use think\Validate;
  12. class WechatNewsValidate extends Validate
  13. {
  14. protected $failException = true;
  15. protected $rule = [
  16. 'data' => 'array|checkArray'
  17. ];
  18. protected function checkArray($value,$rule,$data = [])
  19. {
  20. foreach ($value as $v) {
  21. if(empty($v['title']))
  22. return '标题不能为空';
  23. if(empty($v['author']))
  24. return '作者不能为空';
  25. if(empty($v['synopsis']))
  26. return '摘要不能为空';
  27. if(empty($v['image_input']))
  28. return '图片不能为空';
  29. if(empty($v['content']))
  30. return '内容不能为空';
  31. }
  32. return true;
  33. }
  34. }