private static function preparePropInfo(&$out) { // 获取房源 $propResult = Bll_House_HzHouse::getPropInfo($out['proId'], $out['cityId'], 3); if (!$propResult['status']) { throw new Exception($propResult['msg']); } $propInfo = $propResult['msg']; // 检查并拼接违规信息 $illegalInfo = Bll_HzProp::checkAndGetPropsIllegalInfos(array($out['proId'] => $propInfo)); $propInfo = $illegalInfo[$out['proId']]; // 获取剩余时间 $propInfo['leftDays'] = Bll_House_HzHouse::getLeftDays($propInfo['created']); // 获取房源图片数 $imageInfo = Bll_House_HzHouse::getPropImages($out['proId']); $propInfo['imageInfo'] = $imageInfo; // 房源默认图片 (默认优先封面图 -》 第一张室内图 -》 房型) //$propInfo['propDefaultImg'] = Bll_House_HzHouse::getPropDefaultImgWithUrl($out['proId']); $propInfo['propDefaultImg'] = self::getThumbImg($imageInfo); // 获取房源可优化项 $propInfo['canImproveItems'] = self::getPropCanImproveItems($propInfo, $imageInfo); // 是否手机发房 $propInfo['isMobile'] = isset($propInfo['from']) ? Bll_House_HzHouse::isMobileProp($propInfo['from']) : false; // 此房源全部点击数据 $propInfo['propAllClick'] = Model_Stats_PropClick::getPropAllClicks($out['proId'], $out['hzBrokerId'], $out['cityId']); // 此房源全部曝光数据 $propInfo['propAllShow'] = Bll_House_HzHouse::getPropShow($out['proId'], $out['cityId']); // 此房源质量 $propQuality = Model_Stats_HzPropQuality::getPropsquality($out['proId']); $propInfo['propsQuality'] = $propQuality ? $propQuality[$out['proId']] : array(); // 根据blockid 获取对应code $areaInfo = Model_City_HzArea::getAreaById($propInfo['blockid']); $propInfo['typeCode'] = $areaInfo['typeCode']; return $propInfo; }
/** * 查询房子 如果删除、过期则通知下 更新套餐关系 * @param $task * @return bool */ public function dealTask($task) { $proId = $task['houseId']; $propInfo = Bll_House_HzHouse::getPropInfo($proId, $task['cityId'], 2); printf('[%s] 房源[%d]: %s' . PHP_EOL, date('Y-m-d H:i:s'), $proId, json_encode($propInfo)); if ($propInfo && $propInfo['status'] == 1 && !in_array($propInfo['msg']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { printf('房源 %s 状态为%s, 不需要处理' . PHP_EOL, $proId, $propInfo['msg']['status']); return true; } printf('房源 %s 状态为%s, 需要通知solr下,更新套餐关系为204' . PHP_EOL, $proId, $propInfo['msg']['status']); // 通知solr $result = Bll_Combo_NoticeSolrUpDown::noticeComboSolrHzAPI($task['cityId'], $task['brokerId'], $proId, 2); printf('房源 %s 通知中间件返回的结果status=%s ; message=%s' . PHP_EOL, $proId, $result['status'], $result['message']); // 更新套餐关系 $result = Bll_Combo_HouseRelation::updateHouseComboSpreadState($task['brokerId'], $proId, 'hz', 204); printf('房源 %s 更新套餐关系返回的结果message=%s' . PHP_EOL, $proId, $result ? '成功' : '失败'); return true; }
/** * 页面数据预加载模块 */ public function beforePost() { // 初始化页面变量 $this->ctx = Bll_House_HzPublish::initPageVariables($this->ctx); if ($this->ctx['proId']) { $propInfo = Bll_House_HzHouse::getPropInfo($this->ctx['proId'], $this->ctx['cityId']); // 房源不存在 if (!$propInfo['status']) { $this->redirect2Result(Const_PublishCode::HOUSE_NOT_EXIST, $this->site, $this->action, $this->ctx['proId']); } $tmpProId = $this->ctx['proId']; if ($propInfo['status']) { $this->ctx = array_merge($this->ctx, $propInfo['msg']); } // fix 大json里proid存成0的问题 if (!$this->ctx['proId']) { $this->ctx['proId'] = $tmpProId; } // 非自己房子 if ($propInfo['msg']['userid'] != $this->ctx['hzBrokerId']) { $this->redirect2Result(Const_PublishCode::NOT_OWN_HOUSE, $this->site, $this->action, $this->ctx['proId']); } } // 区域 $this->ctx['areaArr'] = Model_City_HzArea::getAreasByCityId($this->ctx['cityId']); // 板块 $this->ctx['blockArr'] = Model_City_HzArea::getBlockByAreaId($this->ctx['areaid']); // 房屋类型 $this->ctx['propTypeArr'] = Bll_House_HzHouse::getPropType($this->ctx['cityId']); // 装修类型 $this->ctx['fitmentArr'] = Bll_House_HzHouse::getFitment($this->ctx['cityId']); // 朝向 $this->ctx['towardArr'] = Bll_House_HzHouse::getToward(); // 房屋配置 $this->ctx['deploymentArr'] = Bll_House_HzHouse::getDeployment(); // 付款类型 $this->ctx['payTypeArr'] = Bll_House_HzHouse::getRentDepositAndCycle($this->ctx['cityId']); // 合租类型 $this->ctx['shareType'] = Bll_House_HzHouse::getShareType(); // 合租性别 $this->ctx['shareSexArr'] = Bll_House_HzHouse::getShareSex(); // 检查低价城市 $this->ctx['checkLowPriceCity'] = Bll_House_HzHouse::getCheckLowPriceCity(); // 获取图片 $this->ctx['images'] = Bll_Image_HzHouseImage::getImagesByHouseIds($this->ctx['proId'], true); $this->ctx['picData'] = Bll_House_HzPublish::buildImagesForPage($this->ctx['images']); $this->ctx['isShowCommPic'] = in_array($this->ctx['cityId'], array(11)) ? 0 : 1; $this->ctx['publishHouseProtocolUrl'] = Bll_House_EsfPublish::getPublishHouseProtocolUrl($this->ctx['cityId']); // 房源是否可以推广信息 $this->ctx = Bll_House_HzPublish::getSpreadFlagInfo($this->ctx); // 获取图片服务器host $this->ctx['picUploadServerDomain'] = Bll_Image_HzHouseImage::getPicUpdServerDomain(); if ($this->ctx['isEdit']) { $this->action = 'edit'; } // inject $this->ctx = Bll_House_HzPublish::beforePostInjectAfter($this->ctx); // debug $this->ctx['debug'] == 'all' && (print_r($this->ctx) && die); if (isset($this->ctx['file'])) { unset($this->ctx['file']); } return $this->ctx; }
/** * 把经纪人因为套餐到期停止推广的房源(套餐规定的可推广房源数)重新上线,(按房源发布时间 倒序排列) * @return string */ private function reUpExpireHouse() { $currentCombo = Bll_Combo_Broker_BrokerComboInfo::getBrokerCurrentCombo($this->params['ajk_broker_id'], Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ); if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { return $this->allReturn[] = '打通套餐,好租不处理'; } // 当前在线房源数 $onLineSpreadHouseCount = Bll_Combo_HouseRelation::getOnLineSpreadHouseCount($this->params['ajk_broker_id'], Bll_Combo_HouseRelation::SITE_TYPE_HZ); $comboProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($this->params['ajk_broker_id']); // 套餐可以推广的房源数 $comboProNum = isset($comboProNum['totalRentPropNum']) ? $comboProNum['totalRentPropNum'] : 0; if (!$comboProNum) { return $this->allReturn[] = "套餐可以推广的房源数0"; } if ($onLineSpreadHouseCount >= $comboProNum) { return $this->allReturn[] = "在线推广房源数{$onLineSpreadHouseCount}, 套餐可推广房源数{$comboProNum},不需要上线套餐到期的房子"; } $shouldUpNum = $comboProNum - $onLineSpreadHouseCount; $allExpireRelations = Bll_Combo_HouseRelation::getHouseRelations($this->params['ajk_broker_id'], Bll_Combo_HouseRelation::SITE_TYPE_HZ, Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE); if (empty($allExpireRelations)) { return $this->allReturn[] = "没有需要上线的推广房子"; } // 房子有效性判断 $num = 0; $shouldUpRelations = array(); foreach ($allExpireRelations as $relation) { $proId = $relation['houseId']; if (!($propInfo = Bll_House_HzHouse::getPropInfo($proId, $relation['cityId'], 2))) { continue; } if (!$propInfo['status'] || in_array($propInfo['msg']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { continue; } if ($num < $shouldUpNum) { $shouldUpRelations[] = $relation; } $num++; } foreach ($shouldUpRelations as $comboRelation) { $this->params['pro_id'] = $comboRelation['houseId']; // 更新关系 Bll_Combo_HouseRelation::updateComboStatusById($comboRelation['id'], Model_Combo_HouseRelation::ENUM_HOUSE_ONLINE, Bll_Combo_HouseRelation::SITE_TYPE_HZ); // 维护房子状态 Bll_HzPropBll::bulidHzProStatu($this->params['pro_id']); // 写入房源取消套餐推广日志 $this->writePropLog(Const_ProLogType::LOG_ADD_INTO_COMBO, '开始套餐推广'); } }
/** * @param $proId * @param $blockId * @param $areaId * @param $cityId * @return int */ private function changePropBlock($proId, $blockId, $areaId, $cityId, $ajk_brokerid) { //获取房源信息 $propInfo = Bll_House_HzHouse::getPropInfo($proId, $cityId); //重组房源信息,同时编辑区域板块id //$rebuildPropInfo = $this->rebuildPropInfo($propInfo, $blockId, $areaId, $ajk_brokerid); $commName = $propInfo['msg']['commname']; $commAddress = $propInfo['msg']['address']; $rebuildPropInfo = array('proid' => $proId, 'blockId' => $blockId, 'areaId' => $areaId, 'isCommUpdate' => 1, 'commName' => $commName, 'commAddress' => $commAddress); $response = Bll_Service_House::HzUpdateCommunitysMessageInHouse($rebuildPropInfo); if ($response->isFailed()) { return Util_GlobalFunc::buildReturn(0, '好租更新房源失败,请求内部API失败.'); } if ($response['status'] == 'error') { return Util_GlobalFunc::buildReturn(0, '好租更新失败,' . $response['info']); } return Util_GlobalFunc::buildReturn(1, 'success'); // //javaApi update // $host = APF::get_instance()->get_config("JavaAPIHost"); // $url = $host . "service-combo/rest/rent/properties/update?json"; // $curl = new Util_Http_Curl(); // $re = $curl->setDefaults()->setConnectTimeOut(30)->post($url, $rebuildPropInfo); // $re = json_decode($re, true); // return $re; }