public function run()
 {
     //获取精选符合的精选计划
     $planInfos = Model_Plan_Jp::getValidChoicePlanByCursor($this->cursor, $this->limit);
     //无需要处理的数据
     if (empty($planInfos)) {
         $this->setShStopFlag();
         $this->setCursor(0);
         $this->logQuit("无需要处理的数据.");
     }
     foreach ($planInfos as $plan) {
         $cityId = $plan->cityId;
         $houseType = $plan->houseType;
         /** 获取房源基本信息 */
         $propInfo = Bll_House_JpHouseInfo::getHouseInfoById($plan->houseId);
         /** 获取价格信息 **/
         $arrPrice = Bll_House_JpHouseInfo::getPrice($cityId, $propInfo['base']['houseType'], $propInfo['info']);
         //获取二手房经纪人id
         $mainBusiness = Model_Broker_MainBusiness::getMainBusinessByJpBrokerId($plan['memberId'], false);
         //获取点击单击
         $apiParams = array('brokerId' => $mainBusiness['ajkBrokerid'], 'cityId' => $cityId, 'price' => $arrPrice['price'] ?: 0, 'blockId' => $plan->blockId, 'newBlockId' => $plan->newBlockId, 'houseType' => $houseType);
         $clickPrice = Bll_Service_Choice::jpClickPrice($apiParams);
         if ($clickPrice['status'] == 'error') {
             $this->logQuit(sprintf('计划%d获取对应的点击单价失败', $plan->id));
         }
         $spreadPrice = $clickPrice['realTradeAmount'];
         //更新点击单价
         $oldSpreadPrice = $propInfo['info']->spreadPrice;
         $propInfo['info']->spreadPrice = $spreadPrice;
         $propInfo['info']->save();
         $this->addLogger(sprintf("计划%dspreadPrice修改,%d=>%d", $plan->id, $oldSpreadPrice, $spreadPrice));
         //更新游标
         $this->setCursor($plan->id);
     }
 }
예제 #2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_NOT_CHOICE_CITY, 'message' => '非精选城市');
     }
     $bllChoice = new Bll_Zufang_Choice();
     $today = date('Ymd');
     $choiceInfo = $bllChoice->get_choice_info($hzBrokerId, $today, $cityId);
     $todayClicks = intval($choiceInfo[0]['bidClicks']);
     $todayConsume = intval($choiceInfo[0]['bidConsume']) / 100;
     // 获取精选推广房源数(精选计划和房源一一对应)
     $plansIds = array();
     $plans = $bllChoice->get_active_choice_plans($hzBrokerId, array(1, 13, 2, 3, 7, 8));
     foreach ($plans as $plan) {
         $plansIds[] = $plan->id;
     }
     $props = array();
     if ($plansIds) {
         $props = $bllChoice->get_prop($plansIds);
     }
     $totalProps = count($props);
     //将精选状态变化数目归零
     $keyData = array('brokerId' => $brokerId, 'bizType' => Model_Mobile_PropRedDot::TYPE_CHOICE_STATUS);
     $data = array('num' => 0);
     Bll_Mobile_PropRedDot::getInstance()->updateData($keyData, $data);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps));
 }
예제 #3
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     if (!$hzBrokerId || !$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $broker['cityId'];
     if (!Bll_City::isBidCity($cityId)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元', 'totalProps' => 0));
     }
     // 获取今日房源点击和消费记录
     $clicksInfo = Model_Stats_PropClick::getClickInfoByBrokerId($hzBrokerId, $cityId);
     // 统计今日竞价点击和消费
     $todayClicks = 0;
     $todayConsume = 0;
     foreach ($clicksInfo as $objClick) {
         $todayClicks += $objClick->bid_cnum;
         $todayConsume += $objClick->bid_cost;
     }
     // 获取竞价房源数
     $bidPropNum = Bll_HzBidPlan::get_broker_bidprop_count($hzBrokerId);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume / 100), 'todayConsumeUnit' => '元', 'totalProps' => $bidPropNum));
 }
예제 #4
0
 public function get_hz_broker_id($brokerId)
 {
     $da = Model_Broker_MainBusiness::data_access();
     $da->filter('ajkBrokerid', $brokerId);
     $data = $da->find();
     return $data ? $data[0]->hzBrokerid : 0;
 }
예제 #5
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect(self::getURL('my', '/login', 'anjuke'));
     }
     $broker = self::$BrokerInfo;
     $this->_intBrokerID = $broker['BaseInfo']['BROKERID'];
     $this->_intBrokerCityID = $broker['BaseInfo']['CITYID'];
     $type = APF::get_instance()->get_request()->get_parameter("type");
     $BrokerMap = Model_Broker_MainBusiness::getBrokerMap($this->_intBrokerID);
     if (empty($type) || empty($BrokerMap)) {
         $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajk_brokerid']));
     }
     /*
     http://beijing.jinpu.com/dianpu/39501
     http://beijing.haozu.com/shop/1796250
     http://beijing.anjuke.com/shop/view/147479
     */
     switch ($type) {
         case 'ajk':
             $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajkBrokerid']));
             break;
         case 'zf':
             $this->redirect(Util_Url::getHaozuURLNew($this->_intBrokerCityID, '/dianpu/' . $BrokerMap['hzBrokerid']));
             break;
         case 'jp':
             $this->redirect(Util_Url::getJinpuURLNew($this->_intBrokerCityID, '/dianpu/' . $BrokerMap['jpBrokerid']));
             break;
         default:
             $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajkBrokerid']));
             break;
     }
 }
예제 #6
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     // 获取Broker Mapping
     $brokerMapping = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($brokerId);
     if (!$brokerMapping) {
         throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     // 获取房源信息
     $prop = Model_House_HzProp::findByPropId($propId);
     if (!$prop) {
         throw new Exception('房源不存在', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     // 判断房源和经纪人关联关系
     $contentBasic = $prop->getContentBasic();
     if ($contentBasic['userid'] != $brokerMapping['hzBrokerid']) {
         throw new Exception('房源不属于该经纪人', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     $data = array();
     $area_id = $contentBasic['areaid'];
     $block_id = $contentBasic['blockid'];
     $areaInfo = Model_City_HzArea::getAreaById($area_id);
     $area_name = $areaInfo['typeName'];
     $blockInfo = Model_City_HzArea::getAreaById($block_id);
     $block_name = $blockInfo['typeName'];
     $data['areaname'] = $area_name;
     $data['blockname'] = $block_name;
     $data['propId'] = $propId;
     $data['url'] = $this->build_base_url($contentBasic['cityid'], $propId);
     $data['title'] = $contentBasic['title'];
     $data['imgUrl'] = $prop->getDefaultImageUrl();
     $data['commId'] = $contentBasic['commid'];
     $data['commName'] = $contentBasic['commname'];
     $data['roomNum'] = $contentBasic['roomnum'];
     $data['hallNum'] = $contentBasic['hallnum'];
     $data['toiletNum'] = $contentBasic['toilnetnum'];
     $data['area'] = round($contentBasic['areanum']);
     $data['price'] = round($contentBasic['pricenum']);
     $data['priceUnit'] = '元/月';
     $data['isVisible'] = intval(!$prop->isIllegal());
     $data['isMoreImg'] = intval($prop->isMultiImages());
     $data['isBid'] = intval($prop->isBid());
     $data['isChoice'] = intval($prop->isChoice());
     $data['isPhonePub'] = intval($prop->isFromMobile());
     $data['publishDays'] = $prop->getPublishedDays();
     $data['publishDaysMsg'] = $prop->getPublishedDays() > 0 ? "{$data['publishDays']}天前发布" : '今天发布';
     $data['createTime'] = date('Y-m-d H:i:s', $contentBasic['created']);
     $data['updateTime'] = date('Y-m-d H:i:s', $contentBasic['updated']);
     //增加委托房源标签
     $isEntrust = Bll_Zufang_Choice::isCommissionHouse($propId, $brokerId, Model_House_Commission::TYPE_RENT);
     if ($isEntrust) {
         $data['isEntrust'] = 1;
     } else {
         $data['isEntrust'] = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
예제 #7
0
 private function initEnv()
 {
     $this->objAPF = $objAPF = APF::get_instance();
     $this->request = $this->objAPF->get_request();
     $this->params = $this->request->get_parameters();
     $this->brokerId = $this->request->getBrokerId();
     $this->cityId = $this->request->getBrokerCityId();
     //设置租房、金铺的经纪人id
     $MainBusiness = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($this->brokerId, false);
     $this->hzBrokerId = $MainBusiness['hzBrokerid'];
     $this->jpBrokerId = $MainBusiness['jpBrokerid'];
     $this->debug = isset($_GET['debug']) ? true : false;
 }
예제 #8
0
 /**
  *
  * 根据二手房brokerid获取记录
  *
  * @param $esfBrokerid
  */
 public static function getDataByEsfId($esfBrokerid)
 {
     if (isset(self::$MainBusinessByEsfId[$esfBrokerid])) {
         return self::$MainBusinessByEsfId[$esfBrokerid];
     } else {
         $data = array(array('ajkBrokerid', '=', $esfBrokerid));
         $order = array();
         $prefix = '';
         $result = Model_Broker_MainBusiness::fetchoneLayer($data, $order, $prefix);
         if (!empty($result)) {
             self::setStatisData($result);
         }
         return $result;
     }
 }
예제 #9
0
 public function handle_request()
 {
     $brokerid = $this->getOption('brokerid');
     $cityId = 11;
     printf('[%s] lastLogId: %s, start: %s, end: %s' . PHP_EOL, date('Y-m-d H:i:s'), $this->lastLogId, $this->start, $this->end);
     if (!isset($brokerid)) {
         $brokerid = 0;
     }
     $brokerInfos = Model_Broker_AjkBrokerExtend::getBrokerInfoByCityId($cityId, $this->lastLogId, $this->pageSize, $brokerid, 'K');
     if (empty($brokerInfos)) {
         printf('[%s] remark: %s' . PHP_EOL, date('Y-m-d H:i:s'), '任务执行完成.');
         $this->setStop();
         $this->setShStopFlag();
         exit;
     }
     foreach ($brokerInfos as $brokerInfo) {
         if ($cityId != $brokerInfo->cityId) {
             continue;
         }
         $this->lastLogId = $brokerInfo->brokerId;
         $brokers = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($brokerInfo->brokerId);
         if (empty($brokers)) {
             echo "no data! \r\n";
         } else {
             if ($brokers->ajkBrokerid) {
                 printf('[%s]开始处理二手房: 城市ID为%s的历史数据,brokerId为%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid);
                 //请求二手房API,处理竞价历史数据
                 $result = Uri_Curl::get($this->url . 'user/broker/transformmoney', array('id' => $brokers->ajkBrokerid, 'status' => 5));
                 printf('[%s]开始处理二手房: 城市ID为%s的历史数据,brokerId为%s,处理结果:%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid, $result);
             }
             if ($brokers->hzBrokerid) {
                 printf('[%s]开始处理租房: 城市ID为%s的历史数据,brokerId为%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid);
                 //请求租房API,处理竞价历史数据
                 $result = Uri_Curl::get($this->url . 'zufang/api/broker/transformmoney', array('id' => $brokers->ajkBrokerid, 'status' => 5));
                 printf('[%s]开始处理租房: 城市ID为%s的历史数据,brokerId为%s,处理结果:%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid, $result);
             }
             if ($brokers->jpBrokerid) {
                 printf('[%s]开始处理商业地产: 城市ID为%s的历史数据,brokerId为%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid);
                 //请求商业地产API,处理竞价历史数据
                 $result = Uri_Curl::get($this->url . 'jinpu/api/choice/brokerprop', array('brokerid' => $brokers->jpBrokerid, 'status' => 5));
                 printf('[%s]开始处理商业地产: 城市ID为%s的历史数据,brokerId为%s,处理结果:%s' . PHP_EOL, date('Y-m-d H:i:s'), $cityId, $brokers->ajkBrokerid, $result);
             }
             sleep(1);
         }
     }
     $params = array('cityId' => $cityId, 'lastLogId' => $this->lastLogId);
     $this->setFlag($params);
 }
예제 #10
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     // 获取Broker Mapping
     $brokerMapping = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($brokerId);
     if (!$brokerMapping) {
         throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $data = array();
     // 获取房源和计划关系
     $planRelation = Model_Plan_HzPlanning::getPropFixPlan($propId);
     if ($planRelation) {
         $data['status'] = 1;
         //推广中
     } else {
         $data['status'] = 0;
         //未推广
     }
     // 获取房源信息
     $prop = Model_House_HzProp::data_access()->filter('propId', $propId)->find_only();
     if (!$prop) {
         throw new Exception('房源不存在', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     // 判断房源和经纪人关联关系
     $propBasic = json_decode($prop['contentBasic'], true);
     if ($propBasic['userid'] != $brokerMapping['hzBrokerid']) {
         throw new Exception('房源不属于该经纪人', Const_APIStatus::E_PROP_NOT_EXISTS);
         // TODO
     }
     // 根据房源的计划ID判断房源是否已定价推广
     $data['planId'] = '';
     if ($plan = $prop->getFixPlan()) {
         $data['planId'] = $plan['id'];
     }
     // 点击单价
     $data['clickPrice'] = round($prop->getFixClickPrice(), 2);
     $data['clickPriceUnit'] = '元';
     // 今日定价点击量
     $data['todayClicks'] = $prop->getTodayClickSums('fix');
     // 定价点击总量
     $data['totalClicks'] = $prop->getTotalClickSums('fix');
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
예제 #11
0
 public function handle_request_internal()
 {
     $this->brokerId = $this->_params['brokerId'];
     $this->propId = $this->_params['propId'];
     // 获取经纪人映射
     $mapping = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($this->brokerId);
     if (!$mapping) {
         throw new Exception_BrokerNotFoundException();
     }
     $hzBrokerId = $mapping['hzBrokerid'];
     $this->broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($this->brokerId);
     $cityId = $this->broker['cityId'];
     // 非精选城市
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         throw new Exception('非精选城市', Const_APIStatus::E_NOT_CHOICE_CITY);
     }
     // 获取房源信息
     $this->prop = Model_House_HzProp::findByPropId($this->propId);
     if (!$this->prop) {
         throw new Exception_PropertyNotFoundException('房源不存在', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     // 检查房源是否属于当前经纪人
     if (!$this->prop->belongToBroker($hzBrokerId)) {
         throw new Exception('房源不属于经纪人', Const_APIStatus::E_PROP_NOT_EXISTS);
     }
     $price = $this->prop->getContentBasic('pricenum');
     $blockId = $this->prop->getContentBasic('blockid');
     // 获取精选推广位
     $this->bucket = Bll_Choice_HzBidBucket::get_bucket_info($blockId, $cityId, $price);
     $this->bucketId = $this->bucket['id'];
     // 检查房源是否可以添加精选推广位订阅
     if (($result = $this->hasAddChoiceRemindPermission()) !== true) {
         throw new Exception($result['msg'], intval($result['code']));
     }
     // 创建订阅
     $subscription = Model_Choice_Subscription::data_access()->filter('site', Model_Choice_Subscription::SITE_RENT)->filter('brokerId', $this->brokerId)->filter('propId', $this->propId)->filter('bucketId', $this->bucketId)->find_only();
     if (!$subscription) {
         Model_Choice_Subscription::create(array(Model_Choice_Subscription::SITE => Model_Choice_Subscription::SITE_RENT, Model_Choice_Subscription::BROKER_ID => $this->brokerId, Model_Choice_Subscription::PROP_ID => $this->propId, Model_Choice_Subscription::BUCKET_ID => $this->bucketId, Model_Choice_Subscription::STATUS => Model_Choice_Subscription::SUBSCRIPTION_START, Model_Choice_Subscription::CREATE_TIME => date('Y-m-d H:i:s'), Model_Choice_Subscription::UPDATE_TIME => date('Y-m-d H:i:s')))->save();
     } else {
         $subscription->status = Model_Choice_Subscription::SUBSCRIPTION_START;
         $subscription->save();
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('remindStatus' => 1, 'remindStatusMsg' => '取消推广位提醒'));
 }
예제 #12
0
 /**
  * 删除房源,可批量
  */
 public static function delete_prop($hzBrokerId, $city_id, $proids)
 {
     // 获取二手房经纪人ID,用于基于房源定价上下架日志
     $ajkBrokerId = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($hzBrokerId)->ajkBrokerid;
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     foreach ($proinfo as $proid => $prop) {
         $basic_info = $prop['content_basic'];
         if ($basic_info['cityid'] != $city_id || $basic_info['userid'] != $hzBrokerId) {
             continue;
         }
         $fix_planning = Dao_Broker_HzPlan::get_prop_planning($proid);
         if (!empty($fix_planning)) {
             Bll_HzFixPlan::prop_out_fix($hzBrokerId, $proid, $fix_planning[0]['plan_id']);
         }
         Dao_Broker_HzProp::change_prop_status($proid, Const_HzStatus::REMOVE);
         // 记录房源定价上下架记录
         Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $ajkBrokerId, 'pro_id' => $proid, 'plan_id' => $fix_planning ? $fix_planning[0]['plan_id'] : '', 'type' => 'pro_del', 'from' => 'hz_' . __CLASS__ . '_' . __FUNCTION__, 'remark' => '删除房源', 'site_type' => 2), $ajkBrokerId);
     }
     return true;
 }
예제 #13
0
 /**
  * 设置主营业务
  *
  * @param $userId
  * @param $brokerId
  * @param $mainBusinessType
  * @return mixed
  */
 public function setMainBusiness($userId, $brokerId, $mainBusinessType)
 {
     $objBrokerMainBusiness = new Model_Broker_MainBusiness();
     $objBrokerMainBusiness->memberId = $userId;
     $objBrokerMainBusiness->ajkBrokerid = $brokerId;
     $objBrokerMainBusiness->type = $mainBusinessType;
     $objBrokerMainBusiness->save();
     return $objBrokerMainBusiness->id;
 }
예제 #14
0
 private function store_main_business($data)
 {
     if (!isset($data['member_id'])) {
         $return['status'] = false;
         $return['mesg'] = '获取member id失败';
         return $return;
     }
     if (!isset($data['broker_id'])) {
         $return['status'] = false;
         $return['mesg'] = '获取经纪人id失败';
         return $return;
     }
     if (!isset($data['type'])) {
         $return['status'] = false;
         $return['mesg'] = '获取主营业务失败';
         return $return;
     }
     if (Model_Broker_MainBusiness::addStoreMainBusiness($data['member_id'], $data['broker_id'], $data['type']) == 0) {
         $return['status'] = false;
         $return['mesg'] = '存储主营业务失败。';
     } else {
         Model_Broker_MainBusinessLog::addStoreMainBusinessLog($data['member_id'], $data['broker_id'], $data['type']);
         $return['status'] = true;
     }
     return $return;
 }
예제 #15
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $planId = $this->_params['planId'];
     // 获取Broker Mapping
     $brokerMapping = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($brokerId);
     if (!$brokerMapping) {
         throw new Exception('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     // 判断计划和经纪人关联关系
     $plan = Model_Plan_HzPlanBasic::get_plan_by_id($planId);
     if ($plan['user_id'] != $brokerMapping['hzBrokerid']) {
         throw new Exception('计划不属于该经纪人', Const_APIStatus::E_PLAN_NOT_BELONG_BROKER);
     }
     // 获取定价推广房源列表
     $propertyList = array();
     $props = Bll_HzFixPlan::get_plan_props($planId, $cityId);
     if (isset($props[$planId]) && isset($props[$planId]['props'])) {
         $propIds = array();
         foreach ($props[$planId]['props'] as $prop) {
             $propId = $prop['proid'];
             $propIds[] = $propId;
             $row = array();
             $row['propId'] = $row['id'] = $propId;
             $row['title'] = $prop['content_basic']['title'];
             $row['imgUrl'] = '';
             $row['commId'] = $prop['content_basic']['commid'];
             $row['commName'] = $prop['content_basic']['commname'];
             $row['roomNum'] = $prop['content_basic']['roomnum'];
             $row['hallNum'] = $prop['content_basic']['hallnum'];
             $row['toiletNum'] = $prop['content_basic']['toilnetnum'];
             $row['area'] = round($prop['content_basic']['areanum']);
             $row['price'] = round($prop['content_basic']['pricenum']);
             $row['priceUnit'] = '元/月';
             $row['todayClicks'] = $prop['fix_click'];
             $row['totalClicks'] = $prop['fix_total_click'];
             $row['isBid'] = 0;
             $row['isChoice'] = 0;
             $row['isVisible'] = (int) ($prop['content_basic']['status'] != 6);
             $row['isMoreImg'] = (int) $prop['content_basic']['quality'];
             $row['isPhonePub'] = (int) (isset($prop['content_basic']['from']) && $prop['content_basic']['from'] == 'mobile-ajk-broker');
             $row['publishDays'] = floor((time() - $prop['content_basic']['created']) / 86400);
             $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布';
             $row['createTime'] = date('Y-m-d H:i:s', $prop['content_basic']['created']);
             $row['updateTime'] = date('Y-m-d H:i:s', $prop['content_basic']['updated']);
             //增加委托房源标签
             $isEntrust = Bll_Zufang_Choice::isCommissionHouse($propId, $brokerId, Model_House_Commission::TYPE_RENT);
             if ($isEntrust) {
                 $row['isEntrust'] = 1;
             } else {
                 $row['isEntrust'] = 0;
             }
             $propertyList[$propId] = $row;
         }
         if ($propIds) {
             // 批量获取房源的默认图片
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
             foreach ($defaultImages as $defaultImage) {
                 $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
             }
             // 批量获取房源和竞价计划的关联记录(精选是竞价2.0)(只取推广中和排队中的关系)
             $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
             // 批量获取房源竞价计划
             $planIds = array();
             $planPropMap = array();
             foreach ($relations as $relation) {
                 $planIds[] = $relation['plan_id'];
                 $planPropMap[$relation['plan_id']] = $relation['proid'];
             }
             if ($planIds) {
                 $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds);
                 foreach ($plans as $plan) {
                     // 忽略已删除计划
                     if ($plan->flag == 0) {
                         continue;
                     }
                     // 精选
                     if ($plan->bid_version == 2) {
                         $propId = $planPropMap[$plan['id']];
                         $propertyList[$propId]['isChoice'] = 1;
                     } else {
                         // 竞价
                         $propId = $planPropMap[$plan['id']];
                         $propertyList[$propId]['isBid'] = 1;
                     }
                 }
             }
         }
     }
     // 排序 • 按发布时间倒序
     usort($propertyList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return strtotime($a['createTime']) > strtotime($b['createTime']) ? -1 : 1;
     });
     // 分组
     $newList = array();
     $oldList = array();
     foreach ($propertyList as $property) {
         if ($property['publishDays'] > 30) {
             $oldList[] = $property;
         } else {
             $newList[] = $property;
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList));
 }
예제 #16
0
 /**
  * 批量将房源从定价组中移除
  */
 public static function batchprop_out_fix($hzBrokerId, $proids, $plan_id)
 {
     $flag_array = array('status' => 0, 'msg' => '');
     $plan_info = Dao_Broker_HzPlan::get_plan($plan_id);
     if (empty($plan_info)) {
         $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN;
         return $flag_array;
     }
     if ($plan_info['user_id'] != $hzBrokerId) {
         $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR;
         return $flag_array;
     }
     // 获取二手房经纪人ID,用于基于房源定价上下架日志
     $ajkBrokerId = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($hzBrokerId)->ajkBrokerid;
     $proinfo = Dao_Broker_HzProp::get_prop($proids);
     if ($proinfo) {
         foreach ($proinfo as $prop) {
             $proid = $prop['proid'];
             $planning = Dao_Broker_HzPlan::get_check_planning($proid, $plan_id);
             if (empty($planning)) {
                 continue;
             }
             if ($prop['content_basic']['userid'] != $plan_info['user_id']) {
                 continue;
             }
             $bid = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::BID_TYPE, '1,3,7');
             if (!empty($bid)) {
                 //停止竞价
                 Bll_HzBidPlan::delete_bid($hzBrokerId, $bid[0]['plan_id'], $proid);
             }
             $log_option = Const_HzLog::PAUSEPLAN;
             $new_is_valid = Const_HzPlan::MENUPAUSE;
             $basic_info = $prop['content_basic'];
             //更新房源计划信息
             if (Dao_Broker_HzProp::change_prop_status($proid, Const_HzStatus::OUTLINE)) {
                 //更新房源状态
                 if (Dao_Broker_HzPlan::update_planning($planning[0]['id'], $new_is_valid)) {
                     //更新关联关系
                     Dao_Broker_HzPlan::add_prop_log($proid, $log_option, $basic_info['userid'], $plan_id, $basic_info['status'], Const_HzStatus::OUTLINE);
                     //记房源日志
                     if ($basic_info['status'] == Const_HzStatus::ONLINE) {
                         //插入solr队列,房源下线
                         Dao_Broker_HzProp::into_prop_lucene($proid, $basic_info['cityid'], 2);
                         //写日志
                         Dao_Broker_HzProp::ezft_assistant_log($planning[0]['proid'], $basic_info['userid'], Const_HzPlan::SPREAD_TYPE, $basic_info['spread_type']);
                         Dao_Broker_HzProp::add_updown_log($planning[0]['proid'], $plan_id, Const_HzStatus::GOOFFLINE, $log_option);
                     }
                     // 记录房源定价上下架记录
                     Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $ajkBrokerId, 'pro_id' => $proid, 'plan_id' => $plan_id, 'type' => 'pro_del_from_plan', 'from' => 'hz_' . __CLASS__ . '_' . __FUNCTION__, 'remark' => json_encode(array('fix' => array('plan_status' => $plan_info['status']))), 'site_type' => 2), $ajkBrokerId);
                 }
             }
         }
         $flag_array['status'] = 1;
         return $flag_array;
     }
     $flag_array['msg'] = Const_HzErrorInfo::DATAFAIL;
     return $flag_array;
 }
예제 #17
0
 /**
  * 修复 `ajk_broker_main_business` 表
  *
  * @param $hzBrokerId
  * @param $ajkBrokerId
  * @param $memberId
  * @return bool
  */
 private function repairBrokerMainBusiness($hzBrokerId, $ajkBrokerId, $memberId)
 {
     // TODO 修复 `ajk_broker_main_business` 表
     $hzMainBusiness = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($hzBrokerId, false);
     $ajkMainBusiness = Model_Broker_MainBusiness::getMainBusinessByAjkBrokerId($ajkBrokerId, false);
     if (empty($hzMainBusiness) && empty($ajkMainBusiness)) {
         if (Model_Broker_MainBusiness::addMainBusiness($memberId, $hzBrokerId, $ajkBrokerId) == 0) {
             $this->log(sprintf('添加经纪人`ajk_broker_main_business`关系映射(%d, %d, %d)失败', $memberId, $ajkBrokerId, $hzBrokerId));
             return false;
         }
         $this->log(sprintf('添加经纪人`ajk_broker_main_business`关系映射(%d, %d, %d)成功', $memberId, $ajkBrokerId, $hzBrokerId));
         return true;
     }
     if ($hzMainBusiness['id'] == $ajkMainBusiness['id']) {
         $this->log(sprintf('添加经纪人`ajk_broker_main_business`关系映射(%d, %d, %d)正确,无须修复', $memberId, $ajkBrokerId, $hzBrokerId));
         return true;
     }
     if (!empty($hzMainBusiness) && !empty($ajkMainBusiness)) {
         if ($hzMainBusiness['jpBrokerid'] == 0 && $ajkMainBusiness['jpBrokerid'] != 0) {
             $jpBrokerid = $ajkMainBusiness['jpBrokerid'];
         } elseif ($ajkMainBusiness['jpBrokerid'] == 0 && $hzMainBusiness['jpBrokerid'] != 0) {
             $jpBrokerid = $hzMainBusiness['jpBrokerid'];
         } else {
             $jpBrokerid = 0;
         }
         Model_Broker_MainBusiness::deleteMainBusinessById($hzMainBusiness['id']);
         Model_Broker_MainBusiness::deleteMainBusinessById($ajkMainBusiness['id']);
         if (Model_Broker_MainBusiness::addMainBusiness($memberId, $hzBrokerId, $ajkBrokerId, $jpBrokerid) == 0) {
             $this->log(sprintf('添加经纪人`ajk_broker_main_business`关系映射(%d, %d, %d)失败2', $memberId, $ajkBrokerId, $hzBrokerId));
             return false;
         }
         $this->log(sprintf('添加经纪人`ajk_broker_main_business`关系映射(%d, %d, %d)成功2', $memberId, $ajkBrokerId, $hzBrokerId));
         return true;
     }
     if (!empty($hzMainBusiness)) {
         $updateData = array('ajkBrokerid' => $ajkBrokerId, 'memberId' => $memberId);
         if (Model_Broker_MainBusiness::updateMainBusinessById($hzMainBusiness['id'], $updateData) == 0) {
             $this->log(sprintf('更新经纪人`ajk_broker_main_business`(%d)关系映射(%d, %d, %d)失败', $hzMainBusiness['id'], $memberId, $ajkBrokerId, $hzBrokerId));
             return false;
         }
         $this->log(sprintf('更新经纪人`ajk_broker_main_business`(%d)关系映射(%d, %d, %d)成功', $hzMainBusiness['id'], $memberId, $ajkBrokerId, $hzBrokerId));
         return true;
     }
     if (!empty($ajkMainBusiness)) {
         $updateData = array('hzBrokerid' => $hzBrokerId);
         if (Model_Broker_MainBusiness::updateMainBusinessById($ajkMainBusiness['id'], $updateData) == 0) {
             $this->log(sprintf('更新经纪人`ajk_broker_main_business`(%d)关系映射(%d, %d, %d)失败2', $ajkMainBusiness['id'], $memberId, $ajkBrokerId, $hzBrokerId));
             return false;
         }
         $this->log(sprintf('更新经纪人`ajk_broker_main_business`(%d)关系映射(%d, %d, %d)成功2', $ajkMainBusiness['id'], $memberId, $ajkBrokerId, $hzBrokerId));
         return true;
     }
     return true;
 }
예제 #18
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     if (!$hzBrokerId || !$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $broker['cityId'];
     if (!Bll_City::isBidCity($cityId)) {
         throw new Exception_City_NotBidCity('CityId: ' . $cityId);
     }
     // 获取竞价房源
     $finalProps = array();
     $bidProps = Bll_HzBidPlan::get_broker_bidprop($hzBrokerId, $cityId);
     foreach ($bidProps as $bidProp) {
         $row = array();
         $row['propId'] = $bidProp['proid'];
         $row['title'] = $bidProp['prop']['content_basic']['title'];
         $row['imgUrl'] = '';
         $row['commId'] = $bidProp['prop']['content_basic']['commid'];
         $row['commName'] = $bidProp['prop']['content_basic']['commname'];
         $row['roomNum'] = $bidProp['prop']['content_basic']['roomnum'];
         $row['hallNum'] = $bidProp['prop']['content_basic']['hallnum'];
         $row['toiletNum'] = $bidProp['prop']['content_basic']['toilnetnum'];
         $row['area'] = round($bidProp['prop']['content_basic']['areanum']);
         $row['price'] = round($bidProp['prop']['content_basic']['pricenum']);
         $row['priceUnit'] = "元/月";
         $row['totalClicks'] = 0;
         $row['isBid'] = 1;
         $row['isChoice'] = 0;
         $row['isVisible'] = (int) ($bidProp['content_basic']['status'] != 6);
         $row['isMoreImg'] = (int) $bidProp['content_basic']['quality'];
         $row['isPhonePub'] = (int) (isset($bidProp['content_basic']['from']) && $bidProp['content_basic']['from'] == 'mobile-ajk-broker');
         // TODO 批量判定 增加委托房源标签
         $isEntrust = Bll_Zufang_Choice::isCommissionHouse($bidProp['proid'], $brokerId, Model_House_Commission::TYPE_RENT);
         if ($isEntrust) {
             $row['isEntrust'] = 1;
         } else {
             $row['isEntrust'] = 0;
         }
         // 确认房源分组
         // TODO 基于Rank获取分组可能对页面速度有一定影响
         $row['rank'] = $bidProp['rank'];
         if ($row['rank'] === '已暂停') {
             $row['group'] = 'offline';
         } elseif ($row['rank'] === '排队中') {
             $row['group'] = 'queued';
         } else {
             $row['group'] = 'online';
         }
         $finalProps[$row['propId']] = $row;
     }
     if ($finalProps) {
         $propIds = array_keys($finalProps);
         // 批量获取房源的默认图片
         $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
         foreach ($defaultImages as $defaultImage) {
             $finalProps[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
         }
         // 批量获取房源的竞价总点击
         $bidClicks = Model_Stats_PropClick::getPropAllClicks($propIds, $brokerId, $cityId);
         $bidClickSums = Model_Stats_PropClick::calculateClickSumsGroupByPropId($bidClicks, 'bid');
         foreach ($bidClickSums as $propId => $bidClickSum) {
             $finalProps[$propId]['totalClicks'] = $bidClickSum;
         }
     }
     // 排序 • 按ID倒序
     ksort($finalProps);
     // 分组
     $props = array('onlinePropertyList' => array(), 'queuedPropertyList' => array(), 'offlinePropertyList' => array());
     foreach ($finalProps as $finalProp) {
         switch ($finalProp['group']) {
             case 'online':
                 $props['onlinePropertyList'][] = $finalProp;
                 break;
             case 'queued':
                 $props['queuedPropertyList'][] = $finalProp;
                 break;
             case 'offline':
                 $props['offlinePropertyList'][] = $finalProp;
                 break;
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $props);
 }
예제 #19
0
 /**
  * @param $ajkPropSpread
  * @param int $doBucket 0-不处理,1-坑位数加一,-1-坑位数减一
  * @return bool
  * 精选计算排名
  */
 public function choiceComputeRank($blockId, $priceId)
 {
     //获取坑位表信息
     $bucketInfo = Model_Choice_HzBidBucket::get_bucket_info($blockId, $priceId);
     if (empty($bucketInfo)) {
         return array('未知的坑位表信息,blockId:' . $blockId . ' priceId:' . $priceId);
     }
     //获取坑里面的推广、排队的计划
     $bidPlanInfo = Model_Plan_HzPlanBasic::getChoiceQueuePlanByBucket($blockId, $priceId, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING));
     if (empty($bidPlanInfo)) {
         return array('未获取到同板块、价格段的房源。blockId:' . $blockId . ' priceId:' . $priceId);
     }
     $tmpRemark = array();
     //遍历坑里面的数据,计算排名
     foreach ($bidPlanInfo as $key => $list) {
         $broker = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($list['user_id'], false);
         if ($key < $bucketInfo['maxOnlineNum']) {
             //预期推广中的数据
             if ($list['status'] == Const_HzPlan::WAITING) {
                 //更新租房排队中的计划为推广中
                 Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::SPREAD);
                 //更新租房排队中的计划为推广中
                 Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::SPREAD, Const_HzPlan::BID_TYPE);
                 //查询精选关系表信息(获取到房源id)
                 $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']);
                 if (!empty($bidPlanProInfo)) {
                     //更新房源状态
                     Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], Const_HzStatus::ONLINE);
                 }
                 //通知solr队列上
                 Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], 1);
                 //记录房源日志
                 Model_Log_HouseLogNew::create(array('houseId' => $bidPlanProInfo['proid'], 'planId' => $bidPlanProInfo['plan_id'], 'brokerId' => $broker['ajkBrokerid'], 'cityId' => $bidPlanProInfo['city_id'], 'type' => 14, 'changeType' => '40' . self::$qInfo['actionId'], 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选推广', 'operatorId' => self::$qInfo['operationId'], 'siteType' => 2), date('Ymd'))->save();
                 $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为推广';
             }
         }
         /* else { //预期排队的数据
                         if ($list['status'] == Const_HzPlan::SPREAD) {
                             //更新租房排队中的计划为推广中
                             Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::WAITING);
                             //更新租房排队中的计划为推广中
                             Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::WAITING, Const_HzPlan::BID_TYPE);
                             //查询精选关系表信息(获取到房源id)
                             $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']);
                             if (!empty($bidPlanProInfo)) {
                                 //查询定价的信息,定价推广中的话,房源状态更新为1
                                 $fixPlanProInfo = Model_Plan_HzPlanning::getBrokerPro($bidPlanProInfo['proid'], Const_HzPlan::SPREAD_TYPE);
                                 if (isset($fixPlanProInfo[0]['is_valid']) && $fixPlanProInfo[0]['is_valid'] == Const_HzPlan::SPREAD) {
                                     $proStatus = Const_HzStatus::ONLINE; //推广
                                     //更新房源状态
                                     Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], $proStatus);
                                 }
                             }
         
                             //通知solr队列上
                             Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], $proStatus);
                             //记录房源日志
                             Model_Log_HouseLogNew::create(array(
                                 'houseId' => $bidPlanProInfo['proid'],
                                 'planId' => $bidPlanProInfo['plan_id'],
                                 'brokerId' => $broker['ajkBrokerid'],
                                 'cityId' => $bidPlanProInfo['city_id'],
                                 'type' => 13, //13-精选排队中,14-精选推广,15-取消精选推广,16-取消精选排队
                                 'changeType' => '40' . self::$qInfo['actionId'],
                                 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选排队中',
                                 'operatorId' => self::$qInfo['operationId'],
                                 'siteType' => 2,
                             ), date('Ymd'))->save();
         
                             $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为排队中';
                         }
                     }
                     */
     }
     if (empty($tmpRemark)) {
         $tmpRemark[] = '未找到需要变更的计划';
     }
     return $tmpRemark;
 }
예제 #20
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     if (!$hzBrokerId || !$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $broker['cityId'];
     if (!Bll_City::isBidCity($cityId)) {
         throw new Exception_City_NotBidCity('CityId: ' . $cityId);
     }
     // 获取房源信息
     $prop = Model_House_HzProp::findByPropId($propId);
     /* @var Model_House_HzProp $prop */
     if (!$prop) {
         throw new Exception_Property_NotFound("Zufang propId: {$propId}");
     }
     // TODO 是否需要判断房源是否已删除
     // 判断房源是否属于经纪人
     if ($prop->getContentBasic('userid') != $hzBrokerId) {
         throw new Exception_Property_NotFound("Zufang propId: {$propId} not belog to broker: {$brokerId}");
     }
     // 准备默认返回数据(房源未竞价)
     $data = array('planId' => 0, 'status' => 0, 'rank' => -1, 'rankMsg' => '已暂停', 'todayClicks' => 0, 'totalClicks' => 0, 'clickPrice' => 0, 'clickPriceUnit' => '元', 'minClickPrice' => $prop->getBidMinClickPrice(), 'minClickPriceUnit' => '元', 'budget' => 0, 'budgetUnit' => '元', 'budgetRemain' => 0, 'budgetRemainUnit' => '元');
     // 获取竞价计划
     $bidPlan = $prop->getBidPlan();
     if (!$bidPlan) {
         // 判断房源是否多图房源
         if (!$prop->isMultiImages()) {
             throw new Exception_Property_NotMultiImages("Zufang propId: {$propId}");
         }
         // TODO 判断是否定价推广(也许可以不用,因为只有从定价推广房源列表点进去的房源详情页才会请求该接口)
     } else {
         // 竞价计划ID
         $data['planId'] = $bidPlan['id'];
         // 竞价计划状态
         switch ($bidPlan['status']) {
             case Const_HzPlan::SPREAD:
                 $data['status'] = 1;
                 // 推广中 or 排队中
                 break;
             case Const_HzPlan::MENUOVER:
                 $data['status'] = 2;
                 // 已暂停
                 break;
         }
         // 竞价预算
         $data['budget'] = round($bidPlan['amount'], 2);
         // 竞价预算余额
         $data['budgetRemain'] = round($bidPlan['amount'] - $bidPlan['total_consume'], 2);
         // 竞价排名
         if ($data['status'] == 1) {
             $data['rank'] = Bll_HzBidPlan::get_bid_rank($prop->getContentBasic(), $cityId);
             if ($data['rank'] <= 5) {
                 $data['rankMsg'] = '';
             } else {
                 $data['rankMsg'] = '排队中';
             }
         }
         // 竞价点击单价
         $bidRelation = $prop->getBidRelation();
         $data['clickPrice'] = round($bidRelation['unit_price'], 2);
         // 竞价点击底价
         $data['minClickPrice'] = round($prop->getBidMinClickPrice(), 2);
         // 今日竞价点击量
         $data['todayClicks'] = $prop->getTodayClickSums('bid');
         // 竞价点击总量
         $data['totalClicks'] = $prop->getTotalClickSums('bid');
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
예제 #21
0
 public static function getBrokerMap($brokerId)
 {
     try {
         $brokerMap = Model_Broker_MainBusiness::data_access()->filter('ajkBrokerid', $brokerId)->get_row();
     } catch (Exception $e) {
         return array();
     }
     return $brokerMap;
 }