model = new Service(); $this->coach_model = new Coach(); } /** * @author chenniang * @DataTime: 2021-03-23 09:20 * @功能说明:地图技师详情 */ public function coachList(){ $input = $this->_param; $shield_coach = $this->coach_model->getShieldCoach($this->getUserId()); if(!empty($input['service_time'])){ //服务中 $working_coach = $this->coach_model->getWorkingCoach($this->_uniacid,$input['service_time']); //当前时间不可预约 $cannot = CoachTimeList::getCannotCoach($this->_uniacid,$input['service_time']); $working_coach = array_merge($working_coach,$cannot); $shield_coach = array_merge($working_coach,$shield_coach); } if(!empty($input['cate_id'])){ $cate_model = new CateConnect(); $service_model = new ServiceCoach(); $id = $cate_model->where(['cate_id'=>$input['cate_id']])->column('service_id'); $coach_id = $service_model->where('ser_id','in',$id)->column('coach_id'); $dis[] = ['id','in',$coach_id]; } $dis[] = ['id','not in',$shield_coach]; $dis[] = ['uniacid','=',$this->_uniacid]; $dis[] = ['status','=',2]; $dis[] = ['auth_status','=',2]; $dis[] = ['is_work','=',1]; // $dis[] = ['user_id','>',0]; if(!empty($input['coach_name'])){ $dis[] = ['coach_name','like','%'.$input['coach_name'].'%']; } if(!empty($input['city_id'])){ $dis[] = ['city_id','=',$input['city_id']]; } if(isset($input['sex'])){ $dis[] = ['sex','=',$input['sex']]; } if(!empty($input['work_time_start'])&&!empty($input['work_time_end'])){ $dis[] = ['work_time','between',"{$input['work_time_start']},{$input['work_time_end']}"]; } $distance = !empty($input['distance'])?$input['distance']:1000000; $lat = !empty($input['lat'])?$input['lat']:0; $lng = !empty($input['lng'])?$input['lng']:0; $alh = 'ACOS(SIN(('.$lat.' * 3.1415) / 180 ) *SIN((lat * 3.1415) / 180 ) +COS(('.$lat.' * 3.1415) / 180 ) * COS((lat * 3.1415) / 180 ) *COS(('.$lng.' * 3.1415) / 180 - (lng * 3.1415) / 180 ) ) * 6378.137*1000 as distance'; $data = $this->coach_model->mapCoachList($dis,$alh,$distance); return $this->success($data); } }