Orders.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\common\validate;
  3. use think\Db;
  4. use think\Validate;
  5. class Orders extends Validate{
  6. protected $rule = [
  7. 'content|任务内容' => 'checkContent',
  8. 'to_user_id|执行人' => 'require',
  9. ];
  10. protected $message = [
  11. ];
  12. protected $scene = [
  13. 'addShow' => ['content'],
  14. 'dispatchAdd' => ['content'],
  15. 'send' => ['to_user_id'],
  16. ];
  17. protected function checkContent($value,$rule,$data=[])
  18. {
  19. if($data['work_type_mode']!=3){
  20. if(empty($value)){
  21. $images = isset($data['images']) ? $data['images'] : '';
  22. $videos = isset($data['videos']) ? $data['videos'] : '';
  23. $voices = isset($data['voices']) ? $data['voices'] : '';
  24. if(empty($images) && empty($videos) && empty($voices)){
  25. return '内容不能为空';
  26. }else{
  27. return true;
  28. }
  29. }else{
  30. return true;
  31. }
  32. }else{
  33. return true;
  34. }
  35. }
  36. }