public function handle_request_internal() { $request = APF::get_instance()->get_request(); $response = APF::get_instance()->get_response(); $brokerId = $request->getBrokerId(); $clintHelper = Bll_Broker::getWorkerNumInfo($brokerId); $params = $this->getParameters(); if (!isset($params['err_no']) || empty($params['err_no'])) { $params['err_no'] = Bll_Plan_Bid_Choice::BID_FAIL_OTHER; } if ($params['err_no'] == Bll_Plan_Bid_Choice::BID_FAIL_OTHER && (!isset($params['err_msg']) || empty($params['err_msg']))) { $params['err_msg'] = '未知错误'; } $basicUrl = Util_Url::buildMyBasicUrl(); //新跳转页面 $specialRedirectUrl = $params['specialRedirectUrl']; $request->set_attribute('specialRedirectUrl', $specialRedirectUrl); $request->set_attribute('clintHelper', $clintHelper); $request->set_attribute('act', $params['act']); $request->set_attribute('err_msg', $params['err_msg']); $request->set_attribute('from', $params['from']); $request->set_attribute('err_no', $params['err_no']); $request->set_attribute('rank', $params['rank']); $request->set_attribute('params', $params['params']); $request->set_attribute('basicUrl', $basicUrl); $request->set_attribute('propId', $params['propId']); return "Choice_Result"; }
public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect(self::getURL('my', '/login', 'anjuke')); } $broker = self::$BrokerInfo; $this->_intBrokerID = $broker['BaseInfo']['BROKERID']; $this->_intBrokerCityID = $broker['BaseInfo']['CITYID']; $type = APF::get_instance()->get_request()->get_parameter("type"); $BrokerMap = Model_Broker_MainBusiness::getBrokerMap($this->_intBrokerID); if (empty($type) || empty($BrokerMap)) { $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajk_brokerid'])); } /* http://beijing.jinpu.com/dianpu/39501 http://beijing.haozu.com/shop/1796250 http://beijing.anjuke.com/shop/view/147479 */ switch ($type) { case 'ajk': $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajkBrokerid'])); break; case 'zf': $this->redirect(Util_Url::getHaozuURLNew($this->_intBrokerCityID, '/dianpu/' . $BrokerMap['hzBrokerid'])); break; case 'jp': $this->redirect(Util_Url::getJinpuURLNew($this->_intBrokerCityID, '/dianpu/' . $BrokerMap['jpBrokerid'])); break; default: $this->redirect(self::getURL($this->_intBrokerCityID, '/shop/salelist/' . $BrokerMap['ajkBrokerid'])); break; } }
/** * 拼接分页按钮URL * @param array $p_arrParameters * @param string $p_strExtendURL * @return string */ static function getUrlString($p_arrParameters = array(), $p_strExtendURL = 'combo/account/accountlog') { $p_strExtendURL = ltrim($p_strExtendURL, "/"); return Util_Url::buildMyBasicUrl() . $p_strExtendURL . APF_Util_StringUtils::encode_seo_parameters($p_arrParameters); }
public function handle_request_internal() { /** * @var $request AJKRequest */ $request = APF::get_instance()->get_request(); $response = APF::get_instance()->get_response(); $params = $this->getParameters(); $route_matches = $request->get_router_matches(); $brokerId = $request->getBrokerId(); $cityId = $request->getBrokerCityId(); $userId = $request->getUserId(); $business = trim($route_matches[1]); $prop_id = $route_matches[2]; if (empty($brokerId)) { $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '请登陆操作', 'from' => 'bid_blockset')))); return false; } $isChoiceCity = false; $isChoiceCityTwo = false; switch ($business) { case 'ajk': $isChoiceCity = Bll_City::isBlockChoice($cityId, Const_Site::ANJUKE); //修改表city_biz_types 的type还有配置 $isChoiceCityTwo = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE); break; } if (!$isChoiceCity) { $response->redirect('/user/combo/brokerhome?from=not_choice_city'); return false; } //return 'Choice_BlockSet'; //验证choice城市 $config = Model_Config_CommonCity::getConfig(Model_Config_CommonCity::CHOICENAME, $cityId); /** 判断精选计划开启时间是否到了 */ //$request->set_attribute('choiceStarted', time()<$config['startTime']); $request->set_attribute('choiceStarted', !$this->getCityOpenTimeBegin($config['startTime'])); $request->set_attribute('choiceStartTimeMsg', sprintf('%d点准时开放', date('H', $config['startTime']))); /*if(time()<$config['startTime']){ $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no'=>Bll_Plan_Bid_Choice::BID_FAIL_OTHER, 'err_msg'=>'还未到精选房源开始时间。', 'from'=>'bid_blockset')))); return false; }*/ if (empty($route_matches) || count($route_matches) < 3) { $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '请从精选房源管理页设置精选房源计划', 'from' => 'bid_blockset')))); return false; } if (!is_numeric($route_matches[2])) { $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '房源ID必须是数字', 'from' => 'bid_blockset')))); return false; } $params['ip'] = $request->get_client_ip(); // var_dump($business);exit; if ($request->is_post_method()) { switch ($business) { case 'ajk': try { $result = Bll_Plan_Bid_BlockChoice::esf_setting_post($brokerId, $cityId, $prop_id, $userId, $params); } catch (Exception $e) { $result = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试'); } break; default: $result = http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '参数错误。', 'from' => 'bid_blockset')); break; } $result = array_merge($result, array('act' => $business, 'propId' => $prop_id)); $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query($result))); return false; } switch ($business) { case 'ajk': try { $pageAttributes = Bll_Plan_Bid_BlockChoice::esf_setting($brokerId, $cityId, $prop_id, $userId, $params); } catch (Exception $e) { $pageAttributes = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试'); } break; default: $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query(array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => '参数错误。', 'from' => 'bid_blockset')))); break; } if (isset($pageAttributes['err_no'])) { $result = array('err_no' => Bll_Plan_Bid_BlockChoice::BID_FAIL_OTHER, 'err_msg' => $pageAttributes['err_msg'], 'from' => 'bid_blockset'); $result = array_merge($result, array('act' => $business, 'propId' => $prop_id)); $response->redirect(Util_Url::buildChoiceResultUrl(http_build_query($result))); return false; } $request->set_attribute('isChoiceCityTwo', $isChoiceCityTwo); $request->set_attribute('isChoiceCity', $isChoiceCity); $request->set_attribute('business', $business); $request->set_attribute('prop_id', $prop_id); $this->set_attributes($pageAttributes); /** * 2015 年关精选打折 预计时间2.1 ~ 3.5 * TODO 2015.4.1 删除这部分代码 */ $isChoiceRebate = Bll_Onoff_Choice::getChoiceRebateByBroekrId($brokerId); $this->setAttribute('isChoiceRebate', $isChoiceRebate); switch ($business) { case 'jp': return 'Choice_BlockSetJP'; break; default: return 'Choice_BlockSet'; } }
/** * 获取经纪人房源信息 * * @param int $brokerId * @param int $cityId * @param array $fixPlanHouseIds * @param array $bidPlanHouseIds * @param bool $isChoiceCity * @param string|int $search * @return array */ public static function getBrokerAllPropInfoList($brokerId, $cityId, $fixPlanHouseIds, $bidPlanHouseIds, $isChoiceCity, $search) { $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId); if (empty($tempHouseInfoList)) { return array(); } $houseInfoList = array('houseIdList' => array(), 'houseCount' => count($tempHouseInfoList), 'bidSpreadHouseList' => array(), 'fixSpreadHouseList' => array(), 'noSpreadHouseList' => array(), 'communityList' => array()); $search = trim($search); /** 过滤搜索 */ if (!empty($search)) { $searchByHouseId = is_numeric($search); foreach ($tempHouseInfoList as $index => $houseInfo) { $communityName = trim($houseInfo['commName']); if (!isset($houseInfoList['communityList'][$houseInfo['commId']])) { $houseInfoList['communityList'][$houseInfo['commId']] = $communityName; } if ($searchByHouseId && $search != $houseInfo['proId']) { unset($tempHouseInfoList[$index]); } elseif (!$searchByHouseId && $communityName != $search) { unset($tempHouseInfoList[$index]); } } $tempHouseInfoList = array_values($tempHouseInfoList); } $houseInfoList['houseCount'] = count($tempHouseInfoList); $tempNoSpreadHouseList = array(); if (!is_array($fixPlanHouseIds)) { $fixPlanHouseIds = array(); } if (!is_array($bidPlanHouseIds)) { $bidPlanHouseIds = array(); } $houseAdShowList = Bll_House_AdPropShowSale::getBrokerAdShowHouseList($brokerId, $cityId); $currentTimestamp = strtotime(date('Y-m-d 00:00:00')); foreach ($tempHouseInfoList as $houseInfo) { $houseInfoList['houseIdList'][] = $houseInfo['proId']; $housePostTime = strtotime(date('Y-m-d 00:00:00', $houseInfo['postDate'])); $houseInfo['expiredDay'] = max(0, 90 - floor(($currentTimestamp - $housePostTime) / 86400)); $houseInfo['illegal'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1; $houseInfo['mobile'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $houseInfo['viewURL'] = Util_Url::ajkHouseDetailUrl($houseInfo['proId'], $cityId); $houseInfo['editURL'] = Bll_Ppc_LinkManager::getSaleEditUrl($houseInfo['proId']); $houseInfo['detailURL'] = static::getHouseDetailPageURL($houseInfo['proId']); // $houseAdShow = Model_House_AdPropShowSale::getHouseAdSale($brokerId, $houseInfo['proId']); $houseInfo['AdShow'] = isset($houseAdShowList[$houseInfo['proId']]); if (!isset($houseInfoList['communityList'][$houseInfo['commId']])) { $houseInfoList['communityList'][$houseInfo['commId']] = trim($houseInfo['commName']); } $totalMoney = intval($houseInfo['proPrice'] * 10000); $fixSpreadPrice = Bll_House_EsfPriceInterval::getPriceInterval($cityId, $totalMoney, 0, 0); if (empty($fixSpreadPrice)) { $houseInfo['staticPrice'] = 0; } else { $houseInfo['staticPrice'] = $fixSpreadPrice['price']; } if (in_array($houseInfo['proId'], $bidPlanHouseIds)) { $houseInfo['redoBucketUrl'] = static::getPpcSpreadSetUrl($houseInfo['proId'], 3, 0); $houseInfo['addBucketUrl'] = static::getPpcSpreadSetUrl($houseInfo['proId'], 2, 2); $houseInfo['changePriceUrl'] = static::getPpcSpreadSetUrl($houseInfo['proId'], 2, 1); $houseInfoList['bidSpreadHouseList'][$houseInfo['proId']] = $houseInfo; } if (in_array($houseInfo['proId'], $fixPlanHouseIds)) { if ($isChoiceCity) { $houseInfo['bidUrl'] = "/ajkbroker/user/choice/set/ajk/" . $houseInfo['proId'] . '/'; } $houseInfoList['fixSpreadHouseList'][$houseInfo['proId']] = $houseInfo; continue; } $tempNoSpreadHouseList[$houseInfo['proId']] = $houseInfo; } /** 过滤违规房源 */ $tmpIllegalList = array(); foreach ($tempNoSpreadHouseList as $propId => $houseInfo) { if ($houseInfo['illegal'] == 0 && $houseInfo['ExpireWorker'] != 'propertyReport') { $tmpIllegalList[$propId] = $houseInfo; unset($tempNoSpreadHouseList[$propId]); } } $houseInfoList['noSpreadHouseList'] = array_merge($tmpIllegalList, array_reverse($tempNoSpreadHouseList)); return $houseInfoList; }
/** * 拼接分页按钮URL * @param array $p_arrParameters * @param string $p_strExtendURL * @return string */ static function getUrlString($p_arrParameters = array(), $p_strExtendURL = 'user/yuanbao/search/') { $p_strExtendURL = ltrim($p_strExtendURL, "/"); return Util_Url::buildMyBasicUrl() . $p_strExtendURL . APF_Util_StringUtils::encode_seo_parameters($p_arrParameters); }
/** * @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; }