| 123456789101112131415161718192021222324252627282930313233343536 | 
							- <?php
 
- namespace app\common\validate;
 
- use think\Db;
 
- use think\Validate;
 
- class OrderAutoSendArea extends Validate{
 
-     protected $rule = [
 
-         'dep_id|部门'  =>  'require|checkUnique',
 
-         'user_id|维修人员'  =>  'require',
 
-     ];
 
-     protected $message = [
 
-     ];
 
-     protected $scene = [
 
-     ];
 
-     protected function checkUnique($value,$rule,$data=[])
 
-     {
 
-         $info = Db::name('order_auto_send_area')->where('dep_id',$value)
 
-             ->where('org_id',$data['org_id'])
 
-             ->find();
 
-         if($data['id'] <= 0 && $info){
 
-             return '当前部门已存在';
 
-         }
 
-         if($info && $data['id'] > 0 && $info['id'] != $data['id']){
 
-             return '当前部门已存在';
 
-         }
 
-         return true;
 
-     }
 
- }
 
 
  |