123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\common\validate;
- use think\Db;
- use think\Validate;
- class Orders extends Validate{
- protected $rule = [
- 'content|任务内容' => 'checkContent',
- 'to_user_id|执行人' => 'require',
- ];
- protected $message = [
- ];
- protected $scene = [
- 'addShow' => ['content'],
- 'dispatchAdd' => ['content'],
- 'send' => ['to_user_id'],
- ];
- protected function checkContent($value,$rule,$data=[])
- {
- if($data['work_type_mode']!=3){
- if(empty($value)){
- $images = isset($data['images']) ? $data['images'] : '';
- $videos = isset($data['videos']) ? $data['videos'] : '';
- $voices = isset($data['voices']) ? $data['voices'] : '';
- if(empty($images) && empty($videos) && empty($voices)){
- return '内容不能为空';
- }else{
- return true;
- }
- }else{
- return true;
- }
- }else{
- return true;
- }
- }
- }
|