public function handle_request_internal() { $propIds = explode(',', $this->_params['propIds']); $cityId = $this->_params['cityId']; //获取房源信息 $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); //板块信息 $blockCode = array(); $brokerIds = array(); foreach ($propsInfos as $propsInfoVal) { $blockCode[] = substr($propsInfoVal['areaCode'], 8, 4); $brokerIds[] = $propsInfoVal['brokerId']; } $blockInfos = Bll_Community_CommunityGardener::getAreaBlock($blockCode); //获取经纪人微聊信息 $chatInfos = Model_Mobile_BrokerChatInfo::getBrokerChatInfos($brokerIds); $propList = array(); foreach ($propsInfos as $propsInfo) { $row = array(); $row['brokerId'] = $propsInfo['brokerId']; $row['chatId'] = $chatInfos[$row['brokerId']]['chatId']; $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; $propList[] = $row; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('props' => $propList)); }
public function handle_request_internal() { if (!Bll_City::isNewCommunityApplyCity(static::$intBrokerCityID)) { $this->redirect('/ajkbroker/broker/gardener/?from=illegal_request'); } $params = $this->getParameters(); $page = isset($params['p']) ? max(1, $params['p']) : 1; $applyCount = Bll_Community_CommunityGardener::getBrokerApplyCount(static::$intBrokerID); $applyCommunityGardenerAd = Bll_Community_CommunityGardener::getCommunityGardenerHistoryApplyBannerAdInfo(static::$intBrokerCityID); if (!empty($applyCommunityGardenerAd)) { $this->setAttribute('applyCommunityGardenerAd', $applyCommunityGardenerAd[0]); } /** 如果没有申请记录则直接返回 */ if ($applyCount == 0) { $this->setAttribute('applyCount', 0); $this->setAttribute('multipageShow', false); //是否显示分页 $this->setAttribute('applyInfoList', array()); $this->setAttribute('commInfos', array()); return 'Broker_CommunityNewGardeners2'; } if ($applyCount <= self::PAGE_SIZE) { $page = 1; } /** 如果当前页面大于最大页面则直接跳转到第一页去 */ if ($page > ceil($applyCount / self::PAGE_SIZE)) { $redirectUrl = $this->getURLPrefix(); $this->redirect($redirectUrl . 'from=error_page_number'); exit; } $applyHistory = Bll_Community_CommunityGardener::getBrokerApplyHistory(static::$intBrokerID, $page, self::PAGE_SIZE); $failApplyIds = $this->initializationCommunityApplyInfo($applyHistory); // $applyFailReason = Bll_Community_CommunityGardener::getApplyFailReasonEx($failApplyIds); $communityIds = $this->getCommunityIdFromApplyInfo($applyHistory); $communityInfo = Bll_Community_CommunityGardener::getMultiCommunityInfoByCommunityId($communityIds, array('commId', 'commName')); $multiPageShow = false; if ($applyCount > self::PAGE_SIZE) { $multiPage = $this->getMultiPage(array('p' => $page), $applyCount, self::PAGE_COUNT, self::PAGE_SIZE); $multiPageShow = true; $this->setAttribute("multipage", $multiPage); } $this->setAttribute('applyCount', $applyCount); $this->setAttribute('multipageShow', $multiPageShow); $this->setAttribute('applyInfoList', $applyHistory); // $this->setAttribute('applyFailReason', $applyFailReason); $this->setAttribute('commInfo', $communityInfo); return 'Broker_CommunityNewGardeners2'; }
public function handle_request_abs() { $params = $this->getParameters(); $action = $params[self::ACTION]; if ($this->communityImageCount <= 0) { $this->setAttribute('isOk', 1); return 'Community_Gardener_PhotoCommitOk'; } $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($this->communityId, static::$intBrokerID); $history = array(); if (!empty($applyHistory['applyData'])) { $history = json_decode($applyHistory['applyData'], true); } if ($action == 'save') { $image = array(); foreach ($params as $key => $val) { $kName = explode('_', $key); if (isset($kName[1]) && in_array($kName[0], array('host', 'hash', 'content'))) { if ($kName[0] == 'content') { $val = Util_PublicMethods::cutStr($val, 50); } $image[$kName[1]][$kName[0]] = $val; } else { continue; } } if ($image && count($image) >= $this->communityImageCount) { $history['images'] = array_values($image); Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($this->communityId, static::$intBrokerID, $this->communityInfo['baseInfo']['cityId'], $history, Model_Community_GardenerApply::APPLY_STATUS_NOT_COMPLETE); if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) { $this->setAttribute('isOk', 1); } else { $this->setAttribute('isOk', 2); } } else { $this->setAttribute('isOk', 2); } return 'Community_Gardener_PhotoCommitOk'; } $hasCorrectPhoto = !empty($history['images']); $this->setAttribute('hasCorrectPhoto', $hasCorrectPhoto); $this->setAttribute('brokerId', static::$intBrokerID); return 'Community_Gardener_PhotoCommit'; }
public function handle_request_internal() { if (!Bll_City::isNewCommunityApplyCity(static::$intBrokerCityID)) { $this->redirect2Result(false, '非法请求', __LINE__); } $request = APF::get_instance()->get_request(); $params = $this->getParameters(); $verifyCode = $params[self::VERIFY]; $matches = $request->get_router_matches(); $communityId = intval($matches[1]); $brokerId = static::$intBrokerID; if ($verifyCode != Bll_Community_CommunityGardener::getVerifyCode($communityId, $brokerId)) { $this->redirect2Result(false, '请求不合法', __LINE__); } $communityInfo = Bll_Community_CommunityGardener::getCommunityDetail($communityId); if ($communityInfo['baseInfo']['typeFlag'] == 0) { $this->redirect2Result(false, '小区不存在', __LINE__); } if (!Bll_Community_CommunityGardener::checkCommunityCanApply($communityId, $brokerId, true)) { $this->redirect2Result(false, '小区不可以申请', __LINE__); } $communityGardenerApplyState = Bll_Community_CommunityGardener::getCommunityGardenerState($communityId); if (empty($communityGardenerApplyState)) { if (!Bll_Community_CommunityGardener::initCommunityGardenerState($communityId, $brokerId)) { $this->redirect2Result(false, '初始化小区状态失败', __LINE__); } } elseif ($communityGardenerApplyState['state'] == Model_Community_CommunityState::COMMUNITY_STATE_CHECKING) { $this->redirect2Result(false, '审核中的小区不允许申请', __LINE__); } elseif ($communityGardenerApplyState['state'] == Model_Community_CommunityState::COMMUNITY_STATE_APPLYING) { //状态为锁定 if ($communityGardenerApplyState['applyExpirationTime'] < time()) { //锁定时间过期 //重新锁定 if (!Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId)) { $this->redirect2Result(false, '锁定小区申请状态失败', __LINE__); } } else { //锁定时间未过期 //别人不能申请 if ($communityGardenerApplyState['applyBrokerId'] != $brokerId) { $this->redirect2Result(false, '小区正在被申请', __LINE__); } } } else { if (!Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId)) { $this->redirect2Result(false, '锁定小区申请状态失败', __LINE__); } } $action = $params[self::ACTION]; $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($communityId, $brokerId); $history = array(); if (!empty($applyHistory) && !empty($applyHistory['applyData'])) { $history = json_decode($applyHistory['applyData'], true); } // $communityImageList = Bll_Community_CommunityGardener::getValidateCommunityImagesList($communityId); // $communityImageCount = count($communityImageList); // $brokerShouldUploadPhotoCount = max(0, Bll_Community_CommunityGardener::COMMUNITY_IMAGE_BASE_COUNT - $communityImageCount); $brokerShouldUploadPhotoCount = Bll_Community_CommunityGardener::COMMUNITY_IMAGE_BASE_COUNT; if ($action == 'save') { $image = array(); foreach ($params as $key => $val) { $keyName = explode('_', $key); if (isset($keyName[1]) && in_array($keyName[0], array('host', 'hash', 'content'))) { if ($keyName[0] == 'content') { $val = Util_PublicMethods::cutStr($val, 50); } $image[$keyName[1]][$keyName[0]] = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401 | ENT_IGNORE, 'UTF-8'); } else { continue; } } if (count($image) >= $brokerShouldUploadPhotoCount) { $uploadedImageList = array_values($image); $history['images'] = array_slice($uploadedImageList, 0, Bll_Community_CommunityGardener::COMMUNITY_IMAGE_COUNT_LIMIT); $storeSuccess = Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($communityId, $brokerId, static::$intBrokerCityID, $history, Model_Community_GardenerApply::APPLY_STATUS_PENDING_APPROVAL); if ($storeSuccess) { Model_Community_CommunityState::setCheckGardener($communityId, $brokerId); $this->redirect2Result(true, '小区申请成功', __LINE__); } $this->redirect2Result(false, '保存图片信息失败', __LINE__); } $this->redirect2Result(false, '提交的图片数量不够', __LINE__); } $hasCorrectPhoto = !empty($history['images']); $this->setAttribute('brokerShouldUploadPhotoCount', $brokerShouldUploadPhotoCount); $this->setAttribute('brokerUploadPhotoCountLimit', Bll_Community_CommunityGardener::COMMUNITY_IMAGE_COUNT_LIMIT); $this->setAttribute('hasCorrectPhoto', $hasCorrectPhoto); $this->setAttribute('updatedImageList', isset($history['images']) ? $history['images'] : array()); $this->setAttribute('brokerId', $brokerId); $this->setAttribute('communityInfo', $communityInfo['baseInfo']); $this->setAttribute('verify', $verifyCode); return 'Community_Gardener2_PhotoCommit'; }
/** * 判断小区是否可以申请 * * @param int $communityId * @return bool */ public static function checkCommunityCanApply($communityId) { $communityImageList = static::getValidateCommunityImagesList($communityId); if (count($communityImageList) >= self::COMMUNITY_IMAGE_BASE_COUNT) { return false; } /** 判断小区园丁是否是有效的小区园丁 */ if (Bll_Community_CommunityGardener::checkCommunityGardenerValidate($communityId)) { return false; } return true; }
public function handle_request_abs() { $visible = 0; $params = $this->getParameters(); /** 如果地图已经锁定则直接跳转到 上传照片 */ if ($this->isLockMap) { $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode))); } $communityInfo = $this->getCommunityCorrectInfo($this->communityInfo); $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($this->communityId, static::$intBrokerID); $history = array(); if (!empty($applyHistory['applyData'])) { $history = json_decode($applyHistory['applyData'], true); } $MapInfo = $this->communityInfo['mapInfo']; /** 如果没有小区的地图坐标信息就用板块的坐标 */ if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) { $visible = 1; $areaCode = $this->communityInfo['baseInfo']['areaCode']; $blockId = Bll_Community_CommunityGardener::getBrokerIdFromAreaCode($areaCode); $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($blockId); if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) { $areaId = Bll_Community_CommunityGardener::getAreaIdFromAreaCode($areaCode); $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($areaId); if (empty($MapInfo) || $MapInfo['lat'] == 0 || $MapInfo['lng'] == 0) { $cityId = Bll_Community_CommunityGardener::getCityIdFromAreaCode($areaCode); $MapInfo = Bll_Community_CommunityGardener::getBlockMapInfo($cityId); } } } $communityInfo['Lat'] = $MapInfo['lat']; $communityInfo['Lng'] = $MapInfo['lng']; $communityInfo['Zoom'] = $MapInfo['zoom']; /** 保存经纪人提交的小区地图信息 */ $action = $this->getParameter(self::ACTION); if ($action == 'save') { $defaultLat = sprintf("%f", $communityInfo['Lat']); $defaultLng = sprintf("%f", $communityInfo['Lng']); /** 保存地图纠错信息,地图是可以不纠错的 */ if (!empty($params[self::MODIFY_LAT]) || !empty($params[self::MODIFY_LNG])) { $modifyLat = $params[self::MODIFY_LAT]; $modifyLng = $params[self::MODIFY_LNG]; if ($defaultLat != $modifyLat || $defaultLng != $modifyLng) { $history['map']['Lat'] = $modifyLat; $history['map']['Lng'] = $modifyLng; $history['map']['Zoom'] = $communityInfo['Zoom'] ? $communityInfo['Zoom'] : 16; Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($this->communityId, static::$intBrokerID, $this->communityInfo['baseInfo']['cityId'], $history); } } if ($this->communityImageCount <= 0) { if (Bll_Community_CommunityGardener::setCheckGardener($this->communityId, static::$intBrokerID)) { $this->setAttribute('isOk', 1); } else { $this->setAttribute('isOk', 2); } return 'Community_Gardener_PhotoCommitOk'; } $this->redirect(Bll_Community_CommunityGardener::buildGardenerPhotoCommit($this->communityId, array(self::VERIFY => $this->verifyCode))); } $areaInfo = Bll_Community_CommunityGardener::getAreaInfo($this->communityInfo['baseInfo']['areaCode']); $hasCorrectMap = !empty($history['map']); $this->setAttribute('hasCorrectMap', $hasCorrectMap); $this->setAttribute('history', $history); $this->setAttribute('visible', $visible); $this->setAttribute('commInfo', $communityInfo); $this->setAttribute('brokerid', static::$intBrokerID); $this->setAttribute('areaInfo', $areaInfo); return 'Community_Gardener_CorrectMap'; }
private function initCommunityGardenerStateInfo($communityList, $communityStateInfoList, $brokerId) { $apf = APF::get_instance(); $schema = $apf->get_request()->is_secure() ? 'https' : 'http'; $baseDomain = APF::get_instance()->get_config('base_domain'); $basePath = BASE_URI; $homeUrl = "{$schema}://my.{$baseDomain}{$basePath}/community/gardener/correct/info/"; if (empty($communityList)) { return array(); } $communityGardenerStateList = array('communityList' => array(), 'gardenerIds' => array()); foreach ($communityList as $community) { $communityId = $community['baseInfo']['commId']; $communityState = array('commName' => $community['baseInfo']['commName'], 'commId' => $communityId, 'applyExpirationTime' => 0, 'apply' => true, 'status' => 1, 'applyBrokerId' => 0, 'gardenerId' => 0, 'applyUrl' => "{$homeUrl}{$communityId}?verify=" . Bll_Community_CommunityGardener::getVerifyCode($communityId, $brokerId)); if (!empty($communityStateInfoList[$communityId])) { $communityStateInfo = $communityStateInfoList[$communityId]; $communityState['applyExpirationTime'] = $communityStateInfo['applyExpirationTime']; $communityState['applyBrokerId'] = $communityStateInfo['applyBrokerId']; $communityState['gardenerId'] = $communityStateInfo['gardenerId']; $communityState['applyUrl'] = "{$homeUrl}{$communityId}?verify=" . Bll_Community_CommunityGardener::getVerifyCode($communityId, $brokerId); //申请链接 switch ($communityStateInfo['state']) { case 1: /** 小区有人在申请,如果是当前经纪人或者申请已经过期则可以申请,不可以申请 */ if ($communityStateInfo['applyBrokerId'] == $brokerId || $communityStateInfo['applyExpirationTime'] < time()) { if ($communityStateInfo['gardenerId'] > 0) { $communityGardenerStateList['gardenerIds'][] = $communityStateInfo['gardenerId']; $communityState['status'] = 3; } else { $communityState['status'] = 1; } $communityState['apply'] = true; } else { $communityState['apply'] = false; $communityState['status'] = 2; } break; case 2: $communityState['apply'] = false; $communityState['status'] = 2; break; case 3: $communityState['apply'] = !($brokerId == $communityStateInfo['gardenerId']); $communityState['status'] = 3; $communityGardenerStateList['gardenerIds'][] = $communityStateInfo['gardenerId']; } } $communityGardenerStateList['communityList'][] = $communityState; } return $communityGardenerStateList; }
/** * 判断当前经纪人是否可以申请当前小区的园丁 * * @param int $communityId * @param int $brokerId * @param int $verifyCode * @return bool */ protected function checkApplyIsValid($communityId, $brokerId, $verifyCode) { if (!$this->checkVerifyCode($verifyCode)) { return false; } $communityGardenerState = Bll_Community_CommunityGardener::getCommunityGardenerState($communityId); if (empty($communityGardenerState)) { return Bll_Community_CommunityGardener::initCommunityGardenerState($communityId, $brokerId); } $this->communityGardenerId = $communityGardenerState['gardenerId']; $communityState = intval($communityGardenerState['state']); if ($communityState == Model_Community_CommunityState::COMMUNITY_STATE_CHECKING) { return false; } if ($communityState == Model_Community_CommunityState::COMMUNITY_STATE_NO_APPLY) { return Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId); } if ($communityState == Model_Community_CommunityState::COMMUNITY_STATE_APPLYING) { if ($communityGardenerState['applyExpirationTime'] > time()) { if ($communityGardenerState['applyBrokerId'] == $brokerId) { return true; } return false; } return Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId); } if ($communityState == Model_Community_CommunityState::COMMUNITY_STATE_HAS_GARDENER) { if ($communityGardenerState['applyBrokerId'] == $brokerId) { return false; } return Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId); } return false; }
/** * 检查和存储经纪人纠错信息 * * @param int $brokerId * @param array $infoLock * @param array $params * @param array $typeList * @param array $history * @return bool */ function checkAndSaveCorrectData($brokerId, $infoLock, $params, $typeList, $history) { $data = array(); $history = json_decode($history, true); foreach (self::$fields as $key => $val) { if (!empty($history[$key])) { $data[$key] = $history[$key]; } if (!empty($params[$val['key']])) { if (!isset($infoLock[$key]) || $infoLock[$key] != 0 && $infoLock[$key] != 2) { $data[$key] = $params[$val['key']]; } } $data[$key] = trim($data[$key]); if (!empty($val['erge']) && !preg_match($val['erge'], $data[$key]) || empty($data[$key])) { unset($data[$key]); continue; } switch ($key) { case 3: $types = array(); foreach ($typeList as $tk => $tv) { $types[] = $tv['typeId']; } $dataType = explode(',', $data[$key]); $data[$key] = implode(',', array_intersect($types, $dataType)); break; } } if (isset($history['map'])) { $data['map'] = $history['map']; } if (!empty($data)) { return Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($this->communityId, $brokerId, $this->communityInfo['baseInfo']['cityId'], $data); } return false; }
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)); }
public function handle_request_internal() { if (Bll_Weshop::weshopPropsIsMaintain()) { return array('status' => 'error', 'message' => "系统维护中,请稍后再试!"); } header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; $propIds = explode(',', $this->_params['propIds']); $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //房源表查寻后 添加到队列表 $propsInfos = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $brokerInfo->cityId); if (count($propIds) == 1) { //插入 房源列表 并返回 $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propIds[0]); if ($propInfo) { $params = array(); $params['cityId'] = $propInfo['property']['CityId']; $params['commId'] = $propInfo['property']['CommId']; $params['brokerId'] = $brokerId; $params['areaId'] = substr($propInfo['property']['AreaCode'], 0, 8); $params['blockId'] = $propInfo['property']['AreaCode']; $params['price'] = $propInfo['property']['ProPrice']; $params['acreage'] = $propInfo['property']['AreaNum']; $params['room'] = $propInfo['property']['RoomNum']; $params['hall'] = $propInfo['property']['HallNum']; $params['toilet'] = $propInfo['property']['ToiletNum']; $propDescription = $propInfo['property']['sale']['AddExplan']; $propDescription = str_replace('<p>', "", $propDescription); $propDescription = str_replace('</p>', "", $propDescription); $propDescription = trim($propDescription); $params['description'] = json_encode($propDescription); $params['title'] = $propInfo['property']['ProName']; $params['floor'] = $propInfo['property']['ProFloor']; $params['totalFloor'] = $propInfo['property']['FloorNum']; $params['status'] = 1; $params['createTime'] = date('Y-m-d H:i:s', time()); $params['updateTime'] = date('Y-m-d H:i:s', time()); $result = Model_Weshop_Props::insertWeshopProps($params); //存储图片 默认图 区分 室内图8张 户型图 1张 $imageUrl = ''; if ($propInfo['attachments']['attachments']) { $propImageNum = 0; $outdoorImageNum = 0; $images = $propInfo['attachments']['attachments']; foreach ($images as $image) { if ($image['DataType'] == 2) { if ($propImageNum >= 8) { continue; } if ($propImageNum == 0) { $img_params['isDefault'] = 1; //默认图 $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 290, 240); //(拼好小图) $imageUrl = str_replace("240", "240c", $url); //无水印格式 } else { $img_params['isDefault'] = 0; } $img_params['imageType'] = 1; //室内图 $propImageNum += 1; } else { if ($image['DataType'] == 3) { if ($outdoorImageNum >= 1) { continue; } $img_params['imageType'] = 2; //户型图 $outdoorImageNum += 1; } } $img_params['propId'] = $result->id; $img_params['imageHostId'] = $image['host_id']; $img_params['imageHash'] = $image['FileName']; $img_params['isDelete'] = 0; $img_params['createTime'] = date('Y-m-d H:i:s', time()); $img_params['updateTime'] = date('Y-m-d H:i:s', time()); //存储图片 Model_Weshop_PropImages::insertWeshopPropImages($img_params); } } if ($result) { //插入 weshop_prop_ext表 $tmp = array('weshopPropId' => $result->id, 'brokerId' => $brokerId, 'propId' => $propIds[0]); Model_Weshop_PropsFilter::insertRecord($tmp); //区域板块 $areaAndBlockIds = array(); $areaId = $params['areaId']; $blockId = $params['blockId']; $areaAndBlockIds[] = $areaId; $areaAndBlockIds[] = $blockId; $commTypeInfos = Bll_Community_CommunityGardener::getCommTypeInfo($areaAndBlockIds); $previewUrl = Bll_Weshop::getPropPreviewUrl(array('brokerId' => $brokerId, 'propId' => $result->id)); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propId' => $result->id, 'title' => $propInfo['property']['ProName'], 'areaName' => $commTypeInfos[$areaId], 'blockName' => $commTypeInfos[$blockId], 'commId' => $propInfo['property']['CommId'], 'commName' => $propInfo['property']['CommName'], 'room' => $propInfo['property']['RoomNum'], 'hall' => $propInfo['property']['HallNum'], 'toilet' => $propInfo['property']['ToiletNum'], 'price' => $propInfo['property']['ProPrice'], 'priceUnit' => '万', 'area' => $propInfo['property']['AreaNum'], 'areaUnit' => '平米', 'propDescription' => $propDescription, 'previewUrl' => $previewUrl, 'imageUrl' => $imageUrl)); } } } //插入队列表 foreach ($propsInfos as $propsInfo) { if ($propsInfo['brokerId'] == $brokerId) { $params = array(); $params['brokerId'] = $brokerId; $params['propId'] = $propsInfo['proId']; $params['cityId'] = $brokerInfo->cityId; $params['status'] = 0; $params['addTime'] = date('Y-m-d H:i:s', time()); $params['updateTime'] = date('Y-m-d H:i:s', time()); Model_Weshop_PropQueue::insertWeshopPropQueue($params); } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '导入成功')); }
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)); }