public function ajk_community_info($commid) { $key = "Dao_Comm_AjkCommunity_ajk_community_info_infos{$commid}"; $functionName = 'ajk_community_info'; APF::get_instance()->benchmark_begin(__CLASS__ . $functionName); $memcache = APF_Cache_Factory::get_instance()->get_memcache(); $info = $memcache->get($key); if (!$info) { $commmap = array(); $info = array(); // 小区开展信息 $info['commextend'] = $this->get_commextinfo_by_commid($commid); $i = 0; while ($info['commextend']['ismerge'] == 1) { // 是否合并小区 $commid = self::get_from_commid($commid); if (empty($commid)) { return array(); } // 小区开展信息 $info['commextend'] = $this->get_commextinfo_by_commid($commid); if ($i > 2) { break; } $i++; } // 小区基本信息 $info['community'] = $this->get_community_info_byid($commid); if (!$info['community']) { return array(); } // 小区地图信息,先从map_communities_baidu,没有的话从ajk_communitys取 $commmap = $this->get_comm_latlng_by_commid($commid); if ($commmap) { if ($commmap['lat'] && $commmap['lng'] && $commmap['zoom']) { $info['community']['mapx'] = $commmap['lng']; $info['community']['mapy'] = $commmap['lat']; $info['community']['mapzoom'] = $commmap['zoom']; } } // 区域、板块 $daoArea = new Dao_Area_HzArea(); $areaList = $daoArea->get_areaname_bycode(substr(@$info['community']['AREACODE'], 0, 8)); $blockList = $daoArea->get_areaname_bycode(@$info['community']['AREACODE']); $info['community']['areainfo'] = $areaList; $info['community']['blockinfo'] = $blockList; $info['commid'] = $info['community']['commid']; $memcache->add($key, $info, 0, 28800); //8h } APF::get_instance()->benchmark_end(__CLASS__ . $functionName); return $info; }
/** * 通过小区id获取对应的板块ID * @param $comm_id * @param $prop_id * @param int $type * @return int */ public static function get_subregion_id($comm_id, $prop_id, $type = 2) { //所有的版块ID均使用area标中的ajk_id $ajk_subregion_id = 0; if ($comm_id) { $dao_ajk_comm = new Dao_Comm_AjkCommunity(); $row = $dao_ajk_comm->ajk_community_info($comm_id); $subregion_id = isset($row['community']['blockinfo']['ID']) ? intval($row['community']['blockinfo']['ID']) : 0; } else { $row = self::get_prop($prop_id); $subregion_id = isset($row['blockid']) ? intval($row['blockid']) : 0; } if ($subregion_id) { $daoArea = new Dao_Area_HzArea(); $r = $daoArea->get_area_byid($subregion_id); $ajk_subregion_id = isset($r['AJK_ID']) ? intval($r['AJK_ID']) : 0; } return $ajk_subregion_id; }