public function showImage() { $result['image'] = true; $result['topic'] = IndexPageConfig::$TOPIC; $name_id = HttpNamespace::getGET('name'); if ($name_id) { $image = DetailNamespace::getNameById($name_id); if (!$image) { HttpNamespace::redirect(UrlNamespace::categoryUrl(self::$CATEGORY['id'])); } } else { $category = self::$CATEGORY; $category['table'] = 'image'; list($page, $list) = CommonNamespace::showPage($category, self::$MAJORY, 'id', 10); foreach ($list as $key => $value) { $list[$key]['list'] = $this->getHotImage(self::$MAJORY['id'], $value['id'], 4); } $this->assign('title', self::$MAJORY['name']); $this->assign('list', $list); $this->assign('image', true); $this->assign('page', $page); $this->display('majory/list.php'); } $page = HttpNamespace::getGET('p'); list($list, $result['count']) = DBXapian::searchImageByName($name_id, $page, 16); //组合list $result['list'] = array(array('id' => $image['id'], 'majory_id' => self::$MAJORY['id'], 'name' => $image['name'], 'list' => $list)); $result['title'] = self::$MAJORY['name'] . '-' . $image['name']; $result['type_id'] = $this->typeId; $result['page'] = $this->_showPage($result['count']); $this->assign($result); $this->display('majory/list.php'); }
public function defaultAction() { $disease = HttpNamespace::getGET('disease'); $province = HttpNamespace::getGET('province'); $city = HttpNamespace::getGET('city'); $district = HttpNamespace::getGET('district'); $level = HttpNamespace::getGET('level'); $page = HttpNamespace::getGET('page'); $keyword = HttpNamespace::getGET('keyword'); $result = DBXapian::searchHospital($disease, $province, $city, $district, '', $level, $keyword, $page, self::$PAGE_SIZE); echo json_encode($result); exit; }
private static function _connect($db) { if (!self::$_INSTANCE) { if ($db) { self::$_INSTANCE = new XapianDatabase($db); } else { self::$_INSTANCE = new XapianDatabase(DBConfig::$XAPIAN['database']); } if (self::$_INSTANCE) { return true; } else { return false; } } return true; }
public function defaultAction() { $result['image'] = true; $result['top_image'] = IndexPageConfig::$IMAGE_TOP; $this->orgWord = HttpNamespace::getGET('kw'); $this->typeId = HttpNamespace::getGET('type'); $this->params['query'] = $this->orgWord; //搜索作者 if ($this->typeId == 'author') { $this->params['author'] = true; //通过uid搜索作者 } elseif (strtolower($this->typeId) == 'uid') { $user = UserNamespace::getUserById($this->orgWord); if ($user) { $this->params['uid'] = true; $this->params['username'] = $user['nick_name']; $this->orgWord = $this->params['username']; } //搜索日记本通过id } elseif (strtolower($this->typeId) == 'bookid') { $this->params['bookid'] = true; $book = DiaryBookNamespace::getUserById($this->orgWord); if ($book) { $this->params['diarybook'] = $book['book_name']; $this->orgWord = $this->params['diarybook']; } //搜索日记本通过kw } elseif (strtolower($this->typeId) == 'bookname') { $this->params['bookname'] = true; //搜索个关键词 } else { $this->typeId = (int) $this->typeId; $pa = CategoryNamespace::getById($this->typeId); $this->type = $pa['type']; $this->params[$pa['type']] = $pa; } $page = HttpNamespace::getGET('p'); list($result['article'], $result['count'], $this->cutWord) = DBXapian::searchByQuery($this->params, $page, self::$PAGE_SIZE); $result['cutword'] = $this->createUrlByWord($this->cutWord); $result['kw'] = $this->orgWord; $result['title'] = $this->orgWord; $result['type_id'] = $this->typeId; $result['page'] = $this->_showPage($result['count']); $this->assign($result); $this->display(); }
public function defaultAction() { $provinceCacheFile = dirname(__FILE__) . '/include/cityCache.php'; $provinceCache = trim(file_get_contents($provinceCacheFile)); //加载缓存 if ($provinceCache != '') { $provinces = json_decode($provinceCache, true); } else { //组合 $provinces = $this->_getAllProvince(); foreach ($provinces as &$value) { $citys = $this->_getAllCity($value['province_id']); if (count($citys) > 1) { array_unshift($citys, array('city_id' => '', 'short_name' => '全部')); } $value['city'] = $citys; } $cityCache = json_encode($provinces); if (!file_put_contents($provinceCacheFile, $cityCache)) { echo '文件: ' . $provinceCacheFile . ' 不可写'; exit; } } //变量声明 $level = ''; $disease = ''; $keyword = ''; $district = ''; $province = ''; //省 if ($_GET['province']) { $province = $this->_getProvinceById((int) $_GET['province']); } //地区,市 if ($_GET['city']) { $city = $this->_getCityById((int) $_GET['city']); $districts = $this->_getAllDistrict((int) $_GET['city']); //区域 if ($_GET['district']) { $district = $this->_getDistrictById((int) $_GET['district']); } //街道 $street = ''; } //一样级别 if ($_GET['level']) { $level = (int) $_GET['level']; } //疾病id if ($_GET['disease']) { $disease = (int) $_GET['disease']; } //关键词 if ($_GET['keyword']) { $keyword = htmlspecialchars($_GET['keyword']); } //页数 if ($_GET['p']) { $p = htmlspecialchars($_GET['p']); } $result = DBXapian::searchHospital($disease, $province['province_id'], $city['city_id'], $district['district_id'], $street, $level, $keyword, $p, self::$PAGE_SIZE); $hospital = $result[0]; $count = $result[1]; $pa = new Pages($count, self::$PAGE_SIZE); $page = $pa->show(); $this->assign('provinces', $provinces); $this->assign('province', $province); $this->assign('city', $city); $this->assign('districts', $districts); $this->assign('district', $district); $this->assign('level', $level); $this->assign('disease', $disease); $this->assign('keyword', $keyword); $this->assign('hospital', $hospital); $this->assign('page', $page); $this->display(); }