Exemple #1
0
 /**
  * 获取区域板块
  * @static
  * @param $p_intHouseType
  * @param $p_objHouse
  * @return array|bool
  */
 public static function getDistrictBlock($p_intHouseType, $p_objHouse)
 {
     $p_intHouseType = intval($p_intHouseType);
     //获取区域板块编号
     $intDistrictId = 0;
     $intBlockId = 0;
     if (in_array($p_intHouseType, array(1, 2))) {
         $objBuilding = BLL_House_JpProperty::getBuilding($p_objHouse->building_id);
         if ($objBuilding == null) {
             $objBuilding = BLL_House_JpProperty::getProperty($p_objHouse->building_id);
             if ($objBuilding == null) {
                 return false;
             }
         }
         $intBlockId = $objBuilding->blockId;
         $intDistrictId = $objBuilding->districtId;
     } else {
         $objProperty = BLL_House_JpProperty::getProperty($p_objHouse->property_id);
         if (!$objProperty instanceof Model_House_JpProperty) {
             return false;
         }
         if ($objProperty->isRoad == 1) {
             $intBlockId = $p_objHouse->blockId;
             $intDistrictId = $p_objHouse->districtId;
         } else {
             $intBlockId = $objProperty->blockId;
             $intDistrictId = $objProperty->districtId;
         }
     }
     $district_data = Bll_AreaBll::get_instance()->getDistrict_b($intDistrictId);
     $block_data = Bll_AreaBll::get_instance()->getBlock_b($intBlockId);
     if (isset($district_data) && isset($block_data) && $district_data && $block_data) {
         $district_name = $district_data->name;
         $block_name = $block_data->name;
         $district_pinyin = $district_data->pinyin;
         $bolck_pinyin = $block_data->pinyin;
     } else {
         $district_name = '';
         $block_name = '';
         $district_pinyin = '';
         $bolck_pinyin = '';
     }
     $arrData = array('district_id' => $intDistrictId, 'district_name' => $district_name, 'district_pinyin' => $district_pinyin, 'block_id' => $intBlockId, 'block_name' => $block_name, 'block_pinyin' => $bolck_pinyin);
     //判断和获取新板块
     $arrBlockConfigs = array('1' => 'clues_search_condition_office_rent_list_switch', '2' => 'clues_search_condition_office_sale_list_switch', '3' => 'clues_search_condition_shop_rent_list_switch', '4' => 'clues_search_condition_shop_sale_list_switch');
     $strBlockConfig = isset($arrBlockConfigs[$p_intHouseType]) ? $arrBlockConfigs[$p_intHouseType] : array();
     if (empty($strBlockConfig)) {
         return $arrData;
     }
     $arrBlockConfig = APF::get_instance()->get_config($strBlockConfig, 'multicity');
     $intCityId = $p_objHouse->city_id;
     $bolUseNewBlock = isset($arrBlockConfig[$intCityId]) ? $arrBlockConfig[$intCityId] : false;
     if ($bolUseNewBlock) {
         $arrHouseType = array('1' => 'office_rent', '2' => 'office_sale', '3' => 'shop_rent', '4' => 'shop_sale');
         $strHouseType = isset($arrHouseType[$p_intHouseType]) ? $arrHouseType[$p_intHouseType] : '';
         if (empty($strHouseType)) {
             return $arrData;
         }
         if (in_array($p_intHouseType, array(1, 2))) {
             $arrResult = Bll_AreaBll::get_instance()->get_new_district_business_by_old_block($intBlockId, $strHouseType);
         } else {
             $arrResult = Bll_AreaBll::get_instance()->get_new_district_business_by_old_block_shop($intBlockId, $strHouseType);
         }
         if (isset($arrResult['new_district_id']) && !empty($arrResult['new_district_id'])) {
             $arrData['new_district_id'] = intval($arrResult['new_district_id']);
             $arrData['new_district_name'] = $arrResult['new_district_name'];
             $arrData['new_district_pinyin'] = $arrResult['new_district_pinyin'];
         }
         if (isset($arrResult['new_business_id']) && !empty($arrResult['new_business_id'])) {
             $arrData['new_business_id'] = intval($arrResult['new_business_id']);
             $arrData['new_business_name'] = $arrResult['new_business_name'];
             $arrData['new_business_pinyin'] = $arrResult['new_business_pinyin'];
         }
     }
     return $arrData;
 }