Ejemplo n.º 1
0
 /**
  * init env
  * @param AJKRequest $request
  * @param $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $out['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($out['ajkBrokerId']);
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     $jpMemberInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']);
     // 获取金铺brokerId
     $out['jpBrokerId'] = $jpMemberInfo->id;
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU);
     $out['isBidCity'] = Bll_City::isBidCity($out['cityId'], Const_Site::JINPU);
     if ($out['isChoiceCity'] || $out['isBidCity']) {
         $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价';
         $out['bidUrl'] = $out['isChoiceCity'] ? '/ajkbroker/user/choice/set/jp/' . $out['proId'] : '/jinpu/bid/new/' . $out['proId'];
     }
     $multicity = APF::get_instance()->get_config("cities", "multicity");
     $out['cityName'] = $multicity[$out['cityId']];
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_JpBroker::data_access()->filter('id', $jpMemberInfo->id)->get_row())) {
         throw new Exception('获取金铺经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
 }
Ejemplo n.º 2
0
 /**
  * init env
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     //$out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
Ejemplo n.º 3
0
 public function basicCheck()
 {
     if (!$this->isBrokerLogin()) {
         APF::get_instance()->get_response()->redirect(Uri_MemberUrl::build_login_url($this->currentUrl));
         return false;
     }
     $this->request = APF::get_instance()->get_request();
     $brokerId = $this->request->getBrokerId();
     $cityId = $this->request->getBrokerCityId();
     $this->isComboBroker = Bll_Broker_HzBroker::isComboBroker($brokerId);
     $this->isPpcBroker = Bll_Broker_HzBroker::isPpcBroker($brokerId);
     $routeMatches = $this->request->get_router_matches();
     if (isset($routeMatches[3]) && is_numeric($routeMatches[3])) {
         $this->houseId = $routeMatches[3];
         $this->action = 'edit';
     }
     /** 委托房源发布 */
     $act = $this->request->get_parameter('act');
     $id = $this->request->get_parameter('cid');
     // commission  id
     if ($act == 'commission' && is_numeric($id)) {
         $this->commissionId = $id;
         $this->action = 'commission';
     }
     /** 验证发房数 */
     try {
         $brokerCanPublishHouse = Bll_Broker_HzBroker::checkEsfBrokerCanPublishHouse($cityId, $brokerId);
         if ($this->action != 'edit' && !$brokerCanPublishHouse) {
             $this->redirect2Result(Const_PublishCode::PUBLISH_OUT_OF_LIMIT, 'ajk', $this->action, 0, '发房数超出限制');
         }
     } catch (Exception $e) {
         $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, 0, $e->getMessage());
     }
     /** 验证房源 */
     if ($this->action == 'edit' && !Bll_House_EsfHouse::checkHouseExist($cityId, $this->houseId, $brokerId)) {
         $this->redirect2Result(Const_PublishCode::HOUSE_NOT_EXIST, 'ajk', $this->action, $this->houseId, '房源不存在');
     }
     return true;
 }
Ejemplo n.º 4
0
 /**
  * @param House_PropviewController $controller
  * @param AJKRequest $request
  * @param AJKResponse $response
  *
  * @return array
  */
 public static function handlerPropViewRequest($controller, $request, $response)
 {
     $routeMatches = $request->get_router_matches();
     $houseId = $routeMatches[2];
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $pageParams = array('houseId' => $houseId);
     $houseInfo = Bll_House_EsfHouse::getHouseBaseInfoEx($houseId, $cityId);
     /** 不是当前经纪人的房源则返回到房源管理页去 */
     if (empty($houseInfo) || $houseInfo['brokerId'] != $brokerId) {
         $response->redirect('/ajkbroker/user/manage/proplist/ajk/');
     }
     $pageParams['title'] = $houseInfo['proName'];
     $houseInfo['mobile'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0;
     $pageParams['info'] = sprintf('%s %d平米,%d室%d厅%d卫,%d/%d层,%.2f万 (房源ID:%d)', $houseInfo['commName'], $houseInfo['areaNum'], $houseInfo['roomNum'], $houseInfo['hallNum'], $houseInfo['toiletNum'], $houseInfo['proFloor'], $houseInfo['floorNum'], $houseInfo['proPrice'], $houseId);
     $currentDate = strtotime(date('Y-m-d 00:00:00'));
     $postDate = strtotime(date('Y-m-d 00:00:00', $houseInfo['postDate']));
     $pageParams['leftDay'] = max(0, 90 - floor(($currentDate - $postDate) / 86400));
     $pageParams['houseInfo'] = $houseInfo;
     $pageParams['viewLink'] = Util_Url::ajkHouseDetailUrl($houseId, $cityId);
     $pageParams['editURL'] = Bll_Ppc_LinkManager::getSaleEditUrl($houseId);
     $houseAdShow = Model_House_AdPropShowSale::getHouseAdSale($brokerId, $houseInfo['proId']);
     $pageParams['AdShow'] = empty($houseAdShow) ? false : true;
     $pageParams['isIllegal'] = $houseInfo['isVisible'] == 0 && $houseInfo['expireWorker'] != 'propertyReport';
     // TODO 获取小区在线房源和排名 需要重构
     $pageParams['communitySaleCount'] = Model_Community_AjkSaleRentCount::getCommunitySaleNum($houseInfo['commId']);
     $isBidCity = Bll_City::isBidCity($cityId);
     if ($isBidCity) {
         $pageParams['bidTip'] = '竞价';
     }
     $isChoiceCity = Bll_City::isChoiceCity($cityId);
     /** 精选城市 */
     if ($isChoiceCity) {
         $pageParams['bidTip'] = '精选';
     }
     $pageParams['isChoiceCity'] = $isChoiceCity;
     $pageParams['isBidCity'] = $isBidCity;
     $houseRank = Bll_Broker_Manage_AjkPropList::getHouseSollyResult(array($houseId));
     if (isset($houseRank[$houseId])) {
         $pageParams['houseRank'] = $houseRank[$houseId];
     } else {
         $pageParams['houseRank'] = '待评';
     }
     $houseSpreadDate = array();
     for ($interval = -6; $interval <= 0; $interval++) {
         $houseSpreadDate[] = date('m.d', strtotime("{$interval} day"));
     }
     $pageParams['houseSpreadDate'] = $houseSpreadDate;
     $fixPlanId = Bll_Plan_Fix_AjkPlan::getPlanIdByHouseId($brokerId, $houseId, $cityId);
     $startDate = date('Ymd', strtotime('-6 day'));
     $endDate = date('Ymd');
     $houseFixDailyCostList = array();
     for ($i = -6; $i <= 0; $i++) {
         $date = date('m.d', strtotime("{$i} day"));
         $houseFixDailyCostList[$date] = 0;
     }
     /** 获取房源指定日期内每天的定价点击 */
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         $pageParams['houseFixSpreadClickInfoList'] = static::getHouseComboSpreadClickInfo($houseId);
     } else {
         $pageParams['houseFixSpreadClickInfoList'] = static::getHouseFixSpreadClickInfoEx($brokerId, $houseId);
         /** 获取房源指定日期内每天的定价花费 */
         $pageParams['houseFixDailyCostList'] = array_merge($houseFixDailyCostList, static::getHouseFixDailyCost($brokerId, $fixPlanId, $houseId, $startDate, $endDate));
     }
     if ($isChoiceCity || $isBidCity) {
         $houseBidSpreadInfo = static::getHouseBidSpreadInfo($houseId, $cityId);
         $pageParams['houseBidSpreadInfo'] = $houseBidSpreadInfo;
     }
     // $pageParams['houseDetail'] = Bll_Ppc_ServiceAPI::getHouseInfo($houseId);
     $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($houseId);
     $pageParams['optimize'] = static::getHouseOptimizeInfo($houseId, $houseImageInfo, $houseInfo, $cityId);
     $pageParams['imageCount'] = count($houseImageInfo['imageBaseInfo']);
     if (count($houseImageInfo['imageBaseInfo']) <= 0) {
         $pageParams['houseDefaultImage'] = 'http://pages.anjukestatic.com/img/global/nopic_150x113.gif';
     } else {
         $pageParams['houseDefaultImage'] = static::getThumbImageUrl($houseId, $houseImageInfo['imageBaseInfo']);
     }
     $pageParams['houseStatisticsInfo'] = static::getHouseStatisticsInfo($houseId, $cityId, $houseInfo['commId'], $houseInfo['proPriceInt']);
     //市场分析,小区价格段供需比。获取前天的数据
     $pageParams['demandSupplyPriceInfo'] = static::getDemandSupplyByPriceInfo($houseInfo['commId']);
     //市场分析,小区户型供需比。获取前天数据
     $pageParams['demandSupplyRoomInfo'] = static::getCommTotalRoomInfo($houseInfo['commId']);
     $pageParams['subRegionRank'] = static::getCommunityRank($houseInfo['areaCode'], $houseInfo['commId']);
     return $pageParams;
 }