/** * 获取页面的初始化信息 * * @param int $brokerId * @param int $cityId * @param int $commissionId * @param AJKRequest $request * @return array * @throws Exception */ public static function preparePageParam($brokerId, $cityId, $commissionId, $request) { $commissionHouseInfo = static::getCommission($commissionId, $brokerId); if (empty($commissionHouseInfo)) { throw new Exception('获取委托房源信息失败', Const_PublishCode::COMMISSION_ERROR); } if ($commissionHouseInfo['brokerHouseId'] > 0) { throw new Exception('委托房源已经发布过【ID:' . $commissionHouseInfo['brokerHouseId'] . '】', Const_PublishCode::COMMISSION_ERROR_HOUSE_EXISTS); } $houseInfo = static::getCommissionHouseInfo($commissionHouseInfo['house']); $houseInfo['cityId'] = $cityId; /** 获取房源发布&编辑页面的示例URL */ $pageParams = Bll_House_EsfPublish::getExampleURL($cityId); $pageParams['houseInfo'] = $houseInfo; $pageParams['commissionId'] = $commissionId; /** 是否需要显示备案信息 */ $pageParams['houseRecordNumberConfig'] = Bll_House_EsfPublish::getHouseRecordNumberConfig($cityId); $pageParams['priceMentionUrl'] = Bll_House_EsfPublish::getPriceMentionUrl($cityId); $pageParams['publishHouseProtocolUrl'] = Bll_House_EsfPublish::getPublishHouseProtocolUrl($cityId); $pageParams['brokerId'] = $brokerId; $pageParams['cityId'] = $cityId; /** 装修情况 */ $pageParams['fitmentList'] = Model_House_FitmentType::getFitment($cityId); /** 房屋类型 */ $pageParams['useTypeList'] = Model_Community_UseType::getUseTypeByCityId($cityId); /** 房屋朝向 */ $pageParams['orientateList'] = APF::get_instance()->get_config('house_orientate', 'house'); /** 获取小区和房源公共标签 */ $pageParams['privateTagList'] = Bll_House_EsfPublish::getPrivateTagList(); /** 获取上传图片服务器 */ $pageParams['uploadImgService'] = Bll_House_EsfPublish::getUploadImageServer(); $pageParams['picData'] = array('UPDROOM' => array(), 'ALLMODEL' => array(), 'ALLCOMM' => array(), 'NEWUPDROOM' => Bll_House_EsfCommission::getCommissionImage($commissionHouseInfo['houseId'])); /** 最低首付配置 */ $miniPayDownConfig = Bll_House_EsfPublish::getMiniPayDownConfig($cityId); if (Bll_Broker_HzBroker::isPpcBroker($brokerId)) { $pageParams['canSpread'] = Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId); $pageParams['brokerActionTip'] = '推广房源已满,只能保存到未推广房源'; } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $checkCanSpreadResult = Bll_Combo_HouseRelation::housePublishComboCheck($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK); $pageParams['canSpread'] = $checkCanSpreadResult['status'] == 1; $pageParams['brokerActionTip'] = $checkCanSpreadResult['msg']; } return array_merge($pageParams, $miniPayDownConfig); }
/** * 页面数据预加载模块 */ public function beforePost() { // 初始化页面变量 $this->ctx = Bll_House_HzPublish::initPageVariables($this->ctx); if ($this->ctx['proId']) { $propInfo = Bll_House_HzHouse::getPropInfo($this->ctx['proId'], $this->ctx['cityId']); // 房源不存在 if (!$propInfo['status']) { $this->redirect2Result(Const_PublishCode::HOUSE_NOT_EXIST, $this->site, $this->action, $this->ctx['proId']); } $tmpProId = $this->ctx['proId']; if ($propInfo['status']) { $this->ctx = array_merge($this->ctx, $propInfo['msg']); } // fix 大json里proid存成0的问题 if (!$this->ctx['proId']) { $this->ctx['proId'] = $tmpProId; } // 非自己房子 if ($propInfo['msg']['userid'] != $this->ctx['hzBrokerId']) { $this->redirect2Result(Const_PublishCode::NOT_OWN_HOUSE, $this->site, $this->action, $this->ctx['proId']); } } // 区域 $this->ctx['areaArr'] = Model_City_HzArea::getAreasByCityId($this->ctx['cityId']); // 板块 $this->ctx['blockArr'] = Model_City_HzArea::getBlockByAreaId($this->ctx['areaid']); // 房屋类型 $this->ctx['propTypeArr'] = Bll_House_HzHouse::getPropType($this->ctx['cityId']); // 装修类型 $this->ctx['fitmentArr'] = Bll_House_HzHouse::getFitment($this->ctx['cityId']); // 朝向 $this->ctx['towardArr'] = Bll_House_HzHouse::getToward(); // 房屋配置 $this->ctx['deploymentArr'] = Bll_House_HzHouse::getDeployment(); // 付款类型 $this->ctx['payTypeArr'] = Bll_House_HzHouse::getRentDepositAndCycle($this->ctx['cityId']); // 合租类型 $this->ctx['shareType'] = Bll_House_HzHouse::getShareType(); // 合租性别 $this->ctx['shareSexArr'] = Bll_House_HzHouse::getShareSex(); // 检查低价城市 $this->ctx['checkLowPriceCity'] = Bll_House_HzHouse::getCheckLowPriceCity(); // 获取图片 $this->ctx['images'] = Bll_Image_HzHouseImage::getImagesByHouseIds($this->ctx['proId'], true); $this->ctx['picData'] = Bll_House_HzPublish::buildImagesForPage($this->ctx['images']); $this->ctx['isShowCommPic'] = in_array($this->ctx['cityId'], array(11)) ? 0 : 1; $this->ctx['publishHouseProtocolUrl'] = Bll_House_EsfPublish::getPublishHouseProtocolUrl($this->ctx['cityId']); // 房源是否可以推广信息 $this->ctx = Bll_House_HzPublish::getSpreadFlagInfo($this->ctx); // 获取图片服务器host $this->ctx['picUploadServerDomain'] = Bll_Image_HzHouseImage::getPicUpdServerDomain(); if ($this->ctx['isEdit']) { $this->action = 'edit'; } // inject $this->ctx = Bll_House_HzPublish::beforePostInjectAfter($this->ctx); // debug $this->ctx['debug'] == 'all' && (print_r($this->ctx) && die); if (isset($this->ctx['file'])) { unset($this->ctx['file']); } return $this->ctx; }
/** * 获取页面的初始化信息 * * @param int $brokerId * @param int $cityId * @param int $houseId * @param AJKRequest $request * @throws Exception * @return array */ public static function preparePageParam($brokerId, $cityId, $houseId, $request) { /** 获取房源发布&编辑页面的示例URL */ $pageParams = Bll_House_EsfPublish::getExampleURL($cityId); /** 是否需要显示备案信息 */ $pageParams['houseRecordNumberConfig'] = Bll_House_EsfPublish::getHouseRecordNumberConfig($cityId); $pageParams['priceMentionUrl'] = Bll_House_EsfPublish::getPriceMentionUrl($cityId); $pageParams['publishHouseProtocolUrl'] = Bll_House_EsfPublish::getPublishHouseProtocolUrl($cityId); $pageParams['brokerId'] = $brokerId; $pageParams['cityId'] = $cityId; $pageParams['houseId'] = $houseId; /** 装修情况 */ $pageParams['fitmentList'] = Model_House_FitmentType::getFitment($cityId); /** 房屋类型 */ $pageParams['useTypeList'] = Model_Community_UseType::getUseTypeByCityId($cityId); /** 房屋朝向 */ $pageParams['orientateList'] = APF::get_instance()->get_config('house_orientate', 'house'); /** 获取小区和房源公共标签 */ $pageParams['privateTagList'] = Bll_House_EsfPublish::getPrivateTagList(); /** 获取上传图片服务器 */ $pageParams['uploadImgService'] = Bll_House_EsfPublish::getUploadImageServer(); $pageParams['picData'] = static::getHouseImageEx($brokerId, $houseId); /** 最低首付配置 */ $miniPayDownConfig = Bll_House_EsfPublish::getMiniPayDownConfig($cityId); $houseInfo = Bll_House_EsfEdit::getHouseBaseInfo($houseId); $pageParams['houseInfo'] = $houseInfo; if ($houseInfo['commissionType'] == 2 || $houseInfo['commissionType'] == 3) { $commissionInfo = Bll_House_EsfCommission::getCommissionByBrokerHouseId($houseId, $brokerId); $commissionHouseInfo = Bll_House_EsfCommission::getCommissionHouseInfo($commissionInfo['house']); $pageParams['commissionHouseInfo'] = $commissionHouseInfo; } $selectTagList = Model_House_AjkPrivateTag::getHouseTagById($houseInfo['ProPrivateTag']); foreach ($pageParams['privateTagList']['commTag'] as &$commTag) { if (in_array($commTag['tagId'], $houseInfo['ProPrivateTag'])) { $commTag['enable'] = false; } } foreach ($pageParams['privateTagList']['houseTag'] as &$subType) { foreach ($subType as &$houseTag) { if (in_array($houseTag['tagId'], $houseInfo['ProPrivateTag'])) { $houseTag['enable'] = false; } } } $pageParams['selectTagList'] = $selectTagList; $pageParams['canSpread'] = true; $pageParams['brokerActionTip'] = '推广房源已满,只能保存到未推广房源'; $pageParams['houseIsSpreading'] = false; if (Bll_Broker_HzBroker::isPpcBroker($brokerId)) { $pageParams['houseIsSpreading'] = BLL_Plan_EsfPropFixedPlanRelation::isHouseOnline($cityId, $houseId); if (!$pageParams['houseIsSpreading']) { $pageParams['canSpread'] = Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId); } else { $pageParams['canSpread'] = false; } } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $pageParams['houseIsSpreading'] = false; $houseRelation = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK); if (!empty($houseRelation)) { $pageParams['houseIsSpreading'] = true; $pageParams['canSpread'] = false; } if (!$pageParams['houseIsSpreading']) { $checkCanSpreadResult = Bll_Combo_HouseRelation::housePublishComboCheck($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK); $pageParams['canSpread'] = $checkCanSpreadResult['status'] == 1; $pageParams['brokerActionTip'] = $checkCanSpreadResult['msg']; } } return array_merge($pageParams, $miniPayDownConfig); }