Ejemplo n.º 1
0
 public function handle_request_combo()
 {
     $ajkBrokerId = $this->brokerId;
     //获取经纪人套餐推广今日点击量
     $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($ajkBrokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_HZ);
     $comboList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId);
     $propIds = array();
     foreach ($comboList as $row) {
         $propIds[] = $row['houseId'];
     }
     $propertyList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $this->cityId);
     foreach ($propertyList as $key => $list) {
         $row['publishDays'] = floor((time() - $list['created']) / 86400);
         if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
             unset($propertyList[$key]);
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $comboClick, 'totalProps' => count($propertyList)));
 }
Ejemplo n.º 2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         throw new Exception_ISNotComboBrokerException('不是套餐经纪人。');
     }
     /** 套餐信息 */
     $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId);
     $currentDate = time();
     foreach ($comboInfoList as $comboInfo) {
         $startDate = strtotime($comboInfo['startTime']);
         $endDate = strtotime($comboInfo['endTime']);
         /** 获取当前使用的套餐 */
         if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) {
             $currentCombo = $comboInfo;
             break;
         }
     }
     //获取经纪人套餐推广今日点击量
     $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK);
     //经纪人没有套餐
     if (!isset($currentCombo)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => 0));
     }
     $cityId = $brokerInfo->cityId;
     //获取套餐推广信息
     $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId);
     //获取房源信息
     $propIds = array_keys($comboSpreadHouseList);
     if ($propIds) {
         $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId);
         $propsNum = count($propsInfo);
     } else {
         $propsNum = 0;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => $propsNum));
 }
Ejemplo n.º 3
0
 /**
  * 获取租房房源数据
  * [getBrokerEsfPro description]
  */
 private function getBrokerZfPro()
 {
     $data = $proClickInfo = array();
     $isCombo = Bll_Combo_HouseRelation::isComboCity($this->cityId);
     if ($isCombo['data']) {
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($this->brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         $proIds = $this->getObjFieldInfo($comboList, 'houseId');
         $clicksInfo = Bll_Ppc_NewPackageStatsBrokerDay::getHouseComboClickInfo($proIds, date('Ymd'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ);
         if (!empty($clicksInfo)) {
             foreach ($clicksInfo as $val) {
                 if (isset($proClickInfo[$val['propId']])) {
                     $proClickInfo[$val['propId']] += intval($val['cnum']);
                 } else {
                     $proClickInfo[$val['propId']] = intval($val['cnum']);
                 }
             }
         }
     } else {
         $hzBrokerId = Bll_Broker_BrokerCheckInfo::getHzBrokerIdByAjkBrokerId($this->brokerId);
         //定价房源信息
         $fixedProInfos = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProInfo($hzBrokerId);
         if (empty($fixedProInfos)) {
             $this->outData($data, 1);
         }
         $proIds = $this->getObjFieldInfo($fixedProInfos, 'proid');
         //房源点击量信息
         $proClicks = Bll_House_HzPro::getInstance()->getProClicks($proIds, array(), date('Ymd'));
         if (!empty($proClicks)) {
             //将房源ID作为key拼接点击量信息
             foreach ($proClicks as $proClickVal) {
                 $proClickInfo[$proClickVal['proid']] = intval($proClickVal['cnt']);
             }
         }
     }
     $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $this->cityId);
     if (empty($proInfos)) {
         $this->outData($data, 1);
     }
     //经纪人橱窗房源设置信息
     $adProInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($this->brokerId);
     $addPro = array();
     if (!empty($adProInfos)) {
         foreach ($adProInfos as $adProVal) {
             $addPro[$adProVal->propId] = true;
         }
     }
     //房源主表信息
     $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds);
     $propMianNew = array();
     foreach ($propMianInfo as $propMianVal) {
         $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true);
         $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true);
     }
     $this->initZfProData($proInfos, $proClickInfo, $addPro, $propMianNew);
 }
Ejemplo n.º 4
0
 public static function JpComboHouseClick($houseIds, $type)
 {
     $return = array();
     if (!is_array($houseIds)) {
         $houseIds = array($houseIds);
     }
     $clicksP = Bll_Ppc_NewPackageStatsBrokerDay::getHouseComboClickInfo($houseIds, date('Ymd'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_JP);
     //先取今天点击
     $clicks = array();
     foreach ($clicksP as $clickP) {
         $clicks[$clickP['propId']] = intval($clickP['cnum']);
     }
     if ($type == 'today') {
         foreach ($houseIds as $houseId) {
             $return[$houseId] = intval($clicks[$houseId]);
         }
     } elseif ($type == 'all') {
         $historyClick = self::getPropHistoryComboClick($houseIds);
         foreach ($houseIds as $houseId) {
             $return[$houseId] = intval($clicks[$houseId]) + intval($historyClick[$houseId]);
         }
     }
     return Util_GlobalFunc::buildReturn(1, $return);
 }
Ejemplo n.º 5
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);
 }