| 123456789101112131415161718192021222324252627282930313233343536373839 | 
							- <?php
 
- namespace app\common\validate;
 
- use think\Db;
 
- use think\Validate;
 
- class MateCheck extends Validate{
 
-     protected $rule = [
 
-         'goods' => 'checkGoods'
 
-     ];
 
-     protected $message = [
 
-     ];
 
-     protected $scene = [
 
-     ];
 
-     protected function checkGoods($value,$rule,$data=[]){
 
-         if(!isset($data['goods'])||empty($data['goods'])){
 
-             return '未选择物品';
 
-         }
 
-         foreach ($data['goods'] as $k=>$v){
 
-             $info = Db::name('mate_goods')
 
-                 ->where('org_id',$data['org_id'])
 
-                 ->where('id',$v)
 
-                 ->where('enable',1)
 
-                 ->where('del',0)
 
-                 ->find();
 
-             if(!$info){
 
-                 return '选择的物品不存在';
 
-             }
 
-         }
 
-         return true;
 
-     }
 
- }
 
 
  |