Пример #1
0
 public function handle_request_internal()
 {
     $brokerIds = explode(',', $this->_params['brokerIds']);
     $cityId = $this->_params['cityId'];
     $renovateTime = $this->_params['renovateTime'];
     //某时间以后创建的房源数量
     $isComboCity = Bll_City::isComboCity($cityId);
     $propIds = array();
     if ($isComboCity) {
         //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId);
         $propIds = array_keys($comboSpreadHouseList);
     } else {
         //如果是定价城市 获取经纪人定价计划--获取有效计划房源关系
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerIds);
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanIds = array_keys($fixSpreadPlanList);
         //获取有效计划房源关系
         $relations = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerIds, $cityId, $fixSpreadPlanIds);
         foreach ($relations as $relation) {
             $propIds[] = $relation['propId'];
         }
     }
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfoByGetAll($propIds, $cityId, array(), '', '', $renovateTime);
     $brokerNewPropNum = count($propsInfos);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerNewPropNum' => $brokerNewPropNum));
 }
Пример #2
0
 public function handle_request_combo()
 {
     $ajkBrokerId = $this->brokerId;
     $cityId = $this->cityId;
     //套餐信息
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($ajkBrokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         //获取当前使用的套餐
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'];
     $currentComboName = $currentCombo['name'];
     //二手房套餐列表
     $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($ajkBrokerId, $cityId);
     $comboEsfPropIds = array_keys($comboEsfList);
     //租房套餐列表
     $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $comboZuFangPropIds = array();
     foreach ($comboZuFangList as $v) {
         $comboZuFangPropIds[] = (int) $v['houseId'];
     }
     $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds);
     $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : 1;
     $propId = $this->_params['propId'];
     $comboInfo = Bll_Combo_HouseRelation::getHouseRelation($ajkBrokerId, $cityId, $propId, Bll_Combo_HouseRelation::SITE_TYPE_HZ);
     if (!empty($comboInfo) && $comboInfo[0]['state'] > 100 & $comboInfo[0]['state'] < 200) {
         //推广中
         $status = 2;
         $statusMsg = '套餐推广中';
         $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})";
     } else {
         $comboInfos = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($ajkBrokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ);
         if (empty($comboInfos)) {
             $status = 0;
             $statusMsg = '尚未购买套餐,请购买套餐';
             $currentComboInfo = '尚未购买套餐';
         } else {
             $status = 1;
             $statusMsg = '好房源,不推广就浪费了~';
             $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})";
         }
     }
     $startDate = $endDate = date('Ymd');
     $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propId, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ);
     $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($ajkBrokerId, $propId, $cityId);
     $todayClick = $todayClicks[$propId][$startDate] ?: 0;
     $totalClick = $totalClicks[$propId] ?: 0;
     $totalClick += $todayClick;
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClick, 'totalClicks' => $totalClick, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo));
 }
Пример #3
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //获取经纪人套餐推广今日点击量
     $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK);
     //经纪人没有套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => 0));
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     if ($propIds) {
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
         $propsNum = count($propsInfo);
     } else {
         $propsNum = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => $propsNum));
 }
Пример #4
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $propId = $this->_params['propId'];
     //好丑陋。。。。。。好无奈。。。。。。
     //委托房源自动转发停用,为了app能够展示报错信息。。。
     if (empty($propId)) {
         $this->_params['apiDebug'] = 1;
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布');
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     $cityId = $brokerInfo->cityId;
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 0, 'statusMsg' => '尚未购买套餐,请购买套餐', 'currentComboInfo' => '尚未购买套餐'));
     }
     $currentComboName = $currentCombo['name'];
     $currentComboUsed = 0;
     $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'];
     //二手房套餐列表
     $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     $comboEsfPropIds = array_keys($comboEsfList);
     //租房套餐列表
     $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $comboZuFangPropIds = array();
     foreach ($comboZuFangList as $v) {
         $comboZuFangPropIds[] = (int) $v['houseId'];
     }
     $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds);
     $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : (!$currentCombo['openUp'] && !$currentCombo['salePropNum'] ? 0 : 1);
     if (in_array($propId, array_merge($comboEsfPropIds, $comboZuFangPropIds))) {
         $status = 2;
         $statusMsg = '套餐推广中';
     } else {
         $status = 1;
         $statusMsg = '好房源,不推广就浪费了~';
     }
     //房源今日点击  房源总点击
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propId);
     $todayClicks = $houseTodayClickInfo[$propId];
     //房源总点击
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propId, $cityId);
     $totalClicks = $todayClicks + $houseClickInfo[$propId];
     $currentComboInfo = isset($currentCombo) ? $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})" : '尚未购买套餐';
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'totalClicks' => $totalClicks, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo));
 }
Пример #5
0
 /**
  * app 获取可竞价列表
  */
 public static function get_combo_canbid_props($broker_id, $city_id)
 {
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($broker_id, $city_id);
     $comboPropIds = array_keys($comboSpreadHouseList);
     if (empty($comboPropIds)) {
         return array();
     }
     //竞价房源
     $bidProps = static::gitBidProps($broker_id);
     $bidPropIds = array_keys($bidProps);
     foreach ($comboPropIds as $key => $propId) {
         if (in_array($propId, $bidPropIds)) {
             unset($comboPropIds[$key]);
         }
     }
     if (!empty($comboPropIds)) {
         $props = Bll_House_EsfHouse::getHouseBaseInfo($comboPropIds, $city_id);
         return $props;
     }
     return array();
 }
Пример #6
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             $comboPropNum = $currentCombo['salePropNum'];
             if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
                 $comboPropNum = $currentCombo['rentPropNum'] + $currentCombo['salePropNum'];
             }
             break;
         }
     }
     $hasCombo = 0;
     //没有二手房套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => 0, 'hasCombo' => $hasCombo));
     } else {
         $hasCombo = 1;
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK, true);
     } else {
         $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK);
     }
     //套餐还可以推的房源数量
     $surplus = $comboPropNum - $currentSpreadHouseCount;
     if (empty($comboSpreadHouseList)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => $surplus, 'hasCombo' => $hasCombo));
     }
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
     //批量获取默认图片
     $propDefImages = Model_House_AjkPropertyData::getDafImages($propIds);
     //批量获取房源总点
     $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propIds);
     $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propIds, $cityId);
     //房源竞价&精选计划
     $propSpreadInfo = Model_Plan_EsfAjkPropSpread::getPlanByPropIds($propIds);
     //拼接房源列表中房源数据
     $newList = array();
     $oldList = array();
     foreach ($propsInfo as $prop) {
         $row = array();
         $row['propId'] = $prop->proId;
         $row['title'] = $prop->proName;
         $row['commId'] = $prop->commId;
         $row['commName'] = $prop->commName;
         $row['roomNum'] = $prop->roomNum;
         $row['hallNum'] = $prop->hallNum;
         $row['area'] = round($prop->areaNum);
         $row['toiletNum'] = $prop->toiletNum;
         $row['price'] = intval($prop->proPrice);
         $row['priceUnit'] = '万';
         $row['isBid'] = 0;
         $row['isChoice'] = 0;
         $row['isMoreImg'] = $prop->isHighQulity;
         $row['isPhonePub'] = $prop->uriCode == 'mobile.asyn' || $prop->uriCode == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $row['isVisible'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         //0-违规房源 1-非违规房源
         $row['createTime'] = $prop->postDate;
         //房源发布时间
         $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$prop->proId]);
         if ($prop->commitionType == 2) {
             $row['isEntrust'] = 1;
         } else {
             $row['isEntrust'] = 0;
         }
         $row['totalClicks'] = $houseTodayClickInfo[$prop->proId] + $houseClickInfo[$prop->proId];
         if (isset($propSpreadInfo[$prop->proId])) {
             if ($propSpreadInfo[$prop->proId]->bidVersion == 1 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isBid'] = 1;
             } elseif ($propSpreadInfo[$prop->proId]->bidVersion == 2 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) {
                 $row['isChoice'] = 1;
             }
         }
         //计算出房源发布天数
         $timeFixStr = strtotime(date("Ymd", $row['createTime']));
         $leftDay = floor((time() - $timeFixStr) / 86400);
         if ($leftDay >= 30) {
             $oldList[] = $row;
         } else {
             $newList[] = $row;
         }
     }
     // 排序
     usort($oldList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     usort($newList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus > 0 ? $surplus : 0, 'hasCombo' => $hasCombo));
 }
Пример #7
0
 function getComboPropsInOneComm($brokerId, $cityId, $commId = '')
 {
     $base_domain = APF::get_instance()->get_config('base_domain');
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     if (empty($comboSpreadHouseList)) {
         return array();
     } else {
         //获取房源信息
         $propIds = array_keys($comboSpreadHouseList);
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
     }
     //房源计划形态(是精选还是竞价)
     $spreads = array();
     if ($propIds) {
         $spreads = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propIds);
     }
     if (!empty($spreads)) {
         foreach ($spreads as $row) {
             $spreadArr[$row['propId']]['bidVersion'] = $row['bidVersion'];
             $spreadArr[$row['propId']]['status'] = $row['status'];
         }
     }
     foreach ($propsInfo as $propArr) {
         $propId = $propArr['proId'];
         $commProps[$propArr['commId']][$propId]['id'] = $propId;
         $commProps[$propArr['commId']][$propId]['title'] = $propArr['proName'];
         $commProps[$propArr['commId']][$propId]['commId'] = $propArr['commId'];
         $commProps[$propArr['commId']][$propId]['commName'] = $propArr['commName'];
         $commProps[$propArr['commId']][$propId]['roomNum'] = $propArr['roomNum'];
         $commProps[$propArr['commId']][$propId]['hallNum'] = $propArr['hallNum'];
         $commProps[$propArr['commId']][$propId]['toiletNum'] = $propArr['toiletNum'];
         $commProps[$propArr['commId']][$propId]['area'] = $propArr['areaNum'];
         $commProps[$propArr['commId']][$propId]['price'] = $propArr['proPrice'];
         $commProps[$propArr['commId']][$propId]['priceUnit'] = '万';
         $commProps[$propArr['commId']][$propId]['isVisible'] = $propArr['isVisible'];
         $commProps[$propArr['commId']][$propId]['imgUrl'] = 'http://pages.anjukestatic.com/img/global/nopic_100x75.gif';
         $commProps[$propArr['commId']][$propId]['isMoreImg'] = $propArr['isHighQulity'] ? 1 : 0;
         $commProps[$propArr['commId']][$propId]['isPhonePub'] = $propArr['uriCode'] == 'mobile.asyn' || $propArr['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $commProps[$propArr['commId']][$propId]['propUrl'] = 'http://' . $base_domain . '/web/sale/x/' . $propArr['cityId'] . '/' . $propId;
         $commProps[$propArr['commId']][$propId]['createTime'] = date('Y-m-d H:i:s', $propArr['postDate']);
         $commProps[$propArr['commId']][$propId]['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0;
         $commProps[$propArr['commId']][$propId]['isBid'] = $commProps[$propArr['commId']][$propId]['isChoice'] = 0;
         if (isset($spreadArr) && isset($spreadArr[$propId])) {
             if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) {
                 $commProps[$propArr['commId']][$propId]['isBid'] = 1;
             } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) {
                 $commProps[$propArr['commId']][$propId]['isChoice'] = 1;
             }
         }
         $imgBll = Bll_Image_EsfHouseImage::getInstance();
         $commProps[$propArr['commId']][$propId]['imgUrl'] = $imgBll->getThumbImageUrl($propId, $propArr['commId']);
     }
     $return = $commProps;
     if ($commId) {
         $ret['status'] = 'ok';
         $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array();
     } else {
         $ret = $return;
     }
     return $ret;
 }
Пример #8
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     $props = Bll_BrokerInfoApp::get_outline_prop($brokerId, $cityId);
     $return = array();
     $return['status'] = 'ok';
     $return['data']['propertyList'] = array();
     //APP套餐城市调错API了 需要做一下套餐城市的兼容处理
     $isComboBroker = Bll_Broker_HzBroker::isComboBroker($brokerId);
     if (!$isComboBroker) {
         if (!empty($props)) {
             $propRow = array();
             foreach ($props as $propertyList) {
                 $propRow['propId'] = $propRow['id'] = $propertyList['ProId'];
                 $propRow['title'] = $propertyList['ProName'];
                 $propRow['commId'] = $propertyList['CommId'];
                 $propRow['commName'] = $propertyList['CommName'];
                 $propRow['roomNum'] = $propertyList['RoomNum'];
                 $propRow['hallNum'] = $propertyList['HallNum'];
                 $propRow['toiletNum'] = $propertyList['ToiletNum'];
                 $propRow['area'] = round($propertyList['AreaNum']);
                 $propRow['price'] = is_float($propertyList['ProPrice']) ? round($propertyList['ProPrice'], 1) : $propertyList['ProPrice'];
                 $propRow['priceUnit'] = '万';
                 $propRow['isMoreImg'] = $propertyList['IsHighQulity'];
                 $propRow['isVisible'] = $propertyList['IsVisible'];
                 $propRow['isPhonePub'] = $propertyList['UriCode'] == 'mobile.asyn' || $propertyList['UriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
                 $propRow['createTime'] = date('Y-m-d H:i:s', $propertyList['PostDate']);
                 $imgBll = Bll_Image_EsfHouseImage::getInstance();
                 $propRow['imgUrl'] = $imgBll->getThumbImageUrl($propertyList['ProId'], $propertyList['commId']);
                 //增加委托房源标签
                 if ($propertyList['CommitionType'] == 2) {
                     $propRow['isEntrust'] = 1;
                 } else {
                     $propRow['isEntrust'] = 0;
                 }
                 $return['data']['propertyList'][] = $propRow;
                 unset($propRow);
             }
         }
         return $return;
     } else {
         $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
         if (!$brokerInfo) {
             throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
         }
         //获取套餐推广信息
         $cityId = $brokerInfo->cityId;
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
         $comboSpreadHouseIds = array_keys($comboSpreadHouseList);
         //获取经纪人所有房源信息
         $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId);
         if (empty($tempHouseInfoList)) {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array()));
         }
         //未推广房源列表
         $tempNoSpreadHouseList = array();
         $noSpreadHouseIds = array();
         foreach ($tempHouseInfoList as $houseInfo) {
             if (!in_array($houseInfo['proId'], $comboSpreadHouseIds)) {
                 $houseInfo['illegal'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
                 //0-违规房源 1-非违规房源
                 $tempNoSpreadHouseList[$houseInfo['proId']] = $houseInfo;
                 $noSpreadHouseIds[] = $houseInfo['proId'];
             }
         }
         /** 过滤违规房源 */
         $tmpIllegalList = array();
         if (!$noSpreadHouseIds) {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array()));
         }
         foreach ($tempNoSpreadHouseList as $propId => $houseInfo) {
             if ($houseInfo['illegal'] == 0 && $houseInfo['expireWorker'] != 'propertyReport') {
                 $tmpIllegalList[$propId] = $houseInfo;
                 unset($tempNoSpreadHouseList[$propId]);
             }
         }
         //违规房源排在前面
         $noSpreadHouseList = array_merge($tmpIllegalList, $tempNoSpreadHouseList);
         $propDefImages = Model_House_AjkPropertyData::getDafImages($noSpreadHouseIds);
         $propertyList = array();
         foreach ($noSpreadHouseList as $houseInfo) {
             $row = array();
             $row['propId'] = $houseInfo['proId'];
             $row['title'] = $houseInfo['proName'];
             $row['commId'] = $houseInfo['commId'];
             $row['commName'] = $houseInfo['commName'];
             $row['roomNum'] = $houseInfo['roomNum'];
             $row['hallNum'] = $houseInfo['hallNum'];
             $row['area'] = round($houseInfo['areaNum']);
             $row['toiletNum'] = $houseInfo['toiletNum'];
             $row['price'] = intval($houseInfo['proPrice']);
             $row['priceUnit'] = '万';
             $row['isBid'] = 0;
             $row['isChoice'] = 0;
             $row['isMoreImg'] = $houseInfo['isHighQulity'];
             $row['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
             $row['isVisible'] = $houseInfo['illegal'];
             //0-违规房源 1-非违规房源
             $row['createTime'] = $houseInfo['postDate'];
             //房源发布时间
             $row['imgUrl'] = $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$houseInfo['proId']]);
             //print_r($houseInfo['commitionType']);exit;
             $row['isEntrust'] = $houseInfo['commitionType'] == 2 ? 1 : 0;
             $propertyList[] = $row;
         }
         //排序
         usort($propertyList, function ($a, $b) {
             if ($a['createTime'] == $b['createTime']) {
                 return 0;
             }
             return $a['createTime'] > $b['createTime'] ? -1 : 1;
         });
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList));
     }
 }
Пример #9
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     //获取套餐推广信息
     $cityId = $brokerInfo->cityId;
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     $comboSpreadHouseIds = array_keys($comboSpreadHouseList);
     //获取精选推广信息
     $bll = new BLL_Choice_EsfAPPAPIChoice();
     $choiceHouseList = $bll->getBrokerPropChoiceInfo($brokerId);
     $choiceHouseIds = array();
     foreach ($choiceHouseList as $list) {
         foreach ($list as $v) {
             $choiceHouseIds[] = $v['propId'];
         }
     }
     //获取经纪人所有房源信息
     $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId);
     if (empty($tempHouseInfoList)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array()));
     }
     //未推广房源列表
     $tempNoSpreadHouseList = array();
     $noSpreadHouseIds = array();
     foreach ($tempHouseInfoList as $houseInfo) {
         if (!in_array($houseInfo['proId'], $comboSpreadHouseIds) && !in_array($houseInfo['proId'], $choiceHouseIds)) {
             $houseInfo['illegal'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
             //0-违规房源 1-非违规房源
             $tempNoSpreadHouseList[$houseInfo['proId']] = $houseInfo;
             $noSpreadHouseIds[] = $houseInfo['proId'];
         }
     }
     // 获取城市价格段信息
     $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE);
     /** 过滤违规房源 */
     $tmpIllegalList = array();
     if (!$noSpreadHouseIds) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array()));
     }
     foreach ($tempNoSpreadHouseList as $propId => $houseInfo) {
         if ($houseInfo['illegal'] == 0 && $houseInfo['expireWorker'] != 'propertyReport') {
             $tmpIllegalList[$propId] = $houseInfo;
             unset($tempNoSpreadHouseList[$propId]);
         }
     }
     //是否是精选城市,是否精选分离
     $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE);
     $cityIsChoiceIndependent = Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE);
     //违规房源排在前面
     $noSpreadHouseList = array_merge($tmpIllegalList, $tempNoSpreadHouseList);
     $propDefImages = Model_House_AjkPropertyData::getDafImages($noSpreadHouseIds);
     $propertyList = array();
     foreach ($noSpreadHouseList as $houseInfo) {
         $row = array();
         $row['propId'] = $houseInfo['proId'];
         $row['title'] = $houseInfo['proName'];
         $row['commId'] = $houseInfo['commId'];
         $row['commName'] = $houseInfo['commName'];
         $row['roomNum'] = $houseInfo['roomNum'];
         $row['hallNum'] = $houseInfo['hallNum'];
         $row['area'] = round($houseInfo['areaNum']);
         $row['toiletNum'] = $houseInfo['toiletNum'];
         $row['price'] = intval($houseInfo['proPrice']);
         $row['priceUnit'] = '万';
         $row['isBid'] = 0;
         $row['isChoice'] = 0;
         $row['isMoreImg'] = $houseInfo['isHighQulity'];
         $row['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
         $row['isVisible'] = $houseInfo['illegal'];
         //0-违规房源 1-非违规房源
         $row['createTime'] = $houseInfo['postDate'];
         //房源发布时间
         $row['imgUrl'] = $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$houseInfo['proId']]);
         if ($houseInfo['commitionType'] == 2) {
             $row['isEntrust'] = 1;
         } else {
             $row['isEntrust'] = 0;
         }
         //精选状态: 可精选;可排队;精选中;排队中
         $choiceStatusRecommend = Bll_House_EsfHouse::getEsfChoiceStatusAndRecommend($priceSegmentList, array(), $houseInfo, $cityIsChoice, $cityIsChoiceIndependent);
         $row['choiceStatus'] = $choiceStatusRecommend['choiceStatus'];
         $row['choiceStatusName'] = $choiceStatusRecommend['choiceStatusName'];
         $row['choiceRecommend'] = $choiceStatusRecommend['choiceRecommend'];
         $propertyList[] = $row;
     }
     //排序
     usort($propertyList, function ($a, $b) {
         if ($a['createTime'] == $b['createTime']) {
             return 0;
         }
         return $a['createTime'] > $b['createTime'] ? -1 : 1;
     });
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList));
 }
Пример #10
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $communityList = array();
     $cityId = $brokerInfo->cityId;
     $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId);
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         /** 租房 */
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         //套餐列表
         $propIds = array();
         foreach ($comboList as $combo) {
             $propIds[] = $combo['houseId'];
         }
         if ($propIds && $hzBrokerId) {
             $hzPropList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $cityId);
             //房源信息
             foreach ($hzPropList as $list) {
                 //过滤无效房源
                 if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
                     continue;
                 }
                 $row = array();
                 $row['commId'] = $list['commid'];
                 $row['commName'] = $list['commname'];
                 $communityList[$list['commid']] = $row;
             }
         }
         /** 二手房 */
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
         if ($comboSpreadHouseList) {
             //获取房源信息
             $propIds = array_keys($comboSpreadHouseList);
             $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
             foreach ($propsInfo as $prop) {
                 $row = array();
                 $row['commId'] = $prop->commId;
                 $row['commName'] = $prop->commName;
                 $communityList[$prop->commId] = $row;
             }
         }
     } else {
         //定价的情况
         $brokerProps = Bll_Broker_HzBroker::getBrokerProps($brokerId, $cityId);
         // 获取房源关系列表
         if ($brokerProps['status']) {
             /** 租房*/
             $brokerProps = $brokerProps['msg'];
             $plans = $brokerProps['plans'][0];
             //定价计划
             $plannings = $brokerProps['plannings'];
             //计划房源关系
             $propsTemp = $brokerProps['props'];
             //定价房源
             if (empty($plans)) {
                 $hzPropList = array();
             } else {
                 $hzPropList = array();
                 foreach ($propsTemp as $prop) {
                     $hzPropList[$prop['proId']] = $prop;
                 }
                 foreach ($plannings as $key => $planning) {
                     // 非有效 过滤掉
                     if (!Bll_HzFixPlan::isValidPlanning($planning['isValid'])) {
                         unset($hzPropList[$planning['proId']]);
                     }
                 }
             }
             foreach ($hzPropList as $prop) {
                 $row = array();
                 $row['commId'] = $prop['commId'];
                 $row['commName'] = $prop['commName'];
                 $communityList[$prop['commId']] = $row;
             }
         }
         /** 二手房*/
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId);
         $fixPlanId = $fixSpreadPlanList[0]['id'];
         //关系表中获取房源;
         if ($fixPlanId) {
             $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($fixPlanId, $cityId);
             $propIds = array();
             foreach ($relations as $relation) {
                 $propIds[] = $relation['proId'];
             }
             if ($propIds) {
                 $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
                 foreach ($propsInfo as $prop) {
                     $row = array();
                     $row['commId'] = $prop->commId;
                     $row['commName'] = $prop->commName;
                     $communityList[$prop->commId] = $row;
                 }
             }
         }
     }
     //对小区按首字母排序
     $communityList = $this->communitySortByCommCode($communityList);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('communityList' => array_values($communityList)));
 }
Пример #11
0
 public function handle_request_internal()
 {
     $brokerIds = explode(',', $this->_params['brokerIds']);
     $cityId = $this->_params['cityId'];
     $sinceId = isset($this->_params['sinceId']) ? intval($this->_params['sinceId']) : 0;
     //从$sinceId 行开始读
     $per = isset($this->_params['per']) ? $this->_params['per'] : 10;
     //每页示的条数
     //二手房 房源表查找房源信息 找出所有的 propIds
     $isComboCity = Bll_City::isComboCity($cityId);
     $propIds = array();
     if ($isComboCity) {
         //如果是套餐城市 套餐房源表中 批量获取经纪人在线房源
         $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerIds, $cityId);
         $propIds = array_keys($comboSpreadHouseList);
         $status = 2;
         //2 套餐 1 定价
     } else {
         //如果是定价城市 获取经纪人定价计划--获取有效计划房源关系
         $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerIds);
         //获取经纪人有效定价计划  计划表
         $fixSpreadPlanIds = array_keys($fixSpreadPlanList);
         //获取有效计划房源关系
         $relations = Bll_Plan_Fix_AjkPlan::getPropFixedPlanRelation($brokerIds, $cityId, $fixSpreadPlanIds);
         foreach ($relations as $relation) {
             $propIds[] = $relation['propId'];
         }
         $status = 1;
     }
     //获取房源信息  分页
     $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array(), $per + 1, $sinceId);
     //板块信息
     $blockCode = array();
     foreach ($propsInfos as $propsInfoVal) {
         $blockCode[] = substr($propsInfoVal['areaCode'], 8, 4);
     }
     $blockInfos = Bll_Community_CommunityGardener::getAreaBlock($blockCode);
     $hasNextPage = 0;
     //是否有下一页
     $brokerProps = array();
     if (!empty($propsInfos)) {
         $hasNextPage = count($propsInfos) > $per ? 1 : 0;
     }
     if ($hasNextPage) {
         array_pop($propsInfos);
         $sinceId += $per;
     } else {
         $sinceId = 0;
     }
     foreach ($propsInfos as $propsInfo) {
         $row = array();
         $row['brokerId'] = $propsInfo['brokerId'];
         $row['propId'] = $propsInfo['proId'];
         $row['cityId'] = $propsInfo['cityId'];
         $row['title'] = $propsInfo['proName'];
         $row['commId'] = $propsInfo['commId'];
         $row['commName'] = $propsInfo['commName'];
         $row['areaCode'] = $propsInfo['areaCode'];
         $row['blockName'] = $blockInfos[$row['areaCode']];
         $row['createTime'] = date("Y-m-d H:i:s", $propsInfo['postDate']);
         $row['room'] = $propsInfo['roomNum'];
         $row['hall'] = $propsInfo['hallNum'];
         $row['toilet'] = $propsInfo['toiletNum'];
         $row['area'] = $propsInfo['areaNum'];
         $row['areaUnit'] = '平米';
         $row['price'] = intval($propsInfo['proPrice']);
         $row['priceUnit'] = '万';
         //获取房源图片
         $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($propsInfo['proId']);
         $houseImageBaseInfos = $houseImageInfo['imageBaseInfo'];
         $houseImageUrls = array();
         if ($houseImageBaseInfos) {
             foreach ($houseImageBaseInfos as $imageInfo) {
                 $houseImageUrls[] = Util_Image::getInstance()->getResizeURL($imageInfo['FILENAME'], $imageInfo['HOST_ID'], 420, 315);
             }
         }
         $row['imageUrls'] = $houseImageUrls;
         $row['status'] = $status;
         $brokerProps[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerProps' => $brokerProps, 'hasNextPage' => $hasNextPage, 'sinceId' => $sinceId));
 }