Exemplo n.º 1
0
 /**
  * 检查小区,是否为单一建筑类型,房源数大于20
  * @param int $communityId 小区 Id
  * @return bool
  */
 public function check_community($communityId)
 {
     $communityInfo = Model_Community_AjkCommunity::getCommunityInfoById($communityId);
     $use_type = $communityInfo['useType'];
     $use_type_count = count(explode(',', $use_type));
     $build_type = $communityInfo['buildType'];
     $build_type_count = count(explode(',', $build_type));
     if ($use_type_count == 1 && $build_type_count < 2) {
         $comm_count = Model_Community_AjkSaleRentCount::getCommunitySaleNum($communityId);
         $this->logInfo(sprintf('小区[%d] 房屋类型:%s 物业类型:%s, 小区房源数:%d', $communityId, $build_type, $use_type, $comm_count));
         return $comm_count > 20 ? true : false;
     }
     $this->logInfo(sprintf('小区[%d] 房源类型:%s 物业类型:%s', $communityId, $build_type, $use_type));
     return false;
 }
Exemplo n.º 2
0
 private function getCommList($brokerId, $lat, $lng)
 {
     // 从缓存中读取数据
     $communities = Bll_Commsign::getCommList($brokerId);
     if (empty($communities)) {
         // 根据lat和lng获取1.5km内的小区列表
         $latLngRound = Util_Map::round($lat, $lng, 1500);
         $communities = Model_Community_AjkCommunity::data_access()->load_field(array('commId', 'commName', 'sosolng', 'sosolat'))->filter('typeFlag', 0)->filter_by_op_multi(array(array('sosolat', '>=', $latLngRound['minLat']), array('sosolat', '<=', $latLngRound['maxLat']), array('sosolng', '>=', $latLngRound['minLng']), array('sosolng', '<=', $latLngRound['maxLng'])))->limit(1000)->get_all();
         if (empty($communities)) {
             return array();
         }
         // 实现按距离排序 • 升序
         uasort($communities, function (&$a, &$b) use($lat, $lng) {
             // 计算坐标的距离
             $a['distance'] = Util_Map::distance($lat, $lng, $a['sosolat'], $a['sosolng']);
             $b['distance'] = Util_Map::distance($lat, $lng, $b['sosolat'], $b['sosolng']);
             // 比较两小区坐标
             if ($a['distance'] == $b['distance']) {
                 return 0;
             }
             return $a['distance'] < $b['distance'] ? -1 : 1;
         });
         $i = 0;
         $data = array();
         foreach ($communities as $community) {
             if (++$i > 300) {
                 break;
             }
             $row = array();
             $row['commId'] = $community['commId'];
             $row['commName'] = $community['commName'];
             $row['lng'] = $community['sosolng'];
             $row['lat'] = $community['sosolat'];
             $row['distance'] = $community['distance'];
             $data[] = $row;
         }
         // 缓存数据
         Bll_Commsign::setCommList($brokerId, $data);
         return $data;
     } else {
         if (is_array($communities)) {
             return $communities;
         } else {
             return array();
         }
     }
 }
Exemplo n.º 3
0
 public function handle_request()
 {
     $communityId = 1;
     $communityBaseInfo = Model_Community_AjkCommunity::getCommunityInfoById($communityId);
     //        echo Model_Community_AjkCommunity::data_access()->get_last_sql();
     //        print_r($communityBaseInfo);
     $communityList = Bll_Community_APIComm::getInstance()->getInfoById($communityId);
     //        print_r($communityList);
     $communityMapInfo = Model_Community_CommunityBaiDuMap::getCommunityMap($communityId);
     //        echo Model_Community_CommunityBaiDuMap::data_access()->get_last_sql();
     //        print_r($communityMapInfo);
     $commId = 1;
     $commIds = array(1);
     //        $commInfos = Model_Community_AjkCommunity::getInfoById($commIds);
     //        print_r($commInfos);
     //        $records = Model_Community_AjkCommunity::getRecordsById($commIds);
     //        print_r($records);
     //        $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $communityId)
     //            ->find_only();
     //        print_r($community);
     $commInfo = Model_Community_AjkCommunity::getInfoById($commIds);
     $commInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId);
     //        print_r($commInfo);
     //        print_r($commInfo1);
     //
     //        $communityBaseInfo = Model_Community_AjkCommunity::getCommunityInfoById($communityId);
     //        $communityExtendInfo = Model_Community_CommunityExtend::getCommunityExtendInfo($communityId);
     //        $communityMapInfo = Model_Community_CommunityBaiDuMap::getCommunityMap($communityId);
     //        $communityFrmInfo = Model_Community_CommunityFrm::getCommunityFrmByCommunityId($communityId);
     //        $result = array(
     //            'baseInfo' => $communityBaseInfo,
     //            'extendInfo' => $communityExtendInfo,
     //            'mapInfo' => $communityMapInfo,
     //            'frmInfo' => $communityFrmInfo,
     //        );
     //        print_r($result);
     $communityBaseInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($communityId);
     $communityExtendInfo1 = Model_Community_CommunityExtend::getCommunityExtendInfo($communityId);
     $communityMapInfo1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapBaiDuMapping($communityId, 2);
     $communityFrmInfo1 = Model_Community_CommunityFrm::getCommunityFrmByCommunityId($communityId);
     $result1 = array('baseInfo' => $communityBaseInfo1, 'extendInfo' => $communityExtendInfo1, 'mapInfo' => $communityMapInfo1, 'frmInfo' => $communityFrmInfo1);
     //        print_r($result1);
     //                $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $commId)
     //            ->find_only();
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Bll_Community_APIComm::getInstance()->getInfoById($commId);
     //        $community = Model_Community_AjkCommunity::getInfoById($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds,2);
     //        $community = Model_Community_AjkCommunity::getInfoById($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds,2);
     $commIdStr = '1,2';
     $commIds = explode(',', $commIdStr);
     //        print_r($commIds);
     $community = Model_Community_AjkCommunity::getRecordsById($commIds);
     $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     //        $community = Dao_Comm_AjkCommunity::get_community_info_byids($commIds);
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     //        $community = Model_Community_AjkCommunity::data_access()
     //                ->filter('commId', $commId)
     //                ->find_only();
     //
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Model_Community_AjkCommunity::getRecordsById($commId);
     //        $data['commLocation']= $commInfo->commLocal;
     //        $data['sosolat']= $commInfo->sosolat;//纬度
     //        $data['sosolng']= $commInfo->sosolng;//经度
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //        $community = Model_Community_AjkCommunity::data_access()
     //            ->filter('commId', $commId)
     //            ->find_only();
     //        $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId,2);
     //
     $community = Model_Community_AjkCommunity::data_access()->filter('commId', $commId)->find_only();
     $community1 = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commId, 2);
     print_r($community);
     print_r($community1);
 }