findAll("parent_id=1"); if(!$page) $page=1; $where = array(); $condition=array(); if($schoolName){ $where[]= " school_name like '%".$schoolName."%' "; $condition['school_name']=$schoolName; }else{ if ($provinceId) { $where[]= " province_id='{$provinceId}'"; $condition['province_id']=$provinceId; } if ($cityId) { $where[]= " city_id='{$cityId}'"; $condition['city_id']=$cityId; } if ($areaId) { $where[]= " area_id='{$areaId}'"; $condition['area_id']=$areaId; } } //读取学校开关 $setting=AssistSetting::model()->getAssistSetting(); if($setting){ $acceptSchoolOpen=$setting['accept_school_open']; }else{ $acceptSchoolOpen=0; } $schoolIds=array(); if($where){ $schoolIds=BusinessSchool::model()->getSchoolIdByCondition($where); if(!$schoolIds){ $data=array( 'pages' => array(), 'dataList' => array(), 'province'=>$provinceList, 'acceptSchoolOpen'=>$acceptSchoolOpen, 'condition' =>$condition, ); // debug($data); return $this->render('list', $data); } } $AList=new AWhiteList(); // 任务列表 $totalCount = $AList->countSchool($schoolIds); $pageLimit=10; $pages['page']=$page; $pages['totalPage']=ceil($totalCount/$pageLimit); $pages['total']=$totalCount; //$pages = new Pagination(['totalCount' => $totalCount, 'pageSize' => 10]); //$dataList=ATask::model()->find(implode(' and ',$where),$param)->offset($pages->offset)->limit($pages->limit)->asArray()->all(); $dataList=$AList->getList($schoolIds,$page,$pageLimit); if($dataList){ foreach ($dataList as $key => $val){ //读取省市区 $schoolInfo=BusinessSchool::model()->find('school_id=:sid',array(':sid'=>$val['school_id'])); if($schoolInfo){ $province=BusinessRegion::model()->findByPk($schoolInfo->province_id); $city=BusinessRegion::model()->findByPk($schoolInfo->city_id); $area=BusinessRegion::model()->findByPk($schoolInfo->area_id); if(isset($province->region_name)){ $dataList[$key]['province']=$province->region_name; }else{ $dataList[$key]['province']=''; } if(isset($city->region_name)){ $dataList[$key]['city']=$city->region_name; }else{ $dataList[$key]['city']=''; } if(isset($area->region_name)){ $dataList[$key]['area']=$area->region_name; }else{ $dataList[$key]['area']=''; } } //读取学管 $coachInfo=BusinessCoach::model()->find("school_id=:sid",array(':sid'=>$val['school_id'])); if($coachInfo){ $dataList[$key]['coach']=$coachInfo->real_name.'-'.$coachInfo->telephone; }else{ $dataList[$key]['coach']='-'; } } } $data=array( 'pages' => $pages, 'dataList' => $dataList, 'province'=>$provinceList, 'acceptSchoolOpen'=>$acceptSchoolOpen, 'condition' =>$condition, ); return $this->render('list', $data); } public function actionSearchSchool(){ $provinceId = (int)Req::post('province_id'); $cityId = (int)Req::post('city_id'); $areaId = (int)Req::post('area_id'); $schoolName = Req::post('school_name'); $page = (int)Req::post('page'); if(!$page) $page=1; $where = array(); if ($schoolName) { $where[]= " school_name like '%".$schoolName."%' "; }else{ if ($provinceId) { $where[]= " province_id='{$provinceId}'"; } if ($cityId) { $where[]= " city_id='{$cityId}'"; } if ($areaId) { $where[]= " area_id='{$areaId}'"; } } $whiteList=new AWhiteList(); $schoolIds=$whiteList->getAllSchoolIds(); // if($schoolIds){ // $where[]= " school_id not in(".implode(',',$schoolIds).")"; // } $where[]="client<>2 and status=0 "; $AList=new BusinessSchool(); // 学校列表 $totalCount = $AList->countSchool($where); $pageLimit=6; $pages['page']=$page; $pages['totalPage']=ceil($totalCount/$pageLimit); $pages['total']=$totalCount; $dataList=$AList->getList($where,$page,$pageLimit); $html=''; if($dataList){ $i=($page-1)*6+1; foreach ($dataList as $key => $val){ $province=BusinessRegion::model()->findByPk($val['province_id']); $city=BusinessRegion::model()->findByPk($val['city_id']); $area=BusinessRegion::model()->findByPk($val['area_id']); $html.='