Esempio n. 1
0
 /**
  * @param $brokerId
  * @param AJKRequest $request
  * @return bool
  */
 private function setBrokerLimitTemp($brokerId, $request)
 {
     // TODO 设置经纪人封顶信息
     $tempId = $request->get_parameter('tempId');
     $startTime = strtotime(date('Ymd 00:00:00', strtotime('+1 day')));
     return Bll_Ppc_ServiceAPI::setPpcBrokerLimitTemp($brokerId, $tempId, $startTime);
 }
Esempio n. 2
0
 /**
  * 重新定价推广
  *
  * @param int $brokerId
  * @param  AJKRequest $request
  * @return array
  */
 public function startPlan($brokerId, $request)
 {
     $managerCookie = $request->get_cookie('manager_id');
     if (!empty($managerCookie)) {
         return array('status' => 'error', 'data' => '没有操作权限。');
     }
     $planId = $request->get_parameter('planId');
     if (Bll_Ppc_ServiceAPI::restartFixPlan($brokerId, $planId, 21181)) {
         return array('status' => 'ok');
     }
     return array('status' => 'error', 'data' => '调用API错误');
 }
Esempio 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;
 }
Esempio n. 4
0
 /**
  * @param Manage_ProplistController $controller
  * @param AJKRequest $request
  * @param AJKResponse $response
  *
  * @return array
  */
 public static function getBrokerSpreadInfo($controller, $request, $response)
 {
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $query = trim($request->get_parameter('q'));
     $pageParams = array('query' => $query);
     if (!empty($query)) {
         $pageParams['searchByCommunity'] = !is_numeric($query);
     }
     $bidPropIds = array();
     $fixPropIds = array();
     /**
      * 速度优化阶段一
      * $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId);
      */
     $brokerCheckState = $controller->getBrokerCheckState();
     $isChoiceCity = Bll_City::isChoiceCity($cityId);
     /** 精选城市 */
     if ($isChoiceCity) {
         $pageParams['bidTip'] = '精选';
     }
     $pageParams['isChoiceCity'] = $isChoiceCity;
     $pageParams['isBidCity'] = false;
     $pageParams['isShowCaseCity'] = Bll_City::isShowCaseCity($cityId, Const_Site::ANJUKE);
     if ($isChoiceCity) {
         /** 获取竞价计划信息 */
         $pageParams['bidPlanList'] = static::getBrokerBidPlanList($brokerId, $cityId, $bidPropIds, $isChoiceCity);
         $pageParams['bidPropIds'] = $bidPropIds;
         $pageParams['bidClickCount'] = Bll_Plan_Bid_AjkPlan::getBrokerBidClick($brokerId, date('Ymd'), $cityId);
         $pageParams['bidCost'] = Bll_Plan_Bid_AjkPlan::getBrokerBidCost($brokerId, date('Ymd'), $cityId);
     }
     /** 获取定价计划信息 */
     $pageParams['fixPlanPropList'] = static::getBrokerFixPlanList($brokerId, $cityId, $fixPropIds, $brokerCheckState);
     $pageParams['fixPropIds'] = $fixPropIds;
     if (!empty($pageParams['fixPlanPropList'])) {
         $pageParams['effectURL'] = Bll_Plan_Fix_AjkPlan::GetPlanFixedPriceDetailUri($pageParams['fixPlanPropList'][0]['planInfo']['id'], 0, 1);
     }
     $houseInfoList = static::getBrokerAllPropInfoList($brokerId, $cityId, $fixPropIds, $bidPropIds, $pageParams['isChoiceCity'], $query);
     /** 房源数量 > 0 没有计划就创建计划 创建失败的话应该是API 错误 */
     if (!empty($houseInfoList) && empty($pageParams['fixPlanPropList'])) {
         Bll_Ppc_ServiceAPI::createFixPlan($brokerId, '定价', 100000, 1, 21181);
     }
     $ppcLimitInfo = Bll_Ppc_ServiceAPI::getPpcBrokerLimitInfo($brokerId);
     if (empty($ppcLimitInfo)) {
         echo '<script type="text/javascript"> alert("服务器繁忙,请重试!"); </script>';
         exit;
     }
     $pageParams['ppcLimitInfo'] = $ppcLimitInfo;
     /** 房源质量信息 */
     $pageParams['houseSolly'] = static::getHouseSollyResult($houseInfoList['houseIdList']);
     $pageParams['selectLimitTempAvailable'] = static::checkSelectLimitTempAvailable($cityId);
     $pageParams['fixPropIds'] = array_values(array_intersect($fixPropIds, array_keys($houseInfoList['fixSpreadHouseList'])));
     //$pageParams['bidPropIds'] = array_values(array_intersect($bidPropIds, $pageParams['fixPropIds']));
     if ($isChoiceCity) {
         $houseBidInfoList = array();
         $houseBidStatus = array();
         foreach ($pageParams['bidPlanList'] as $bidInfo) {
             $houseBidInfoList[$bidInfo['propId']] = $bidInfo;
             $houseBidStatus[$bidInfo['propId']] = $bidInfo['status'];
         }
         $pageParams['houseBidStatus'] = $houseBidStatus;
         $houseInfoList['fixSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['fixSpreadHouseList'], $houseBidInfoList, $cityId);
     }
     /** 精选引导优化 */
     $choiceFunctionOptimizationGuide = false;
     /*
     if ($isChoiceCity && count($houseInfoList['fixSpreadHouseList']) > 0) {
         if (Bll_Broker_AjkBrokerGuideNew::getGuideStatus($brokerId, 'Choice_Function_Optimization') == 0) {
             $choiceFunctionOptimizationGuide = true;
         }
     }
     */
     $pageParams['choiceFunctionOptimizationGuide'] = $choiceFunctionOptimizationGuide;
     return array_merge($pageParams, $houseInfoList);
 }
Esempio n. 5
0
 /**
  * 处理搜索
  * @param  AJKRequest $request
  * @param $out
  */
 private static function prepareSearch($request, &$out)
 {
     $out['query'] = trim($request->get_parameter('q'));
     $out['isSearch'] = empty($out['query']) ? false : true;
     $out['searchNoResult'] = true;
     // 拼接小区
     $out['communityList'] = array();
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $prop) {
             if (!$prop['commid']) {
                 continue;
             }
             $out['communityList'][$prop['commid']] = trim($prop['commname']);
         }
     }
     if (!$out['query']) {
         return;
     }
     // 过滤竞价推广
     if (isset($out['bidList']) && count($out['bidList']) > 0) {
         foreach ($out['bidList'] as $k => $list) {
             if (!isset($list['planning']) || empty($list['planning'])) {
                 continue;
             }
             $prop = $list['prop'];
             $compareField = is_numeric($out['query']) ? $prop['proId'] : $prop['commName'];
             if ($out['query'] != trim($compareField)) {
                 unset($out['bidList'][$k]);
             }
         }
     }
     // 过滤套餐推广
     if (count($out['comboList']) > 0) {
         foreach ($out['comboList'] as $k => $combo) {
             if (!isset($out['props'][$combo['houseId']])) {
                 unset($out['comboList'][$k]);
                 continue;
             }
             $prop = $out['props'][$combo['houseId']];
             $compareField = is_numeric($out['query']) ? $prop['propId'] : $prop['commname'];
             if ($out['query'] != trim($compareField)) {
                 unset($out['comboList'][$k]);
             }
         }
     }
     // 过滤未推广
     if (count($out['outList']) > 0) {
         foreach ($out['outList'] as $k => $list) {
             $compareField = is_numeric($out['query']) ? $list['proId'] : $list['commname'];
             if ($out['query'] != trim($compareField)) {
                 unset($out['outList'][$k]);
             }
         }
     }
     $out['searchNoResult'] = count($out['bidList']) > 0 || count($out['comboList']) > 0 || count($out['outList']) > 0 ? false : true;
 }
Esempio n. 6
0
 /**
  * @param Manage_ProplistController $controller
  * @param AJKRequest $request
  * @param AJKResponse $response
  *
  * @return array
  */
 public static function getComboInfo($controller, $request, $response)
 {
     $cityId = $request->getBrokerCityId();
     $brokerId = $request->getBrokerId();
     $query = $request->get_parameter('q');
     $pageParams = array('query' => $query);
     if (!empty($query)) {
         $pageParams['searchByCommunity'] = !is_numeric($query);
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     //echo "<pre>";print_r($comboInfoList);exit;
     $currentCombo = array();
     $nextCombo = array();
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
         }
         /** 获取续买套餐 */
         if ($comboInfo['salePropNum'] > 0 && $startDate > $currentDate) {
             if (!empty($nextCombo)) {
                 $nextComboEffectTime = strtotime($nextCombo['startTime']);
                 if ($nextComboEffectTime > $startDate) {
                     $nextCombo = $comboInfo;
                 }
             } else {
                 $nextCombo = $comboInfo;
             }
         }
     }
     $pageParams['currentCombo'] = $currentCombo;
     $pageParams['nextCombo'] = $nextCombo;
     $pageParams['comboCanSpreadHouseCount'] = 0;
     if (!empty($currentCombo)) {
         if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) {
             $hzSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_HZ);
             $pageParams['comboCanSpreadHouseCount'] = max(0, $currentCombo['salePropNum'] + $currentCombo['rentPropNum'] - $hzSpreadHouseCount);
         } else {
             $pageParams['comboCanSpreadHouseCount'] = $currentCombo['salePropNum'];
         }
     }
     $pageParams['comboClick'] = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK);
     $isChoiceCity = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE);
     $isBlockChoiceCity = Bll_City::isBlockChoice($cityId, Const_Site::ANJUKE);
     /** 精选城市 */
     if ($isChoiceCity) {
         $pageParams['bidTip'] = '精选';
     }
     $pageParams['isChoiceCity'] = $isChoiceCity;
     $pageParams['isBlockChoiceCity'] = $isBlockChoiceCity;
     $pageParams['isBidCity'] = false;
     $pageParams['isShowCaseCity'] = Bll_City::isShowCaseCity($cityId, Const_Site::ANJUKE);
     /** 获取竞价计划信息 */
     if ($isChoiceCity) {
         $bidPropIds = array();
         $pageParams['bidPlanList'] = static::getBrokerBidPlanList($brokerId, $cityId, $bidPropIds, true);
         $pageParams['bidPropIds'] = $bidPropIds;
         $pageParams['bidClickCount'] = Bll_Plan_Bid_AjkPlan::getBrokerBidClick($brokerId, date('Ymd'), $cityId);
         $pageParams['bidCost'] = Bll_Plan_Bid_AjkPlan::getBrokerBidCost($brokerId, date('Ymd'), $cityId);
     }
     /** 获取套餐推广信息 */
     $comboSpreadHouseList = static::getComboSpreadHouseList($brokerId, $cityId);
     $pageParams['comboSpreadHouseList'] = $comboSpreadHouseList;
     $pageParams['comboHouseIds'] = array_keys($comboSpreadHouseList);
     /** 速度优化:effectURL 没有在房源管理页使用,所以这个是可以删除的 */
     // if (!empty($comboSpreadHouseList)) {
     // TODO 获取效果时时看链接
     //    $pageParams['effectURL'] = Bll_Plan_Fix_AjkPlan::GetPlanFixedPriceDetailUri($pageParams['fixPlanPropList'][0]['planInfo']['id'], 0, 1);
     // }
     $houseInfoList = static::getBrokerAllPropInfoList($brokerId, $cityId, $pageParams['comboHouseIds'], $bidPropIds, $pageParams['isChoiceCity'], $query);
     //echo "<pre>";print_r($houseInfoList);exit;
     /** 房源质量信息 */
     //$pageParams['houseSolly'] = static::getHouseSollyResult($houseInfoList['houseIdList']);
     $pageParams['houseSolly'] = static::getHouseSollyResultEx($houseInfoList);
     $pageParams['comboHouseIds'] = array_values(array_intersect($pageParams['comboHouseIds'], array_keys($houseInfoList['comboSpreadHouseList'])));
     if ($isChoiceCity) {
         $houseBidInfoList = array();
         $houseBidStatus = array();
         foreach ($pageParams['bidPlanList'] as $bidInfo) {
             $houseBidInfoList[$bidInfo['propId']] = $bidInfo;
             $houseBidStatus[$bidInfo['propId']] = $bidInfo['status'];
             if ($bidInfo['model'] == Model_Plan_EsfAjkPropSpread::BLOCK_CHOICE) {
                 $pageParams['planInfoUrl'][$bidInfo['propId']]['urlChoice'] = "/ajkbroker/user/ajax/blockchoice";
             } else {
                 $pageParams['planInfoUrl'][$bidInfo['propId']]['urlChoice'] = "/ajkbroker/user/ajax/choice";
             }
         }
         $pageParams['houseBidStatus'] = $houseBidStatus;
         $houseInfoList['comboSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['comboSpreadHouseList'], $houseBidInfoList, $cityId);
         if (Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE)) {
             $houseInfoList['noSpreadHouseList'] = static::extendChoiceInfo($houseInfoList['noSpreadHouseList'], $houseBidInfoList, $cityId);
         }
         // print_r($houseInfoList['noSpreadHouseList']);
     }
     /** 精选引导优化 (精选城市 && 已经购买了套餐 && 推广房源数>0) */
     $choiceFunctionOptimizationGuide = false;
     /*
      if ($isChoiceCity && (!empty($currentCombo) || !empty($nextCombo)) && (count($comboSpreadHouseList) > 0)) {
          if (Bll_Broker_AjkBrokerGuideNew::getGuideStatus($brokerId, 'Choice_Function_Optimization') == 0) {
              $choiceFunctionOptimizationGuide = true;
          }
      }
     */
     $pageParams['choiceFunctionOptimizationGuide'] = $choiceFunctionOptimizationGuide;
     //echo "<pre>";print_r(array_keys($houseInfoList));exit;
     return array_merge($pageParams, $houseInfoList);
 }