'require|checkTurn', 'lessee_id' => 'require|gt:0', 'start_time' => 'require|date', ]; protected $message = [ 'house_turn_id.require' => '参数错误', 'lessee_id.require' => '未选择入住人', 'lessee_id.gt' => '未选择入住人', 'start_time.require' => '未选择入住日期', 'start_time.gt' => '未选择入住日期', ]; protected $scene = [ ]; protected function checkTurn($value,$rule,$data=[]) { $info = Db::name('house_turn')->where('id',$data['house_turn_id'])->find(); if(!$info||$info['del'] == 1){ return '参数错误'; } if($info['enable'] == 0){ return '房间被禁用'; } if($info['cur_lessee_id'] > 0){ return '该房间有入住人'; } return true; } }