示例#1
0
 /**
  * 处理post
  * @param $esfProIds
  * @param $zfProIds
  * @param $getBrokerResActivity
  */
 private function doPost($esfProIds, $zfProIds, $getBrokerResActivity)
 {
     $insertEsfData = array();
     $insertZfData = array();
     //二手房
     if (!empty($esfProIds)) {
         $esfProIdsAll = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         //过滤不属于该经济人的推广房源和已经参加活动的房源
         foreach ($esfProIds as $key => $val) {
             if (!in_array($val, $esfProIdsAll)) {
                 unset($esfProIds[$key]);
             }
             if (!empty($getBrokerResActivity[$val])) {
                 unset($esfProIds[$key]);
             }
         }
         if (!empty($esfProIds)) {
             $esfProInfos = Bll_House_EsfHouse::getHouseInfo($esfProIds, $this->cityId);
             foreach ($esfProInfos as $key => $val) {
                 $insertEsfData[] = array('proId' => $val['proId'], 'brokerId' => $this->brokerId, 'cityId' => $this->cityId, 'siteType' => Bll_Activity_Res_ProInfo::SITE_TYPE_AJK, 'proContent' => json_encode(Bll_Activity_Res_ProInfo::getEsfShowInfo($val)), 'addTime' => time());
             }
         }
     }
     //租房
     if (!empty($zfProIds)) {
         $zfProIdsAll = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         foreach ($zfProIds as $key => $val) {
             if (!in_array($val, $zfProIdsAll)) {
                 unset($zfProIds[$key]);
             }
             if (!empty($getBrokerResActivity[$val])) {
                 unset($zfProIds[$key]);
             }
         }
         if (!empty($zfProIds)) {
             $zfProInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($zfProIds, $this->cityId);
             //房源主表信息
             $propMainInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($zfProIds);
             $propMainNew = array();
             foreach ($propMainInfo as $val) {
                 $propMainNew[$val['propId']]['contentBasic'] = json_decode($val['contentBasic'], true);
                 $propMainNew[$val['propId']]['contentOther'] = json_decode($val['contentOther'], true);
             }
             foreach ($zfProInfos as $key => $val) {
                 $insertZfData[] = array('proId' => $val['proid'], 'brokerId' => $this->brokerId, 'cityId' => $this->cityId, 'siteType' => Bll_Activity_Res_ProInfo::SITE_TYPE_HZ, 'proContent' => json_encode(Bll_Activity_Res_ProInfo::getZfShowInfo($val, $propMainNew)), 'addTime' => time());
             }
         }
     }
     //合并
     $insertData = array_merge($insertEsfData, $insertZfData);
     foreach ($insertData as $proInfo) {
         Bll_Activity_Res_ProInfo::insertBrokerResActivityPropInfo($proInfo);
         $ProPlanChangeApiBll = Bll_ProPlanChangeApiBll::get_instance();
         $ProPlanChangeApiBll->insertProPlanChange(array('broker_id' => $this->brokerId, 'pro_id' => $proInfo['proId'], 'type' => 'ACTIVITY_RES_ADD', 'from' => __CLASS__, 'remark' => '房源季用户参加活动房源', 'site_type' => $proInfo['siteType']), 0);
     }
 }
示例#2
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $this->cityId = $request->getBrokerCityId();
     $this->brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     if ($params['action'] == 'dealInfoSubmit') {
         $this->doPost($params);
         $this->redirect('/ajkbroker/res/activity');
     }
     //判断活动是否开始
     $pageAttributes['activityStatus'] = Bll_City_BizType::isOnActivity($this->cityId, 4, Const_CityBizType::TYPE_ACTIVITY_RES);
     //如果用户有确认成交房源信息,显示倒计时
     if (Bll_Activity_Res_ProInfo::getResProTransactionRecords($this->brokerId)) {
         $pageAttributes['showTimes'] = 1;
     }
     //倒计时
     $startTime = '2015-03-31 00:00:00';
     //活动开始时间
     $endTime = '2015-05-01 00:00:00';
     //活动截至时间
     $now = time();
     $lastDayNum = (strtotime($endTime) - $now) / (24 * 3600);
     $pageAttributes['lastDayNum'] = ceil($lastDayNum);
     if ($pageAttributes['lastDayNum'] <= 0) {
         //todo 获奖名单 二期
     }
     //获取经纪人抽奖次数
     $num = Bll_Activity_Res_RealEstateSeasonBrokerLuckDraw::getBrokerLuckDrawNum($this->brokerId);
     //已经抽奖
     if ($num == 0) {
         $pageAttributes['luckDrawStatus'] = 1;
         //显示抽奖信息
         $luckDrawInfo = Bll_Activity_Res_RealEstateSeasonBrokerLuckDraw::getBrokerPrizeByBrokerId($this->brokerId);
         $prizeInfo = Bll_Activity_Res_RealEstateSeasonBrokerLuckDraw::getBrokerActionTypeByBrokerId($luckDrawInfo[0]['prizeId']);
         $pageAttributes['actionType'] = $prizeInfo['actionType'];
         $pageAttributes['remark'] = $prizeInfo['remark'];
         $pageAttributes['prize_recode_id'] = $luckDrawInfo[0]['id'];
         $pageAttributes['prize_recode_remark'] = $luckDrawInfo[0]['remark'];
         $pageAttributes['prize_recode_prize_name'] = $luckDrawInfo[0]['prizeName'];
     }
     //显示立即抽奖
     if ($num > 0) {
         $pageAttributes['luckDrawStatus'] = 2;
     }
     //获取经纪人已经参加活动房源
     $getBrokerResActivity = Bll_Activity_Res_ProInfo::getBrokerResActivityPropInfo($this->brokerId);
     if (count($getBrokerResActivity) < 10) {
         $pageAttributes['luckDrawStatus'] = 3;
     }
     $esfData = array();
     $orderByEsfProId = array();
     $zfData = array();
     $orderByZfProId = array();
     foreach ($getBrokerResActivity as $val) {
         //参数初始化
         $proInfo = array();
         //获取房源信息
         if ($val['siteType'] == Bll_Activity_Res_ProInfo::SITE_TYPE_AJK) {
             $proInfo = Bll_House_EsfHouse::getHouseInfo($val['proId'], $val['cityId']);
             $proInfo = !empty($proInfo) ? Bll_Activity_Res_ProInfo::getEsfShowInfo($proInfo) : array();
         } else {
             $proInfo = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($val['proId'], $val['cityId']);
             $propMainInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($val['proId']);
             $propContentBasic[$val['proId']]['contentBasic'] = json_decode($propMainInfo['contentBasic'], true);
             //租房的所有信息可以从getHzProInfoByIds里面查到
             $proInfo = $proInfo[0];
             $proInfo = !empty($proInfo) ? Bll_Activity_Res_ProInfo::getZfShowInfo($proInfo, $propContentBasic) : array();
         }
         //如果房源信息查不到,使用快照里面的数据
         if (empty($proInfo)) {
             $proInfo = json_decode($val['proContent'], true);
         }
         $proInfo['status'] = $val['status'];
         //二手房、租房数据拆分
         if ($val['siteType'] == Bll_Activity_Res_ProInfo::SITE_TYPE_AJK) {
             $esfData[] = $proInfo;
             $orderByEsfProId[] = $proInfo['id'];
         } else {
             $zfData[] = $proInfo;
             $orderByZfProId[] = $proInfo['id'];
         }
     }
     //按房源id排序
     array_multisort($orderByEsfProId, SORT_DESC, $esfData);
     array_multisort($orderByZfProId, SORT_DESC, $zfData);
     $pageAttributes['esfData'] = $esfData;
     $pageAttributes['zfData'] = $zfData;
     $pageAttributes['error'] = $params['message'];
     $this->set_attributes($pageAttributes);
     return 'Activity_Res_Activity';
 }