public function resume() { $auth = new auth(); if (!$auth->is_logged_in()) { $this->error(L('please_login'), 'auth/index'); } if (!$auth->check_uri_permissions()) { $this->error($auth->error); } $db = M('model_field'); $filterCond = array(); //处理选项搜索字段 $switch_field = $db->field('title,field_name')->where('field_type="switch" and join_index=1 and dmid=6')->findall(); $model_struct = (include PATH_ROOT . '/caches/model/field/m_resume_basic.php'); foreach ($switch_field as $value) { $filterCond['switchs'][$value['field_name']] = $model_struct[$value['field_name']]['data']; } //处理选项联动搜索字段 $linkage_filed = $db->field('title,field_name,lcgid')->where('field_type="linkage" and join_index=1 and dmid=6')->findall(); foreach ($linkage_filed as $value) { $data = $db->table('linkage')->cache(86400)->field('laid,title')->where('lcgid=' . $value['lcgid'])->findall(); $filterCond['linkages'][$value['field_name']] = array('title' => $value['title'], 'data' => $data); } //处理选项地区搜索字段 $filterCond['address'] = $db->table('city')->cache(86400)->field('id,name,direct')->where('pid=0')->findall(); //地区 if (isset($_GET['address'])) { $filterCond['sonAddress'] = $db->table('city')->cache(86400)->field('id,name')->where('pid=' . $_GET['address'])->findall(); //地区子类 } $where = array('open' => 1, 'verify' => 1); //resume表的条件:公开已验证 if (isset($_GET['address'])) { //地址 $where[] = 'hope_provice=' . intval($_GET['address']); } if (isset($_GET['city'])) { //地址 $where[] = 'hope_city=' . intval($_GET['city']); } if (isset($_GET['work_exp'])) { //工作经验 $where[] = 'work_exp=' . intval($_GET['work_exp']); } if (isset($_GET['updated'])) { //更新时间 $where['updated'] = 'updated >' . strtotime('-' . $_GET['updated'] . 'days'); } $keywords = array(); if (!empty($_GET['keywords'])) { //关键字 $_GET['keywords'] = strip_tags($_GET['keywords']); $keywords = array_keys(string::split_word($_GET['keywords'])); $keyword_cond = ''; foreach ($keywords as $value) { $keyword_cond .= 'resume_name LIKE "%' . $value . '%" OR '; } $keyword_cond = rtrim($keyword_cond, 'OR '); $where[] = $keyword_cond; } $db = V('resume'); $db->view = array('resume_basic' => array('type' => 'INNER', 'on' => 'resume.resume_id=resume_basic.resume_id')); $nums = $db->where($where)->count(); $page = new page($nums, 10); $resumes = $db->where($where)->findall($page->limit()); if ($resumes) { $data_class = new data('resume_basic'); foreach ($resumes as $key => $value) { $resumes[$key] = $data_class->convert($value); } } $this->assign('resumes', $resumes); $this->assign('filterCond', $filterCond); $this->assign('page', $page->show()); $this->display('search-resume'); }