/** * 获取租房房源列表信息 * @return array */ private function getBrokerZfPro() { //获取经纪人参加活动租房房源id $proIds = $this->getProIdsByBrokerId(Bll_Combo_HouseRelation::SITE_TYPE_HZ); //获取经纪人参加活动租房房源详细信息 $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $this->cityId); //租房房源主表信息 $propMainInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMainNew = array(); foreach ($propMainInfo as $val) { $propMainNew[$val['propId']]['contentBasic'] = json_decode($val['contentBasic'], true); $propMainNew[$val['propId']]['contentOther'] = json_decode($val['contentOther'], true); } //获取经纪人已经参加活动房源 $getBrokerResActivity = Bll_Activity_Res_ProInfo::getBrokerResActivityPropInfo($this->brokerId); $resActivityNum = count($getBrokerResActivity); //过滤已经参加活动租房房源,同时返回必须参数(参数拼接) $result = Bll_Activity_Res_ProInfo::getCanSetZfProList($proInfos, $propMainNew, $getBrokerResActivity); //根据最新发布时间排序 array_multisort($result['orderByZfProId'], SORT_DESC, $result['data']); return $pageAttributes = array('data' => $result['data'], 'resActivityNum' => $resActivityNum, 'resActivityNumLeave' => 10 - $resActivityNum); }
/** * 获取租房房源数据 * [getBrokerEsfPro description] */ private function getBrokerZfPro() { $data = $proClickInfo = array(); $isCombo = Bll_Combo_HouseRelation::isComboCity($this->cityId); if ($isCombo['data']) { $comboList = Bll_Combo_HouseRelation::getHouseRelations($this->brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); $proIds = $this->getObjFieldInfo($comboList, 'houseId'); $clicksInfo = Bll_Ppc_NewPackageStatsBrokerDay::getHouseComboClickInfo($proIds, date('Ymd'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ); if (!empty($clicksInfo)) { foreach ($clicksInfo as $val) { if (isset($proClickInfo[$val['propId']])) { $proClickInfo[$val['propId']] += intval($val['cnum']); } else { $proClickInfo[$val['propId']] = intval($val['cnum']); } } } } else { $hzBrokerId = Bll_Broker_BrokerCheckInfo::getHzBrokerIdByAjkBrokerId($this->brokerId); //定价房源信息 $fixedProInfos = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProInfo($hzBrokerId); if (empty($fixedProInfos)) { $this->outData($data, 1); } $proIds = $this->getObjFieldInfo($fixedProInfos, 'proid'); //房源点击量信息 $proClicks = Bll_House_HzPro::getInstance()->getProClicks($proIds, array(), date('Ymd')); if (!empty($proClicks)) { //将房源ID作为key拼接点击量信息 foreach ($proClicks as $proClickVal) { $proClickInfo[$proClickVal['proid']] = intval($proClickVal['cnt']); } } } $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $this->cityId); if (empty($proInfos)) { $this->outData($data, 1); } //经纪人橱窗房源设置信息 $adProInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($this->brokerId); $addPro = array(); if (!empty($adProInfos)) { foreach ($adProInfos as $adProVal) { $addPro[$adProVal->propId] = true; } } //房源主表信息 $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMianNew = array(); foreach ($propMianInfo as $propMianVal) { $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true); $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true); } $this->initZfProData($proInfos, $proClickInfo, $addPro, $propMianNew); }
/** * 处理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); } }
public function handle_request_internal() { if (!Bll_City::isShowCaseCity(static::$intBrokerCityID)) { $this->redirect('/user/combo/brokerhome'); exit; } //获取经纪人id $objRequest = APF::get_instance()->get_request(); $cityid = self::$BrokerInfo['BaseInfo']['CITYID']; $objRequest->set_attribute('PayType', self::$BrokerInfo['BaseInfo']['PAYTYPE']); $isCombo = Bll_Combo_HouseRelation::isComboCity($cityid); $tmp = array('cityId' => $cityid, 'status' => 1, 'startDate' => date('Ymd')); $cityPrice = Bll_Broker_ConfigCityPrice::getInstance()->getCityPrice($tmp, Const_ShowcaseOrders::RENT_DB); $todayPrice = round($cityPrice->discountPrice / 100, 2); $intBrokerID = $objRequest->getBrokerId(); //好租经纪人ID $hzBrokerId = Bll_Broker_BrokerCheckInfo::getHzBrokerIdByAjkBrokerId($intBrokerID); $userId = $objRequest->getUserId(); $data = array('brokerId' => $intBrokerID); $orderinfo = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerOrders($data, $this->db); //判断经纪人是否有订单 if (!$orderinfo) { $this->toManage('/ajkbroker/showcase/zf/'); } $lavedays = ceil((strtotime($orderinfo->endDate) - strtotime(date('Ymd'))) / 3600 / 24); if ($orderinfo->isStop == 1 || $lavedays < 0) { $order_status = 'stop'; } else { $objRequest->set_attribute('lavedays', $lavedays); $objRequest->set_attribute('lastday', date('Y-m-d', strtotime($orderinfo->endDate))); $order_status = 'open'; } //获取参数值 $params = APF::get_instance()->get_request()->get_parameters(); $days = intval($params['days']); //status=2是停止,status=1是续费 if ($params['status'] == 2) { if ($orderinfo->isStop == 0) { $stopstatus = Bll_Broker_ShowcaseOrders::getInstance()->stopBrokerOthers($orderinfo, $cityPrice->discountPrice, $this->db); if ($stopstatus['status']) { $this->toManage(); } else { $this->toError($stopstatus['msg']); } } else { $msg = '订单类型不能操作'; $this->toError($msg); } } elseif ($params['status'] == 1 && $days >= 1) { $BrokerMoney = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerMoney($userId); if ($BrokerMoney < $todayPrice) { $this->toError(Const_ShowcaseOrders::MONEY_NOT_ENOUGH); } $Continueorder = Bll_Broker_ShowcaseOrders::getInstance()->continueBrokerOthers($orderinfo, $days, $cityPrice->discountPrice, $this->db); if ($Continueorder['status']) { $this->toManage(); } else { $this->toError($Continueorder['msg']); } } elseif ($params['status'] == 3) { if (!empty($params['rooms'])) { $proIds = explode(';', $params['rooms']); $filterProIds = Bll_Broker_ShowcaseAdSetPro::getInstance()->filterProIds($intBrokerID, $cityid, $this->db, $proIds); //有些房源不在线上展示 if (count($filterProIds) != count($proIds)) { $this->toError('有些房源没在线上推广,操作失败!'); } $res = Bll_Broker_ShowcaseAdSetPro::getInstance()->insertAdProsInfo($intBrokerID, $cityid, $proIds, $this->db); if (!$res['status']) { $this->toError($res['msg']); } else { //插入成功,跳转至管理页面 if ($orderinfo->isStop == 0) { $log = array(); $log['brokerId'] = $orderinfo->brokerId; $log['cityId'] = $orderinfo->cityId; $log['endDate'] = $orderinfo->endDate; $log['startDate'] = $orderinfo->startDate; $log['opType'] = Const_ShowcaseOrders::OPTYPE_6; $log['totalDays'] = ceil((strtotime($orderinfo->endDate) - strtotime($orderinfo->startDate)) / 3600 / 24) + 1; $log['createTime'] = time(); Bll_Broker_ShowcaseOrders::getInstance()->insertSetLog($log, $this->db); } $this->toManage(); } } } $orderCreated = date('Ymd', $orderinfo->createTime); if ($orderCreated < date('Ymd')) { $click = Bll_Broker_ShowcaseOrders::getInstance()->getBrokerClick($intBrokerID, date('Ymd', strtotime('-1 days')), $this->db); if (!$click->quantityCount) { $objRequest->set_attribute('YClick', 0); } else { $objRequest->set_attribute('YClick', $click->quantityCount); } $objRequest->set_attribute('IS_YClick', true); } if ($isCombo['data']) { $comboList = Bll_Combo_HouseRelation::getHouseRelations($intBrokerID, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); if (!empty($comboList)) { if (count($comboList) >= Const_ShowcaseOrders::SALE_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::SALE_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($comboList); } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMianNew = array(); foreach ($propMianInfo as $propMianVal) { $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true); $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true); } $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initComboZfProData($proInfos, $propMianNew, $comboList); } else { $fixedProInfos = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProInfo($hzBrokerId); if (!empty($fixedProInfos)) { $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($fixedProInfos, 'proid'); $proInfos_tmp = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $proIdsc = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfos_tmp, 'proid'); $proInfosc = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIdsc, $cityid); if (!empty($proInfosc)) { if (count($proInfosc) >= Const_ShowcaseOrders::RENT_PRO_MAX_COUNT) { $fixedProInfosCnt = Const_ShowcaseOrders::RENT_PRO_MAX_COUNT; } else { $fixedProInfosCnt = count($proInfosc); } } else { $fixedProInfosCnt = 0; } } else { $fixedProInfosCnt = 0; } $proInfo = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdRentPropInfo($intBrokerID); $proIds = Bll_Broker_ShowcaseOrders::getInstance()->getObjFieldInfo($proInfo, 'propId'); $proStatus = Bll_House_FixedPro::getInstance()->getBrokerHzFiexdProStatus($proIds); $proInfos = Bll_House_HzPro::getInstance()->getBrokerHzProInfo($proIds, $cityid); $propMianInfo = Bll_House_HzPro::getInstance()->getHzProInfoByIds($proIds); $propMianNew = array(); foreach ($propMianInfo as $propMianVal) { $propMianNew[$propMianVal->propId]['contentBasic'] = json_decode($propMianVal->contentBasic, true); $propMianNew[$propMianVal->propId]['contentOther'] = json_decode($propMianVal->contentOther, true); } $proList = Bll_Broker_ShowcaseAdSetPro::getInstance()->initZfProData($proInfos, $propMianNew, $proStatus); } if (count($proList) > $fixedProInfosCnt) { $fixedProInfosCnt = count($proList); } $objRequest->set_attribute('type', 'hz'); $objRequest->set_attribute('index', 2); //精选推广开关 $isChoice = Bll_City::isChoiceCity($cityid, Const_Site::HAOZU); $objRequest->set_attribute('isChoice', $isChoice); $objRequest->set_attribute('proList', $proList); $objRequest->set_attribute('fixedProInfosCnt', $fixedProInfosCnt); $objRequest->set_attribute('order_status', $order_status); $objRequest->set_attribute('todayPrice', $todayPrice); return 'Showcase_ZfManage'; }
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'; }