Ejemplo n.º 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;
 }
Ejemplo n.º 2
0
 /**
  * 创建计划
  */
 public function do_createPlan()
 {
     return Bll_Plan_Fix_HzFix::createPlan($this->brokerId, $this->cityId, $this->params['title']);
 }
Ejemplo n.º 3
0
 /**
  * 组装定价列表
  * @param $out
  * @return array
  * @throws Exception
  */
 private static function prepareFixList(&$out)
 {
     $fixList = array();
     $out['planId'] = 0;
     $out['props'] = array();
     $out['fixPropIds'] = array();
     // 获取房源关系列表
     $brokerProps = Bll_Broker_HzBroker::getBrokerProps($out['ajkBrokerId'], $out['cityId']);
     if (!$brokerProps['status']) {
         throw new Exception($brokerProps['msg']);
     }
     $brokerProps = $brokerProps['msg'];
     $plans = $brokerProps['plans'];
     $plannings = $brokerProps['plannings'];
     $propsTemp = $brokerProps['props'];
     if (empty($plans)) {
         // 没有有效计划 初始化一个
         Bll_Plan_Fix_HzFix::createPlan($out['ajkBrokerId'], $out['cityId'], '定价推广组');
         return $fixList;
     }
     $planIds = array();
     foreach ($plans as $plan) {
         $planIds[] = $plan['planId'];
     }
     // 转换成proid下标方便索引
     if (count($propsTemp) > 0) {
         foreach ($propsTemp as $prop) {
             $out['props'][$prop['proId']] = $prop;
         }
     }
     // 获取计划的消费 点击信息
     $responseConsumClickInfos = Bll_Plan_Fix_HzFix::getPlanConsumClickInfo($planIds, $out['cityId'], $out['ajkBrokerId']);
     if (!$responseConsumClickInfos['status']) {
         throw new Exception($responseConsumClickInfos['msg']);
     }
     $responseConsumClickInfos = $responseConsumClickInfos['msg'];
     // 分组
     $temProps = array();
     foreach ($plans as $plan) {
         $planId = $plan['planId'];
         $fixList[$planId] = $plan;
         // 组装计划的消费 点击量信息
         foreach ($responseConsumClickInfos[$planId] as $field => $value) {
             $fixList[$planId][$field] = $value;
         }
         // 非在线 获取停止信息
         if ($plan['status'] != 1) {
             $fixList[$planId]['stopInfo'] = Bll_Plan_Fix_HzFix::getStopInfoByStatus($plan['status'], $out['isPassVerify']);
         }
         if (empty($plannings)) {
             $fixList[$planId]['plannings'] = array();
             continue;
         }
         // 关系需要按照推广时间最新排在前面
         usort($plannings, function ($a, $b) {
             return strtotime($a['lastUpdated']) > strtotime($b['lastUpdated']) ? -1 : 1;
         });
         foreach ($plannings as $k => $planning) {
             $proId = $planning['proId'];
             // 非有效 过滤掉
             if (!Bll_HzFixPlan::isValidPlanning($planning['isValid'])) {
                 unset($out['props'][$proId]);
                 continue;
             }
             if ($planning['planId'] != $planId) {
                 continue;
             }
             // 组装关系
             $fixList[$planId]['plannings'][$k] = $planning;
             // 组装房子
             $fixList[$planId]['plannings'][$k]['prop'] = isset($out['props'][$proId]) ? $out['props'][$proId] : array();
             // 获取剩余时间
             $fixList[$planId]['plannings'][$k]['prop']['leftDays'] = Bll_House_HzHouse::getLeftDays($out['props'][$proId]['created']);
             $out['fixPropIds'][$proId] = $proId;
             $temProps[] = $fixList[$planId]['plannings'][$k]['prop'];
         }
         $out['planId'] = $planId;
     }
     // 获取定价房子可否精选状态
     if ($out['isChoiceCity']) {
         $out['propChoiceStatus'] = Bll_HzProp::getPropChoiceStatus($temProps, $out['cityId']);
     }
     return $fixList;
 }