企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
```` public function trainer_search_result(Request $request) { //获取参数 $param = $request->param(); // print_r($param);exit; // $test = 0; // if(isset($test)){ // echo 555; // }else{ // echo 666; // }exit; $join_years = isset($param['join_years']) ? $param['join_years'] : ''; $join_status = isset($param['join_status']) ? $param['join_status'] : ''; $trainersex = isset($param['trainersex']) ? $param['trainersex'] : ''; $service_time = isset($param['service_time']) ? $param['service_time'] : ''; $tags_id = isset($param['tags_id']) ? $param['tags_id'] : ''; //筛选条件 $condition = ' 1=1 '; if($join_years == 0){ $condition .= " AND join_years = 0 "; //入行时间 }elseif($join_years == 3){ $condition .= " AND join_years = 3 "; //入行时间 }elseif($join_years == 5){ $condition .= " AND join_years = 5 "; //入行时间 } if($join_status == '') $condition .= " AND join_status = $join_status "; //证书 if($trainersex == '') $condition .= " AND trainersex = $trainersex "; //性别 if($service_time == '') $condition .= " AND service_time = $service_time "; //服务时间 if($tags_id == '') $condition .= " AND tags_id = $tags_id "; //类型 //返回结果 // echo $param['trainersex']; echo $condition;exit; $trainers = Trainer::alias('a') ->join('trainertags b','a.id = b.trainer_id','LEFT') ->where($condition) ->field('*,a.id as id') ->select(); if(empty($trainers)){ $this->success(); }