Beispiel #1
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));
 }
 public function handle_request_internal()
 {
     if (Bll_Weshop::weshopPropsIsMaintain()) {
         return array('status' => 'error', 'message' => "系统维护中,请稍后再试!");
     }
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $commId = $this->_params['commId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //查找经纪人所有房源  过滤所有违规房源
     if ($commId) {
         $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $brokerInfo->cityId, array(), $commId);
     } else {
         $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $brokerInfo->cityId);
     }
     //获取经纪人已经导入的二手房房源id
     $EsPropIdWeshopPropIdTmp = Model_Weshop_PropsFilter::getPropIdAndWeshopPropIdByBroker($brokerId);
     //获取微店中已有房源的propid
     /*
     $weshopProps = Model_Weshop_Props::getWeshopPropsByBrokerId($brokerId);
     $weshopPropIds = array();
     if(!empty($weshopProps)) {
         foreach($weshopProps as $key => $value)
         {
             $weshopPropIds[]=$value->id;
         }
         $EsPropIdTmp = Model_Weshop_PropsFilter::getPropIdByWeshopPropId($weshopPropIds);
     }
     */
     $EsPropIdWeshopPropId = array();
     $EsPropId = array();
     if (!empty($EsPropIdWeshopPropIdTmp)) {
         foreach ($EsPropIdWeshopPropIdTmp as $k => $v) {
             if (!in_array($v['propId'], $EsPropId)) {
                 $EsPropId[] = $v['propId'];
                 $EsPropIdWeshopPropId[$v['propId']] = array();
             }
             array_push($EsPropIdWeshopPropId[$v['propId']], $v['weshopPropId']);
         }
     }
     //过滤违规房源和重复房源
     $areaAndBlockIds = array();
     $propIds = array();
     foreach ($tempHouseInfoList as $key => $houseInfo) {
         $illegal = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         if ($illegal == 0 && $houseInfo['ExpireWorker'] != 'propertyReport') {
             unset($tempHouseInfoList[$key]);
             continue;
         }
         //过滤重复房源
         if (in_array($houseInfo['proId'], $EsPropId)) {
             $data = Model_Weshop_Props::getWeshopProp($EsPropIdWeshopPropId[$houseInfo['proId']]);
             if (!empty($data)) {
                 unset($tempHouseInfoList[$key]);
                 continue;
             }
         }
         $areaAndBlockIds[] = substr($houseInfo['areaCode'], 0, 8);
         $areaAndBlockIds[] = $houseInfo['areaCode'];
         $propIds[] = $houseInfo['proId'];
     }
     //批量获取区域板块信息
     $commTypeInfos = Bll_Community_CommunityGardener::getCommTypeInfo($areaAndBlockIds);
     //批量获取默认图片
     $propDefImages = Model_House_AjkPropertyData::getDafImages($propIds);
     //批量获取房源描述信息 ajk_propertysale
     $houseExtInfo = Model_House_PropertySale::getPropertySaleInfos($propIds);
     $propList = array();
     foreach ($tempHouseInfoList as $house) {
         $row = array();
         $row['propId'] = $house['proId'];
         $row['title'] = $house['proName'];
         $row['commId'] = $house['commId'];
         $row['commName'] = $house['commName'];
         $areaId = substr($house['areaCode'], 0, 8);
         $blockId = $house['areaCode'];
         $row['areaName'] = $commTypeInfos[$areaId];
         $row['blockName'] = $commTypeInfos[$blockId];
         $row['room'] = $house['roomNum'];
         $row['hall'] = $house['hallNum'];
         $row['toilet'] = $house['toiletNum'];
         $row['area'] = round($house['areaNum']);
         $row['areaUnit'] = '平米';
         $row['price'] = intval($house['proPrice']);
         $row['priceUnit'] = '万';
         //房源描述
         $propDescription = $houseExtInfo[$row['propId']]['addExplan'];
         $propDescription = str_replace('<p>', "", $propDescription);
         $propDescription = str_replace('</p>', "", $propDescription);
         $propDescription = trim($propDescription);
         $row['propDescription'] = $propDescription;
         $row['imageUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$house['proId']]);
         $row['previewUrl'] = Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $row['propId']));
         $propList[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propList' => $propList));
 }
Beispiel #3
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));
     }
 }
 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));
 }