コード例 #1
0
 /**
  * 两公里经纪人
  * @param $commId
  * @param $sosolat
  * @param $sosolng
  * @param $commIds //测试小区id
  * @param $pushOpen //兼容老的推送开关-测试使用
  * @return array|bool|mixed|multitype|null
  */
 private function getBroker2K($commId, $sosolat, $sosolng, $commIds, $pushOpen, $houseId)
 {
     $brokerIds = array();
     if (!in_array($commId, $commIds)) {
         $km = 2000;
         //在小区详情表中获取小区所在的城市ID
         $commCityId = $this->getCityIdByCommId($commId);
         //查询该小区2KM内的所有经纪人
         $rushCommunityLimit = APF::get_instance()->get_config('rush_community_limit');
         $allBrokers = Model_Broker_BrokerActionCenter::getBrokerInfoByXY($sosolat, $sosolng, $km, $rushCommunityLimit);
         //剔除与该小区所在的cityid不同的经纪人id
         $aroundBrokerRaws = $this->getBrokerIdsByCityIdAndBrokerIds($allBrokers, $commCityId);
         $brokerIdsBefore = $aroundBrokers = array();
         if (!empty($aroundBrokerRaws)) {
             $brokerIdsBefore = $aroundBrokerRaws;
             //读取微聊id
             $aroundBrokers = Model_Mobile_BrokerChatInfo::getActiveBrokerIdsCV($brokerIdsBefore);
             $chargeMinCV = APF::get_instance()->get_config('charge_entrust_min_cv');
             $freeMinCV = APF::get_instance()->get_config('free_entrust_min_cv');
             $brokerIdsBefore = array();
             foreach ($aroundBrokers as $chatinfosBroker) {
                 //读取接口
                 if (!empty($chatinfosBroker['chatId'])) {
                     $response = Bll_Mobile_ChatInfoBll::getInstance()->apiGetChatInfoByCV($chatinfosBroker['chatId']);
                 }
                 //3.7版本以上或免费城市3.4版本以上
                 if ($response['data']['result']['cv'] >= $chargeMinCV || !$pushOpen && $response['data']['result']['cv'] >= $freeMinCV) {
                     $brokerIdsBefore[] = $chatinfosBroker['brokerId'];
                 } else {
                     $this->setLog(date('Y-m-d H:i:s') . '-houseId: ' . $houseId . ' - brokerId: ' . $chatinfosBroker['brokerId'] . '--该经纪人版本号不合要求');
                 }
             }
             //排序
             foreach ($allBrokers as $broker) {
                 if (in_array($broker['brokerId'], $brokerIdsBefore)) {
                     $brokerIds[] = $broker['brokerId'];
                 }
             }
         } else {
             $this->setLog(date('Y-m-d H:i:s') . '-houseId: ' . $houseId . ' - commId: ' . $commId . '--该小区2km内无经纪人');
         }
     } else {
         //测试小区
         if (!empty($_SERVER['PG_TEST'])) {
             //如果是PG
             $brokerIdsArr = APF::get_instance()->get_config('pg_test_broker_id', 'apiTestId');
             $brokerIds = $brokerIdsArr[$commId];
         } else {
             $brokerIdsArr = APF::get_instance()->get_config('test_broker_id', 'apiTestId');
             $brokerIds = $brokerIdsArr[$commId];
         }
     }
     return $brokerIds;
 }
コード例 #2
0
ファイル: NewProps.php プロジェクト: emilymwang8/ajk-broker
 public function getBrokersWithinScope($lat, $lng, $radius, $limit)
 {
     $brokersWithScope = array();
     $allBrokers = Model_Broker_BrokerActionCenter::getBrokerInfoByXY($lat, $lng, $radius, $limit);
     foreach ($allBrokers as $broker) {
         $brokersWithScope[$broker->brokerId] = $broker;
     }
     $brokerIds = array_keys($brokersWithScope);
     //vip 经纪人 fky_users表中status 为1的
     $fykBrokers = Model_Fyk_Users::getUsersByBrokerId($brokerIds);
     //经纪人用户Id数组
     $fykBrokerIds = $brokerUserIds = array();
     foreach ($fykBrokers as $fykBroker) {
         $fykBrokerIds[] = $fykBroker['brokerId'];
         $brokerUserIds[$fykBroker['brokerId']] = $fykBroker['userId'];
     }
     foreach ($brokersWithScope as $brokerId => $broker) {
         //过滤非房源库的经纪人
         if (!in_array($brokerId, $fykBrokerIds)) {
             unset($brokersWithScope[$brokerId]);
             unset($brokerUserIds[$brokerId]);
         }
     }
     //获取经纪人手机版本
     $brokerVersions = $this->getBrokersVersion(array_keys($brokersWithScope));
     $fykMinCV = APF::get_instance()->get_config('fyk_min_cv');
     foreach ($brokersWithScope as $brokerId => $brokerInfo) {
         if (!isset($brokerVersions[$brokerId]) || $brokerVersions[$brokerId] < $fykMinCV) {
             unset($brokersWithScope[$brokerId]);
             unset($brokerUserIds[$brokerId]);
         }
     }
     return array($brokersWithScope, $brokerUserIds);
 }