Example #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;
 }
Example #2
0
 /**
  * 判断二手房经纪人是否可以发布房源
  *
  * @param int $cityId
  * @param int $brokerId
  * @throws Exception
  * @return bool
  */
 public static function checkEsfBrokerCanPublishHouse($cityId, $brokerId)
 {
     $houseList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId, array('proId', 'operateState'));
     /** 获取发放数限制 */
     //        $brokerLimitInfo = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($brokerId, Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ESF_SITE);
     //        if (!$brokerLimitInfo || !isset($brokerLimitInfo['publishLimit'])) {
     //            throw new Exception('系统繁忙');
     //        }
     //        $publishLimit = intval($brokerLimitInfo['publishLimit']);
     /** 获取发放数限制 */
     $proLimitInfo = Bll_Onoff_Prop::getPropLimit($cityId, "ajk");
     if (!$proLimitInfo['status'] || !isset($proLimitInfo['data']['publishLimit'])) {
         throw new Exception('系统繁忙');
     }
     $publishLimit = intval($proLimitInfo['data']['publishLimit']);
     return count($houseList) < $publishLimit;
 }
Example #3
0
 public static function publishHouseMaxNum($intBrokerId)
 {
     //        $limitInfo = self::getBrokerLimitForApi($intBrokerId);
     //        if ($limitInfo['publishLimit']) {
     //            return $limitInfo['publishLimit'];
     //        } else {
     //            return Model_House_JpHouseIdx::HOUSE_LIMIT;
     //        }
     $proLimitInfo = Bll_Onoff_Prop::getPropLimit(0, "jp");
     if ($proLimitInfo['status'] && isset($proLimitInfo['data']['publishLimit'])) {
         return $proLimitInfo['data']['publishLimit'];
     } else {
         return Model_House_JpHouseIdx::HOUSE_LIMIT;
     }
 }