예제 #1
0
 /**
  * 组装套餐列表
  * @param $out
  */
 public static function prepareComboList(&$out)
 {
     // 获取套餐信息
     $out['comboInfos'] = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($out['ajkBrokerId'], Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ);
     if (count($out['comboInfos']) > 0) {
         $currentCombo = $out['comboInfos'][0];
         // 套餐打通
         if (isset($currentCombo['openUp']) && $currentCombo['openUp'] == 1) {
             $spreadPropNum = $currentCombo['salePropNum'] + $currentCombo['rentPropNum'] + $currentCombo['jpPropNum'];
             // 减去二手房正在推广数
             $ajkSpreadList = Bll_Combo_HouseRelation::getHouseRelations($out['ajkBrokerId'], Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1);
             $out['spreadPropNum'] = $spreadPropNum - count($ajkSpreadList);
         } else {
             $out['spreadPropNum'] = $currentCombo['rentPropNum'];
         }
     }
     // 获取套餐点击量
     // $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($out['ajkBrokerId'], date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_HZ);
     // $out['comboClick'] = $comboClick ? $comboClick : 0;
     // 获取套餐推广关系列表
     $out['comboList'] = Bll_Combo_HouseRelation::getHouseRelations($out['ajkBrokerId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
     $temProps = array();
     if (count($out['comboList'])) {
         foreach ($out['comboList'] as $k => $comboInfo) {
             // 转换房子id下标数组
             $out['comboList'][$comboInfo['houseId']] = $comboInfo;
             unset($out['comboList'][$k]);
             if (isset($out['props'][$comboInfo['houseId']])) {
                 $temProps[] = $out['props'][$comboInfo['houseId']];
             }
             // 非有效房源过滤
             $proId = $comboInfo['houseId'];
             // 房子无效 关系还在, 过滤掉
             if (!isset($out['props'][$proId])) {
                 unset($out['comboList'][$proId]);
                 continue;
             }
             $propInfo = $out['props'][$proId];
             if (!in_array($propInfo['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) {
                 continue;
             }
             unset($out['comboList'][$proId]);
         }
     }
     // 获取定价房子可否精选状态
     if ($out['isChoiceCity']) {
         $out['propChoiceStatus'] = Bll_HzProp::getPropChoiceStatus($temProps, $out['cityId']);
     }
 }
예제 #2
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;
 }