Exemplo n.º 1
0
 /**
  * 页面数据预加载模块
  */
 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;
 }