Example #1
0
 /**
  * 高校详情
  */
 public function indexAction($col_id)
 {
     //判断是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['col_id'] = $col_id;
         $data['name'] = $validate->getPost('name');
         $data['content'] = $validate->getPost('content', \Validate::length(255, 0), ['slashes' => true, 'html' => true]);
         $data['phone'] = $validate->getPost('phone');
         if ($validate->getMessage()) {
             $this->end(404);
         }
         $this->end((new \College())->SignUp($data));
     }
     //页面缓存时间
     $cacheTime = 3600;
     $html_name = $col_id . '.html';
     //检查是否使用缓存页面
     //$this->staticHtml($html_name, $cacheTime);
     $model = new \College();
     //获取大学信息
     $college = $model->getCollegeDetail($col_id);
     if (!$college) {
         $this->notFound();
     }
     $model->addClick($col_id, rand(5, 12));
     //获取学校属性
     $attribute = $model->getAttribute($col_id);
     //获取学校热门专业
     $major = $model->getHotMajor($col_id, 10);
     //获取推荐学校
     $command = $model->getCommand($college['col_type'], 4);
     //获取学校动态
     $news = $model->getColNews($col_id);
     //获取知名校友
     $alumnus = $model->getColAlumnus($col_id);
     $praise = $model->getColPraise($col_id, 5);
     foreach ($praise['list'] as $key => $val) {
         $praise['list'][$key]['col_rev_ip'] = $this->ipGetCity($val['col_rev_ip']) == 404 ? "未知网友" : $this->ipGetCity($val['col_rev_ip']);
     }
     //设置标题
     $this->tag->setTitle($college['col_name'] . "-51升学网");
     $web_desc = strip_tags($college['col_summary']);
     //引入css 和js
     $this->assets->addCss("fontend/css/org2/university/index.css");
     $this->assets->addJs("fontend/js/org2_index.js");
     $this->view->setVars(['college' => $college, 'attribute' => $attribute, 'major' => $major, 'command' => $command, 'web_desc' => $web_desc, 'news' => $news, 'alumnus' => $alumnus, 'praise' => $praise]);
 }
Example #2
0
 public function schoolAction($id, $page)
 {
     $data['action'] = "school";
     $data['id'] = (int) $id;
     $data['type'] = $this->request->getQuery('type') ? $this->request->getQuery('type') : 1;
     $data['id'] = $this->request->getQuery('id') ? $this->request->getQuery('id') : 0;
     $page = (int) $page < 1 ? 1 : $page;
     $detail = (new \Major())->getDetail($id);
     $list = (new \Major())->getList($detail['maj_type']);
     foreach ($list as &$val1) {
         $val1['url'] = "/major/list?type=" . $data['type'] . "&id=" . $val1['maj_par_par_id'];
     }
     $web_key = "51升学网-" . $detail['maj_name'];
     $web_desc = strip_tags($detail['maj_explain']);
     $this->tag->setTitle($detail['maj_name'] . "-51升学网");
     $school = (new \Major())->getSchool($id, $page);
     $page_html = $this->pageHtml($school['page']);
     $attribute = new \College();
     foreach ($school['list'] as &$val) {
         $val['attribute'] = $attribute->getAttribute($val['col_id']);
         $val['test'] = "/college/test_" . $val['col_id'] . ".html";
         $val['url'] = "/college/detail_" . $val['col_id'] . ".html";
     }
     $this->view->setLayout("major");
     //引入js 和css
     $this->assets->addCss("fontend/css/major/detail-schools.css");
     $this->assets->addJs("fontend/js/major_detail_school.js");
     $this->view->setVars(['list' => $list, 'detail' => $detail, 'school' => $school['list'], 'data' => $data, 'page_html' => $page_html, 'page' => $school['page'], 'web_key' => $web_key, 'web_desc' => $web_desc]);
 }