public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $propId = $this->_params['propId']; //好丑陋。。。。。。好无奈。。。。。。 //委托房源自动转发停用,为了app能够展示报错信息。。。 if (empty($propId)) { $this->_params['apiDebug'] = 1; return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布'); } $propInfo = Bll_Ppc_ServiceAPI::getHouseInfo($propId); $brokerId = $this->_params['brokerId']; $houseInfo = Model_House_EsfHouseElementFactory::getHouseBaseInfo($propId); if (empty($houseInfo)) { $cityId = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($this->_params['brokerId']); $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $cityId); } if (!empty($houseInfo)) { $result['status'] = 'ok'; $areaCode = $houseInfo['areaCode']; $block = Bll_Commtype_Api::getInfoByTypeCode($areaCode); $area = Bll_Commtype_Api::getInfoByTypeId($block['parentId']); $area_name = $area['typeName']; $block_name = $block['typeName']; $data['title'] = $houseInfo['proName']; $data['commId'] = $houseInfo['commId']; $data['commName'] = $houseInfo['commName']; //小区信息 $commInfo = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($data['commId'], 2); $data['commLocation'] = $commInfo['commLocal']; $data['sosolat'] = $commInfo['sosolat']; //纬度 $data['sosolng'] = $commInfo['sosolng']; //经度 $data['floor'] = $propInfo['property']['ProFloor']; $data['totalFloor'] = $propInfo['property']['FloorNum']; $propDescription = $propInfo['property']['sale']['AddExplan']; $propDescription = str_replace('<p>', "", $propDescription); $propDescription = str_replace('</p>', "", $propDescription); $propDescription = trim($propDescription); $data['propDescription'] = $propDescription; $data['areaname'] = $area_name; $data['blockname'] = $block_name; $data['roomNum'] = $houseInfo['roomNum']; $data['hallNum'] = $houseInfo['hallNum']; $data['toiletNum'] = $houseInfo['toiletNum']; $data['area'] = $houseInfo['areaNum']; $data['areaUnit'] = '平米'; $data['price'] = $houseInfo['proPrice']; $data['priceUnit'] = '万'; $data['isMoreImg'] = $houseInfo['isHighQulity']; $data['isVisible'] = $houseInfo['isVisible']; $data['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $data['propImagesUrl'] = array(); $data['propImages'] = $data['outdoorImage'] = array(); if ($propInfo['attachments']['attachments']) { $propImageNum = 0; $outdoorImageNum = 0; $images = $propInfo['attachments']['attachments']; foreach ($images as $image) { if ($image['DataType'] == 2) { if ($propImageNum >= 8) { continue; } $imageInfo = array(); $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600); $url = str_replace("display", "display/e", $url); $imageInfo['bigImageUrl'] = $url; $data['propImages'][] = $imageInfo; $propImageNum += 1; } else { if ($image['DataType'] == 3) { if ($outdoorImageNum >= 1) { continue; } $imageInfo = array(); $url = Util_ImageUtils::getResizeURL($image['FileName'], $image['host_id'], 600, 600); $url = str_replace("display", "display/e", $url); $imageInfo['bigImageUrl'] = $url; $data['outdoorImage'][] = $imageInfo; $outdoorImageNum += 1; } } } } $spread = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propId); $data['isChoice'] = $data['isBid'] = 0; if (!empty($spread)) { if ($spread[0]['bidVersion'] == 1 && $spread[0]['status'] == 1) { $data['isBid'] = 1; } elseif ($spread[0]['bidVersion'] == 2 && ($spread[0]['status'] == 1 || $spread[0]['status'] == 11)) { $data['isChoice'] = 1; } } //计算出房源推广天数 $timeFixStr = strtotime(date("Ymd", $houseInfo['postDate'])); $leftDay = floor((time() - $timeFixStr) / 86400); $data['publishDaysMsg'] = $leftDay > 0 ? $leftDay . '天前发布' : '今天发布'; $imgBll = Bll_Image_EsfHouseImage::getInstance(); $data['imgUrl'] = $imgBll->getThumbImageUrl($propId, $houseInfo['commId']); $mobileBaseDomain = APF::get_instance()->get_config("mobile_base_domain"); $data['url'] = 'http://' . $mobileBaseDomain . '/sale/x/' . $houseInfo['cityId'] . '/' . $houseInfo->proId; //增加委托房源标签 if ($houseInfo['commitionType'] == 2) { $data['isEntrust'] = 1; } else { $data['isEntrust'] = 0; } } else { $data['status'] = 'error'; $data['message'] = '房源信息不存在'; } $result['data'] = $data; return $result; }
/** * 精选该上没上,该下没下 * * @param array $queue * @return array */ public static function notifySolrUpDown($queue) { $params = array(); $params['houseId'] = $queue['proId']; $params['plan_id'] = 0; $params['ajk_broker_id'] = $queue['brokerId']; $params['city_id'] = 0; $params['changeType'] = 412; $houseChoicePlan = Model_Plan_Jp::getChoicePlanByHouseIdEx($queue['proId']); if (empty($houseChoicePlan)) { $remark = sprintf('房源[%d]没有获取到精选计划信息', $queue['proId']); $params['city_id'] = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($queue['brokerId']); $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN; $data = self::buildPropLog($params, $remark, 0); Model_Log_HouseLogNew::create($data, date('Ymd'))->save(); return Bll_HzPropBll::build_return(1, $remark); } $params['city_id'] = $houseChoicePlan['cityId']; $params['plan_id'] = $houseChoicePlan['id']; if ($houseChoicePlan['status'] == Model_Plan_Jp::ENUM_STATUS_ONLINE) { $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_UP; $remark = sprintf('房源[%d]精选计划[%d]在推广中', $queue['proId'], $houseChoicePlan['id']); $data = self::buildPropLog($params, $remark, 0); Model_Log_HouseLogNew::create($data, date('Ymd'))->save(); return Bll_HzPropBll::build_return(1, $remark); } $params['type'] = Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN; $remark = sprintf('房源[%d]精选计划[%d - %d]不在推广中', $queue['proId'], $houseChoicePlan['id'], $houseChoicePlan['status']); $data = self::buildPropLog($params, $remark, 0); Model_Log_HouseLogNew::create($data, date('Ymd'))->save(); return Bll_HzPropBll::build_return(1, $remark); }
/** * 写房源日志,通知solr下架房源 * * @param array $queue * @return array */ public static function notifySolrUpDown($queue) { $propPlanning = Model_Plan_HzPlanning::getPropBidPlan($queue['proId']); if (empty($propPlanning)) { $queue['cityId'] = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($queue['brokerId']); return static::notifySolr($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN, '没有获取到房源精选关系-下架'); } $planId = $propPlanning['plan_id']; $planInfo = Model_Plan_HzPlanBasic::get_plan_by_id($planId); if (empty($planInfo)) { return static::notifySolr($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN, '没有获取到房源精选计划-下架'); } $queue['planId'] = $planId; $queue['cityId'] = $planInfo['cityId']; if ($planInfo['status'] == Const_HzPlan::SPREAD) { return static::notifySolr($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_UP, '精选推广-上架'); } return static::notifySolr($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN, '精选推广-下架'); }
/** * 二手房精选该上没上,改下没下 * * @param array $queue * @return bool */ public function notifySolrUpDown($queue) { $choicePlan = Model_Plan_AjkPropspread::getAjkPropspreadByProId(intval($queue['proId'])); /** 如果房源当前为推广中,则通知solr上架房源 */ if (!empty($choicePlan) && $choicePlan['status'] == 1) { $queue['planId'] = $choicePlan['id']; $this->setMsg(sprintf('房源[%d]的精选计划[%d]的状态[%d]为推广中,通知solr上架', $queue['proId'], $choicePlan['id'], $choicePlan['status'])); $queue['cityId'] = $choicePlan['cityId']; $param = array('city_id' => $choicePlan['cityId'], 'broker_id' => $choicePlan['brokerId'], 'pro_id' => $choicePlan['propId'], 'flag' => Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_UP, 'hpratio' => $choicePlan['offer'], 'comms_hpratio_a' => $choicePlan['commsHpratioA'], 'comms_hpratio' => $choicePlan['commsHpratio'], 'hpstarttime' => $choicePlan['spreadstartdate'], 'hpendtime' => $choicePlan['spreadenddate'], 'hpplanid' => $choicePlan['id'], 'update_time' => time(), 'from_type' => Bll_Combo_NoticeSolrUpDown::HLS_FROM_CHOICE_NOTIFY_SOLR_UP_DOWN); $this->writePropLog($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_UP, '精选该上没上,该下没下'); return $this->choiceUpDownSendSolr($param); } if (!empty($choicePlan)) { $queue['planId'] = $choicePlan['id']; $this->setMsg(sprintf('房源[%d]的精选计划[%d]的状态[%d]为非推广中,通知solr下架', $queue['proId'], $choicePlan['id'], $choicePlan['status'])); $queue['cityId'] = $choicePlan['cityId']; $param = array('city_id' => $choicePlan['cityId'], 'broker_id' => $choicePlan['brokerId'], 'pro_id' => $choicePlan['propId'], 'flag' => Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN, 'hpratio' => $choicePlan['offer'], 'comms_hpratio_a' => $choicePlan['commsHpratioA'], 'comms_hpratio' => $choicePlan['commsHpratio'], 'hpstarttime' => $choicePlan['spreadstartdate'], 'hpendtime' => $choicePlan['spreadenddate'], 'hpplanid' => $choicePlan['id'], 'update_time' => time(), 'from_type' => Bll_Combo_NoticeSolrUpDown::HLS_FROM_CHOICE_NOTIFY_SOLR_UP_DOWN); $this->writePropLog($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN, '精选该上没上,该下没下'); return $this->choiceUpDownSendSolr($param); } $this->setMsg(sprintf('没有获取到精选计划')); $cityId = Model_Broker_AjkBrokerExtend::getCityIdByBrokerId($queue['brokerId']); $queue['cityId'] = $cityId; $param = array('city_id' => $cityId, 'broker_id' => $queue['brokerId'], 'pro_id' => $queue['proId'], 'flag' => Bll_Combo_NoticeSolrUpDown::SOLR_ACTION_DOWN, 'hpratio' => $choicePlan['offer'], 'comms_hpratio_a' => 0, 'comms_hpratio' => 0, 'hpstarttime' => 0, 'hpendtime' => 0, 'hpplanid' => 0, 'update_time' => time(), 'from_type' => Bll_Combo_NoticeSolrUpDown::HLS_FROM_CHOICE_NOTIFY_SOLR_UP_DOWN); $this->writePropLog($queue, Const_ProLogType::LOG_CHOICE_NOFITY_SOLR_DOWN, '精选该上没上,该下没下'); return $this->choiceUpDownSendSolr($param); }