예제 #1
0
 /**
  * 基础权限判断模块
  */
 public function basicCheck()
 {
     $ajkBrokerId = $this->requestObj->getBrokerId();
     $cityId = $this->requestObj->getBrokerCityId();
     $this->ctx = $this->requestObj->get_parameters();
     // 非登陆者
     if (!$ajkBrokerId) {
         $this->responseObj->redirect(Uri_MemberUrl::build_login_url($this->currentUrl));
     }
     if (!($hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId))) {
         $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, $this->site, $this->action);
     }
     $routeMatches = $this->requestObj->get_router_matches();
     $this->ctx['proId'] = isset($routeMatches[3]) ? (int) $routeMatches[3] : 0;
     $this->ctx['isEdit'] = (int) ($this->ctx['proId'] > 0);
     // ppc 没有计划 初始化个
     $planId = 0;
     $planStatus = 1;
     if (!($isComboCity = Bll_City::isComboCity($cityId))) {
         $validFixPlans = Bll_Plan_Fix_HzFix::getValidPlansByBrokerId($hzBrokerId);
         if (empty($validFixPlans)) {
             $createPlanResult = Bll_Plan_Fix_HzFix::createPlan($ajkBrokerId, $cityId, '定价推广组');
             if (!$createPlanResult['status']) {
                 $this->redirect2Result(Const_PublishCode::CREATE_PLAN_ERROR, $this->site, $this->action);
             }
             $planId = $createPlanResult['msg']['id'];
         } else {
             $planId = $validFixPlans[0]['id'];
             $planStatus = $validFixPlans[0]['status'];
         }
     }
     $this->ctx['hzBrokerId'] = $hzBrokerId;
     $this->ctx['ajkBrokerId'] = $ajkBrokerId;
     $this->ctx['isFixCity'] = (int) (!$isComboCity);
     $this->ctx['isComboCity'] = (int) $isComboCity;
     $this->ctx['cityId'] = $cityId;
     // 发房数判断
     $propNums = count(Bll_House_HzHouse::getValidPropsByBrokerIdEx($this->ctx['ajkBrokerId'], $this->ctx['cityId'], false));
     // 获取套餐相关
     //        $brokerLimitInfo = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($ajkBrokerId, Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     $proLimitInfo = Bll_Onoff_Prop::getPropLimit($this->ctx['cityId'], "hz");
     if (!$this->ctx['isEdit'] && $propNums >= $proLimitInfo['data']['publishLimit']) {
         $this->redirect2Result(Const_PublishCode::PUBLISH_OUT_OF_LIMIT, $this->site, $this->action);
     }
     // 伪登陆操作限制
     $managerCookie = $this->requestObj->get_cookie('manager_id');
     $this->ctx['isManagerCookie'] = $managerCookie ? true : false;
     $this->ctx['planId'] = $planId;
     $this->ctx['planStatus'] = $planStatus;
     $this->ctx['brokerLimitInfo'] = $proLimitInfo['data'];
     $this->ctx['debug'] = isset($_GET['debug']) ? trim($_GET['debug']) : false;
     return true;
 }
예제 #2
0
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
       if (!$balance['status'])
           throw new Exception_BllErrorException($balance['msg']);
       $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
       */
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     $out['bidTip'] = '精选';
     // 获取经纪人信息
     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['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']);
     // 获取改经纪人所有房源质量
     //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props']));
     $out['propsQuality'] = static::getHzPropsQuality($out['props']);
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $proId => $prop) {
             $out['props'][$proId]['proId'] = $proId;
             // 获取剩余时间
             $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']);
             // 是否手机房源
             $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : '');
         }
     }
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
예제 #3
0
 /**
  *
  * 根据经纪人查询套餐房源的标签(优、良、中、待评)
  * 根据房源的rank大段
  * @param $brokerId
  * @param $siteType
  * @return array
  * $result['list'][proid]['rankStar'] 大段
  * $result['list'][proid]['rankStarName'] 大段名称
  * $result['count'][0][rankStar] 各大段的数量标记
  * $result['count'][0][rankStarName] 各大段的数量名称
  * $result['count'][0][rankStarNum] 各大段的数量
  */
 public static function getBrokerComboProRank($brokerId, $siteType, $cityId = '')
 {
     //标签返回值
     $result = array();
     switch ($siteType) {
         case 'ajk':
             //二手房
             //分类计算标签数量
             $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质');
             //获取经纪人套餐房源
             $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1);
             $houseIds = array();
             foreach ($comboList as $combo) {
                 $houseIds[$combo['houseId']] = $combo['houseId'];
             }
             if (empty($houseIds)) {
                 return $result;
             }
             $houseInfo = array();
             foreach ($comboList as $combo) {
                 $houseInfo['houseIdList'][] = $combo['houseId'];
                 $tmp = array('proId' => $combo['houseId'], 'postDate' => strtotime($combo['created']), 'cityId' => $combo['cityId']);
                 $houseInfo['comboSpreadHouseList'][$combo['houseId']] = $tmp;
             }
             if (empty($houseInfo)) {
                 return $result;
             }
             $housePostDate = array();
             $housePostDateTmp = Bll_House_EsfHouse::getHouseInfo($houseInfo['houseIdList'], $cityId);
             foreach ($housePostDateTmp as $k => $v) {
                 $housePostDate[$v['proId']] = $v;
             }
             foreach ($houseInfo['comboSpreadHouseList'] as $k => &$v) {
                 $v['postDate'] = $housePostDate[$k]['postDate'];
             }
             //获取房源的标签
             $houseSollyResultList = Bll_House_EsfHouse::getHouseRankEx($houseInfo);
             $houseRank = array();
             foreach ($houseSollyResultList as $houseSollyResult) {
                 $houseRank[$houseSollyResult['propId']] = $houseSollyResult['rankStar'];
             }
             //标签数量计算
             foreach ($houseIds as $houseId) {
                 if (isset($rankTips[$houseRank[$houseId]])) {
                     $rankStar = $houseRank[$houseId];
                 } else {
                     $rankStar = 0;
                 }
                 //数据列表
                 $result['list'][$houseId]['rankStar'] = $rankStar;
                 $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar];
                 //统计数据
                 $result['count'][$rankStar]['rankStar'] = $rankStar;
                 $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar];
                 if (isset($result['count'][$rankStar]['rankStarNum'])) {
                     $result['count'][$rankStar]['rankStarNum'] += 1;
                 } else {
                     $result['count'][$rankStar]['rankStarNum'] = 1;
                 }
             }
             break;
         case 'hz':
             //租房
             //分类计算标签数量
             $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质');
             //获取经纪人套餐房源
             $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
             $houseIds = array();
             foreach ($comboList as $combo) {
                 $houseIds[$combo['houseId']] = $combo['houseId'];
             }
             if (empty($houseIds)) {
                 return $result;
             }
             //获取房源的标签
             //$houseSollyResultList = Model_Stats_HzPropQuality::getPropsqualityv2($houseIds);
             $houseInfo = array();
             $tmp = array();
             foreach ($comboList as $v) {
                 $tmp['propId'] = $v['houseId'];
                 $tmp['cityid'] = $v['cityId'];
                 $tmp['created'] = strtotime($v['created']);
                 $houseInfo[$v['houseId']] = $tmp;
                 $tmp = array();
             }
             $housePostDate = array();
             $housePostDateTmp = Bll_House_HzHouse::getValidPropsByBrokerIdEx($brokerId, $cityId);
             foreach ($housePostDateTmp as $k => $v) {
                 $housePostDate[$v['proid']] = $v;
             }
             foreach ($houseInfo as $k => &$v) {
                 $v['created'] = $housePostDate[$k]['created'];
             }
             $houseSollyResultListTmp = Bll_Broker_Combo_ManageHz::getHzPropsQuality($houseInfo);
             foreach ($houseSollyResultListTmp as $v) {
                 $tmp['cityId'] = $v['cityId'];
                 $tmp['proId'] = $v['proId'];
                 $tmp['rank'] = $v['rank'];
                 $houseSollyResultList[] = $tmp;
             }
             $houseRank = array();
             foreach ($houseSollyResultList as $houseSollyResult) {
                 $houseRank[$houseSollyResult['proId']] = $houseSollyResult['rank'];
             }
             //标签数量计算
             foreach ($houseIds as $houseId) {
                 if (isset($rankTips[$houseRank[$houseId]])) {
                     if ($houseRank[$houseId] == 1) {
                         $rankStar = 3;
                         //优
                     } elseif ($houseRank[$houseId] == 2) {
                         $rankStar = 2;
                         //良
                     } elseif ($houseRank[$houseId] == 3) {
                         $rankStar = 1;
                         //中
                     } else {
                         $rankStar = 0;
                         //优
                     }
                 } else {
                     $rankStar = 0;
                 }
                 //数据列表
                 $result['list'][$houseId]['rankStar'] = $rankStar;
                 $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar];
                 //统计数据
                 $result['count'][$rankStar]['rankStar'] = $rankStar;
                 $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar];
                 if (isset($result['count'][$rankStar]['rankStarNum'])) {
                     $result['count'][$rankStar]['rankStarNum'] += 1;
                 } else {
                     $result['count'][$rankStar]['rankStarNum'] = 1;
                 }
             }
             break;
         case 'jp':
             //金铺
             $exquisite = array(1 => '精品', 2 => '非精品');
             //获取经纪人套餐房源
             $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_JP, 1);
             $houseIds = array();
             foreach ($comboList as $combo) {
                 $houseIds[$combo['houseId']] = $combo['houseId'];
             }
             if (empty($houseIds)) {
                 return $result;
             }
             //获取房源的标签
             $jpOfficeRent = Model_House_JpOfficeRent::getPropInfoByIds($houseIds);
             $jpOfficeSale = Model_House_JpOfficeSale::getPropInfoByIds($houseIds);
             $jpShopRent = Model_House_JpShopRent::getPropInfoByIds($houseIds);
             $jpShopSale = Model_House_JpShopSale::getPropInfoByIds($houseIds);
             $houseSollyResultList = array_merge($jpOfficeRent, $jpOfficeSale, $jpShopRent, $jpShopSale);
             $houseExquisite = array();
             foreach ($houseSollyResultList as $houseSollyResult) {
                 $houseExquisite[$houseSollyResult['id']] = $houseSollyResult['isExquisite'];
             }
             //标签数量计算
             foreach ($houseIds as $houseId) {
                 if (isset($exquisite[$houseExquisite[$houseId]])) {
                     $exquisiteStar = $houseExquisite[$houseId];
                 } else {
                     $exquisiteStar = 2;
                 }
                 //数据列表
                 $result['list'][$houseId]['exquisiteStar'] = $exquisiteStar;
                 $result['list'][$houseId]['exquisiteStarName'] = $exquisite[$exquisiteStar];
                 //统计数据
                 $result['count'][$exquisiteStar]['exquisiteStar'] = $exquisiteStar;
                 $result['count'][$exquisiteStar]['exquisiteStarName'] = $exquisite[$exquisiteStar];
                 if (isset($result['count'][$exquisiteStar]['exquisiteStarNum'])) {
                     $result['count'][$exquisiteStar]['exquisiteStarNum'] += 1;
                 } else {
                     $result['count'][$exquisiteStar]['exquisiteStarNum'] = 1;
                 }
             }
             break;
         default:
             break;
     }
     return $result;
 }