static function getAjkHpNumByBroker($city_id, $broker_id) { $solr = new Solr_SolrList(); $solr->set_is_hp(true); $solr->set_brokerid($broker_id); $solr->set_list_type(4); $url = $solr->get_lucene_city_uri($city_id); $json_data = Solr_SolrList::get_result_from_lucene($url); if (!isset($json_data['response'])) { $num = false; } else { $num = Solr_SolrList::get_num_count($json_data); } return $num; }
/** * @param $cityId * @param $q * @param $pb * @param int $limit * @param int $memberId * @return mixed */ public static function getJpSearchProperty($cityId, $q, $pb, $memberId, $limit = 0) { $limit = $limit > 0 ? $limit : 10; $solr = ''; if ($pb == 'building') { $solr = new Solr_SolrList('solrJpBuildingServer', true, false); } elseif ($pb == 'property') { $solr = new Solr_SolrList('solrJpPropertyServer', true, false); } $buildings = array(); $solr->set_row($limit); $solr->set_q($q); $solr->set_fq('city_id:' . $cityId); if ($pb == 'property') { $solr->set_sort('is_spider asc,type asc'); } $url = $solr->get_lucene_uri('', false, false); $json_data = $solr->get_result_from_lucene($url); $solrData = Solr_SolrList::get_properties($json_data); $solrIds = array(); foreach ($solrData as $solr) { $solrIds[] = $solr['id']; } //var_dump($solrIds);die; if (!empty($solrIds)) { $temp = array(); if ($pb == 'building') { $temp = Model_House_JpBuilding::data_access()->filter(Model_House_JpBuilding::ID, $solrIds)->filter(Model_House_JpBuilding::IS_ACTIVED, Model_House_JpBuilding::ENUM_IS_ACTIVED_YES)->limit($limit)->get_all(); } elseif ($pb == 'property') { $temp = Model_House_JpProperty::data_access()->filter('id', $solrIds)->filter('isActived', Model_House_JpProperty::ENUM_IS_ACTIVED_YES)->sort('isSpider')->limit($limit)->get_all(); } $cityIds = $districtIds = $blockIds = array(); foreach ($temp as $tmp) { $cityIds[] = $tmp['cityId']; $districtIds[] = $tmp['districtId']; $blockIds[] = $tmp['blockId']; } $cityIds = array_unique($cityIds); $districtIds = array_unique($districtIds); $blockIds = array_unique($blockIds); $citys = $districts = $blocks = array(); if ($cityIds) { $citysT = Model_Jinpu_City::data_access()->filter('id', $cityIds)->get_all(); foreach ($citysT as $c) { $citys[$c['id']] = $c['name']; } } if ($districts) { $districtsT = Model_Jinpu_District::data_access()->filter('id', $districtIds)->get_all(); foreach ($districtsT as $d) { $districts[$d['id']] = $d['name']; } } if ($blockIds) { $blocksT = Model_Jinpu_Block::data_access()->filter('id', $blockIds)->get_all(); foreach ($blocksT as $d) { $blocks[$d['id']] = $d['name']; } } foreach ($temp as $b) { $allLock = BLL_House_JpProperty::getBuildingLockById($b['id']); $buildings[] = array('id' => $b['id'], 'district_id' => $b['districtId'], 'block_id' => $b['blockId'], 'name' => $b['name'] . ($pb == 'property' ? '商铺' : ''), 'city' => empty($citys[$b['cityId']]) ? '' : $citys[$b['cityId']], 'district' => empty($districts[$b['districtId']]) ? '' : $districts[$b['districtId']], 'block' => empty($blocks[$b['blockId']]) ? '' : $blocks[$b['blockId']], 'business_cycle' => empty($b['businessCycle']) ? '' : $b['businessCycle'], 'address' => empty($b['address']) ? '' : $b['address'], 'manage_fee' => empty($b['manageFee']) ? '' : $b['manageFee'], 'property_company' => $b['propertyCompany'], 'has_uploaded_image' => BLL_House_JpProperty::hasLibrary($memberId, $b['id'], $pb), 'property_company_lock' => isset($allLock['property_company']) && $allLock['property_company'] || $b['isNew'] ? 1 : 0); } } return $buildings; }