public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $per = isset($this->_params['per']) ? $this->_params['per'] : 20;
     $per = $per + 1;
     //判断是否有下一页
     $moreFlag = 1;
     //读取经纪人信息
     $BrokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     //城市是否开通房源库
     $cityInfo = Bll_Fyk_Prop_Manage::getInstance()->getCityConfig($BrokerInfo['BaseInfo']['CITYID']);
     if ($cityInfo) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'canGrabNum' => 0, 'msg' => '亲!房源已转至房源库,快去开通吧!', 'data' => array(), 'nextPage' => 0);
     }
     // 获取已推送委托
     $pushedCommissionHouses = Model_House_CommissionHousePushed::pushedCommissionHouses($brokerId, $per, $this->_params['maxId'], $this->_params['sinceId']);
     $countPushedCommissionHouses = count($pushedCommissionHouses);
     if ($countPushedCommissionHouses < $per) {
         $moreFlag = 0;
     } else {
         unset($pushedCommissionHouses[$countPushedCommissionHouses - 1]);
     }
     // 排序(按ID倒序)
     uasort($pushedCommissionHouses, function ($a, $b) {
         return $a['id'] < $b['id'];
     });
     // 获取房源数据
     $houses = array();
     $rushedHouses = array();
     if (!empty($pushedCommissionHouses)) {
         // 获取房源ID
         $houseIds = array();
         foreach ($pushedCommissionHouses as $pushedCommissionHouse) {
             $houseIds[] = $pushedCommissionHouse['propertyId'];
         }
         // 获取房源信息
         $houses = Model_House_CommissionHouse::getEntrustsPro($houseIds);
         $indexedHouses = array();
         foreach ($houses as $house) {
             $indexedHouses[$house['id']] = $house;
         }
         $houses = $indexedHouses;
         // 获取已抢房源数据
         $rushedCommissions = Model_House_Commission::getEntrustInfos($houseIds);
         foreach ($rushedCommissions as $rushedCommission) {
             if ($brokerId == $rushedCommission->brokerId) {
                 $rushedHouses[$rushedCommission->houseId] = $rushedCommission->id;
             }
         }
         // 是否存在实拍图片
         $imagesInfos = Model_Image_SaleEntrustImage::getImagesByProIds($houseIds);
         foreach ($imagesInfos as $imagesInfo) {
             $isImages[$imagesInfo->proId] = 1;
         }
     }
     // 拼装结果
     $data = array();
     $rushableCount = 0;
     foreach ($pushedCommissionHouses as $pushedCommissionHouse) {
         if (!isset($houses[$pushedCommissionHouse['propertyId']])) {
             continue;
         }
         $house = $houses[$pushedCommissionHouse['propertyId']];
         $row = array();
         $row['id'] = $pushedCommissionHouse['id'];
         $row['propertyId'] = $house['id'];
         $row['commName'] = $house['commName'];
         $row['ownerName'] = $house['userName'];
         if ($house->getPhone()) {
             $row['ownerPhone'] = substr_replace($house->getPhone(), '*****', 3, 5);
         } else {
             $row['ownerPhone'] = '';
         }
         $row['type'] = $house['commissionType'];
         $row['room'] = $house['roomNum'];
         $row['hall'] = $house['hallNum'];
         $row['toilet'] = $house['toiletNum'];
         $row['area'] = $house['areaNum'];
         $row['price'] = $house['proPrice'];
         switch ($house['commissionType']) {
             case Model_House_CommissionHouse::COMMISSION_TYPE_RENT:
                 $row['priceUnit'] = '元/月';
                 break;
             case Model_House_CommissionHouse::COMMISSION_TYPE_SALE:
                 $row['priceUnit'] = '万元';
                 break;
         }
         $row['publishTime'] = date('Y-m-d H:i:s', $house['created']);
         $row['rushable'] = 1;
         $row['showStatus'] = 4;
         $row['rushableInfo'] = '抢委托';
         $row['rushed'] = 0;
         if ($house['proStatus'] == Model_House_CommissionHouse::STATUS_ONGOING && $house['openBrokerCnt'] < Model_House_CommissionHouse::allowedMaxCommissionCount()) {
             $rushableCount++;
         }
         if (!($house['proStatus'] == Model_House_CommissionHouse::STATUS_ONGOING && $house['openBrokerCnt'] < Model_House_CommissionHouse::allowedMaxCommissionCount()) && empty($rushedHouses[$house['id']])) {
             $row['rushable'] = 0;
             $row['showStatus'] = 3;
             $row['rushableInfo'] = '抢完了';
         }
         if ($house['proStatus'] == Model_House_CommissionHouse::STATUS_STOP && $house['openBrokerCnt'] < Model_House_CommissionHouse::allowedMaxCommissionCount()) {
             $row['rushable'] = 0;
             $row['showStatus'] = 9;
             $row['rushableInfo'] = '房东停止委托';
         }
         if (isset($rushedHouses[$house['id']])) {
             $row['rushable'] = 0;
             $row['rushableInfo'] = '抢过了';
             $row['rushed'] = 1;
         }
         $row['isRealityPats'] = $isImages[$house['id']] ? 1 : 0;
         $row['timestate'] = Bll_Common_Format::formatTime($house['created']);
         //抢过不显示
         if (empty($rushedHouses[$house['id']])) {
             $data[] = $row;
         }
     }
     // 重置可抢房源数
     $daCommissionHousePushedCount = Model_House_CommissionHousePushedCount::data_access()->filter('brokerId', $brokerId)->find_only();
     if (!empty($daCommissionHousePushedCount)) {
         $daCommissionHousePushedCount->resetCommissionHousePushedCount();
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'canGrabNum' => $rushableCount, 'msg' => '仅展示15天以内房源', 'data' => $data, 'nextPage' => $moreFlag);
 }