public function handle_request_combo() { $ajkBrokerId = $this->brokerId; $cityId = $this->cityId; //套餐信息 $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($ajkBrokerId); $currentDate = time(); foreach ($comboInfoList as $comboInfo) { $startDate = strtotime($comboInfo['startTime']); $endDate = strtotime($comboInfo['endTime']); //获取当前使用的套餐 if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['rentPropNum'] + $comboInfo['salePropNum'] > 0) { $currentCombo = $comboInfo; break; } } $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum']; $currentComboName = $currentCombo['name']; //二手房套餐列表 $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($ajkBrokerId, $cityId); $comboEsfPropIds = array_keys($comboEsfList); //租房套餐列表 $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); $comboZuFangPropIds = array(); foreach ($comboZuFangList as $v) { $comboZuFangPropIds[] = (int) $v['houseId']; } $currentComboUsed = count($comboZuFangPropIds) + count($comboEsfPropIds); $canSpread = $currentComboUsed >= $currentComboTotal ? 0 : 1; $propId = $this->_params['propId']; $comboInfo = Bll_Combo_HouseRelation::getHouseRelation($ajkBrokerId, $cityId, $propId, Bll_Combo_HouseRelation::SITE_TYPE_HZ); if (!empty($comboInfo) && $comboInfo[0]['state'] > 100 & $comboInfo[0]['state'] < 200) { //推广中 $status = 2; $statusMsg = '套餐推广中'; $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})"; } else { $comboInfos = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($ajkBrokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ); if (empty($comboInfos)) { $status = 0; $statusMsg = '尚未购买套餐,请购买套餐'; $currentComboInfo = '尚未购买套餐'; } else { $status = 1; $statusMsg = '好房源,不推广就浪费了~'; $currentComboInfo = $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})"; } } $startDate = $endDate = date('Ymd'); $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propId, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ); $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($ajkBrokerId, $propId, $cityId); $todayClick = $todayClicks[$propId][$startDate] ?: 0; $totalClick = $totalClicks[$propId] ?: 0; $totalClick += $todayClick; return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClick, 'totalClicks' => $totalClick, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo)); }
public function handle_request_combo() { $brokerId = $this->brokerId; $cityId = $this->cityId; $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); //获取所有有效房源 $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId); $propertyList = array(); if (!empty($props)) { //获取套餐推广房源列表 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); //所有有效房源-套餐推广房源 = 套餐未推广房源 if (!empty($comboList)) { foreach ($comboList as $row) { unset($props[$row['houseId']]); } } if (!empty($props)) { // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props)); if (!empty($defaultImages)) { foreach ($defaultImages as $defaultImage) { $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } foreach ($props as $list) { $row = array(); $row['id'] = $row['propId'] = $list['propId']; $row['title'] = $list['title']; $row['imgUrl'] = $list['imgUrl'] ?: ''; $row['commId'] = $list['commid']; $row['commName'] = $list['commname']; $row['roomNum'] = $list['roomnum']; $row['hallNum'] = $list['hallnum']; $row['toiletNum'] = $list['toilnetnum']; $row['area'] = round($list['areanum']); $row['price'] = round($list['pricenum']); $row['priceUnit'] = '元/月'; $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0; $row['isVisible'] = (int) ($list['status'] != 6); $row['isMoreImg'] = (int) $list['quality']; $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker'); $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT); $row['isEntrust'] = $isEntrust ? 1 : 0; $row['createTime'] = date('Y-m-d H:i:s', $list['created']); $propertyList[] = $row; } } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList)); }
/** * @param AJKRequest $request * @param array $out * @throws Exception */ public static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); // 获取好租brokerId $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']); // 获取账户余额 /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance'); if (!$balance['status']) throw new Exception_BllErrorException($balance['msg']); $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0; */ // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU); $out['isBidCity'] = false; $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU); $out['bidTip'] = '精选'; // 获取经纪人信息 if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) { throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']'); } // 身份是否通过 $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']); // 获取该经纪人房源 $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']); // 获取改经纪人所有房源质量 //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props'])); $out['propsQuality'] = static::getHzPropsQuality($out['props']); if (count($out['props']) > 0) { foreach ($out['props'] as $proId => $prop) { $out['props'][$proId]['proId'] = $proId; // 获取剩余时间 $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']); // 是否手机房源 $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : ''); } } // 获取经纪人主推房源 $out['mainSpreadProIds'] = array(); $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']); if ($mainSpreads) { foreach ($mainSpreads as $v) { $out['mainSpreadProIds'][$v->propId] = $v->propId; } } }
/** * 查询房子 如果删除、过期则通知下 更新套餐关系 * @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; }
/** * 拼接租房最后房源数据 * @param $proInfos 房源信息 * @param $proClickInfo 房源点击量信息 * @param $adProInfos 房源主推信息 * @param $propMianNew 房源主表信息 */ private function initZfProData($proInfos, $proClickInfo, $adProInfos, $propMianNew) { $data = $orderProId = array(); $tD = date('Ymd'); foreach ($proInfos as $proInVal) { $pro = array(); $orderProId[] = $proInVal->proid; $pro['id'] = $proInVal->proid; $pro['name'] = $propMianNew[$proInVal->proid]['contentBasic']['title']; $pro['commName'] = Util_String::truncate($proInVal->commname, 20, ''); $pro['area'] = $propMianNew[$proInVal->proid]['contentBasic']['areanum']; $roomStr = ''; if ($propMianNew[$proInVal->proid]['contentBasic']['roomnum']) { $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['roomnum'] . '室'; } if ($propMianNew[$proInVal->proid]['contentBasic']['hallnum']) { $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['hallnum'] . '厅'; } $pro['houseType'] = $roomStr; $pro['floor'] = intval($propMianNew[$proInVal->proid]['contentBasic']['floor']); $pro['floorAll'] = intval($propMianNew[$proInVal->proid]['contentBasic']['totalfloor']); $pro['price'] = $proInVal->pricenum * 100; $pro['day'] = Bll_House_HzHouse::getLeftDays($proInVal->created); if ($pro['day']) { $pro['day'] .= '天'; } else { $pro['day'] = '<1天'; } /* $createDay = date('Ymd',$proInVal->created); if ($tD == $createDay) { $pro['day'] = '新发'; } else { $timeFixstr = strtotime($createDay) + 86400; $leftDays = 90 - floor((time() - $timeFixstr) / 86400); $leftDays = $leftDays > 0 ? $leftDays : 0; $pro['day'] = $leftDays . '天'; } */ $pro['clickNum'] = intval($proClickInfo[$proInVal->proid]); $pro['isChoose'] = $adProInfos[$proInVal->proid] ? 1 : 0; $pro['rentType'] = $propMianNew[$proInVal->proid]['contentBasic']['renttype'] == 1 ? 0 : 1; //出租方式,0整租,1合租 $data[] = $pro; } //根据最新发布时间排序 array_multisort($orderProId, SORT_DESC, $data); $this->outData($data, 1); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; // 获取未推广房源列表 $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); //APP套餐城市调错API了 需要做一下套餐城市的兼容处理 $isComboBroker = Bll_Broker_HzBroker::isComboBroker($brokerId); if (!$isComboBroker) { $props = Bll_HzFixPlan::get_outline_list($hzBrokerId, $cityId, 1); $propIds = array(); $propertyList = array(); foreach ($props as $prop) { $propId = $prop['proid']; $propIds[] = $propId; $row = array(); $row['propId'] = $row['id'] = $propId; $row['title'] = $prop['content_basic']['title']; $row['imgUrl'] = ''; $row['commId'] = $prop['content_basic']['commid']; $row['commName'] = $prop['content_basic']['commname']; $row['roomNum'] = $prop['content_basic']['roomnum']; $row['hallNum'] = $prop['content_basic']['hallnum']; $row['toiletNum'] = $prop['content_basic']['toilnetnum']; $row['area'] = round($prop['content_basic']['areanum']); $row['price'] = round($prop['content_basic']['pricenum']); $row['priceUnit'] = '元/月'; $row['isBid'] = 0; $row['isChoice'] = 0; $row['isVisible'] = intval($prop['content_basic']['status'] != 6); $row['isMoreImg'] = intval($prop['content_basic']['quality']); $row['isPhonePub'] = intval(isset($prop['content_basic']['from']) && $prop['content_basic']['from'] == 'mobile-ajk-broker'); $row['publishDays'] = floor((time() - $prop['content_basic']['created']) / 86400); $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布'; $row['createTime'] = date('Y-m-d H:i:s', $prop['content_basic']['created']); $row['updateTime'] = date('Y-m-d H:i:s', $prop['content_basic']['updated']); //增加委托房源标签 $isEntrust = Bll_Zufang_Choice::isCommissionHouse($propId, $brokerId, Model_House_Commission::TYPE_RENT); $row['isEntrust'] = $isEntrust ? 1 : 0; $propertyList[$propId] = $row; } if ($propIds) { // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds); foreach ($defaultImages as $defaultImage) { $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } $result = array(); $result['status'] = Const_APIStatus::RETURN_CODE_OK; $result['data']['propertyList'] = array_values($propertyList); return $result; } else { //获取所有有效房源 $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId); $propertyList = array(); if (!empty($props)) { //获取套餐推广房源列表 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); //所有有效房源-套餐推广房源 = 套餐未推广房源 if (!empty($comboList)) { foreach ($comboList as $row) { unset($props[$row['houseId']]); } } if (!empty($props)) { // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props)); if (!empty($defaultImages)) { foreach ($defaultImages as $defaultImage) { $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } foreach ($props as $list) { $row = array(); $row['id'] = $row['propId'] = $list['propId']; $row['title'] = $list['title']; $row['imgUrl'] = $list['imgUrl'] ?: ''; $row['commId'] = $list['commid']; $row['commName'] = $list['commname']; $row['roomNum'] = $list['roomnum']; $row['hallNum'] = $list['hallnum']; $row['toiletNum'] = $list['toilnetnum']; $row['area'] = round($list['areanum']); $row['price'] = round($list['pricenum']); $row['priceUnit'] = '元/月'; $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0; $row['isVisible'] = (int) ($list['status'] != 6); $row['isMoreImg'] = (int) $list['quality']; $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker'); $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT); $row['isEntrust'] = $isEntrust ? 1 : 0; $row['createTime'] = date('Y-m-d H:i:s', $list['created']); $propertyList[] = $row; } } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList)); } }
/** * 通过房源id直接拿到房源主表信息和房源分表信息,以及页面展示的扩展信息 * 供展示,不用于更新 * @param $propId */ public static function getHouseExtInfo($houseInfo) { $baseInfo = $houseInfo['base']; if (!$baseInfo) { return false; } $houseInfo = $houseInfo['info']; if (!$houseInfo) { return false; } $houseInfo['houseTypeDesc'] = self::$arrHouseTypeDes['full'][$baseInfo['houseType']]; $houseInfo['houseTypeDescShort'] = self::$arrHouseTypeDes['short'][$baseInfo['houseType']]; $houseInfo['houseTypeUrl'] = self::$arrHouseTypeDes['urlCombo'][$baseInfo['houseType']]; $houseInfo['urlEdit'] = BLL_Plan_JpPlanUrl::build_house_edit_url($baseInfo['houseType'], $baseInfo['id']); //$houseInfo['urlRedoHp'] = BLL_Plan_JpPlanUrl::build_haopan_new_url($houseInfo['id']); $houseInfo['urlHouse'] = BLL_Plan_JpPlanUrl::build_index_v2($baseInfo['cityId'], $baseInfo['houseType']) . $baseInfo['id']; // 楼层信息 $houseInfo['floorInfo'] = self::getHouseFloorInfo($houseInfo, $baseInfo['houseType']); // 租金信息 $houseInfo['priceInfo'] = self::getHousePriceInfo($houseInfo, $baseInfo['houseType']); // 过期时间 $houseInfo['leftDays'] = Bll_House_HzHouse::getLeftDays(strtotime($baseInfo['createTime'])); $houseInfo['viewURL'] = "http://my." . APF::get_instance()->get_config('base_domain') . '/ajkbroker/user/house/propview/jp/' . $houseInfo['id']; return array('base' => $baseInfo, 'info' => $houseInfo, 'houseType' => $baseInfo['houseType']); }
/** * 组装未推广列表 取出所有-有效定价房源 * @param $out * @return array */ private static function prepareOutList(&$out) { $outList = array(); $outPropIds = array(); $fixProIds = array_keys($out['props']); // 取出经纪人所有非删除房源 (分表) $allSearchProps = Model_House_HzPropSearch::getPropLists($out['cityId'], array(array('ajkBrokerId', '=', $out['ajkBrokerId']), array('status', '<>', Const_HzStatus::DELETE), array('status', '<>', Const_HzStatus::OFFLINE), array('status', '<>', Const_HzStatus::OUTPORT), array('status', '<>', Const_HzStatus::HIBERNATE), array('status', '<>', Const_HzStatus::REMOVE), array('status', '<>', Const_HzStatus::EXPIRED)), 1000, array('created', 'desc')); if (empty($allSearchProps)) { return array(); } // 获取城市价格段 $allPrices = Model_House_HzPriceChoice::getAllPriceByCityId($out['cityId']); $out['getQualityProIds'] = array(); foreach ($allSearchProps as $allSearchProp) { $proId = $allSearchProp['proid']; $out['getQualityProIds'][] = $proId; // 过滤非删除状态定价 if (in_array($proId, $fixProIds)) { continue; } $outList[$proId] = $allSearchProp; // 获取剩余时间 $outList[$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($allSearchProp['created']); $outPropIds[] = $proId; } // 获取改经纪人所有房源质量 $out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality($out['getQualityProIds']); // 获取如是违规房源 拼接违规原因 $outList = Bll_HzProp::checkAndGetPropsIllegalInfos($outList); // 批量获取主表信息 if (empty($outPropIds)) { return array(); } $props = Model_House_HzProp::getPropsByPropIds($outPropIds); if (!$props) { return array(); } // 房源主分表信息合并 foreach ($outList as $proId => $outProp) { $outList[$proId] = array_merge($outList[$proId], $props[$proId]); // 计算点击价格 if (!empty($allPrices)) { foreach ($allPrices as $priceInfo) { if ($priceInfo['lower'] < $outList[$proId]['pricenum'] && $priceInfo['upper'] >= $outList[$proId]['pricenum']) { $outList[$proId]['unitPrice'] = $priceInfo['price']; break; } } } } return $outList; }
/** * 把经纪人因为套餐到期停止推广的房源(套餐规定的可推广房源数)重新上线,(按房源发布时间 倒序排列) * @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, '开始套餐推广'); } }
public function handle_request_combo() { $ajkBrokerId = $this->brokerId; $cityId = $this->cityId; $siteType = Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ; //首先获取套餐关系房源列表 ---- 那房源到主表去除status 已删除的房源 -----在房源主表获取房源基本信息 $comboList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, $siteType, 1); $surplus = $hasCombo = 0; //获取套餐信息-首先判断经纪人有无套餐 $comboInfos = Bll_Combo_Broker_BrokerComboInfo::getComboListBySite($ajkBrokerId, $siteType); if (count($comboInfos) > 0) { $index = Bll_Combo_Broker_BrokerComboInfo::getComboIndexBySiteType($siteType); $currentTime = time(); foreach ($comboInfos as $combo) { if ($combo[$index] == 0) { continue; } if (strtotime($combo['endTime']) > $currentTime && strtotime($combo['startTime']) < $currentTime) { $currentCombo = $combo; } } if (!empty($currentCombo)) { $surplus = $currentCombo['rentPropNum']; if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { //商业地产没打通 $surplus = $currentCombo['rentPropNum'] + $currentCombo['salePropNum']; } $hasCombo = 1; } } //获取当前已推广套餐数量 if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($ajkBrokerId, $siteType, true); } else { $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($ajkBrokerId, $cityId, $siteType); } $oldList = $newList = array(); if (empty($comboInfos)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo)); } $propIds = array(); foreach ($comboList as $row) { $propIds[] = $row['houseId']; } $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId); $comboPropList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $this->cityId); foreach ($comboPropList as $key => $list) { if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { unset($comboPropList[$key]); } } //fix bug45133 if (empty($comboPropList)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo)); } $propIds = array(); foreach ($comboPropList as $row) { $propIds[] = $row['proid']; } //从主表获取房源信息 $propertyList = Model_House_HzProp::getPropsByPropIds($propIds); //获取是否精选或者竞价 $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING)); if (!empty($relations)) { $planPropMap = array(); foreach ($relations as $relation) { $planIds[] = $relation['plan_id']; $planPropMap[$relation['plan_id']] = $relation['proid']; } if (!empty($planIds)) { $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds); foreach ($plans as $plan) { if ($plan->flag == 0) { continue; } if ($plan->bid_version == 2) { $propId = $planPropMap[$plan['id']]; $propertyList[$propId]['isChoice'] = 1; } else { $propId = $planPropMap[$plan['id']]; $propertyList[$propId]['isBid'] = 1; } } } } // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds); if (!empty($defaultImages)) { foreach ($defaultImages as $defaultImage) { $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } krsort($propertyList); $startDate = $endDate = date('Ymd'); $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propIds, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ); $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($ajkBrokerId, $propIds, $cityId); foreach ($propertyList as $list) { $row = array(); $row['id'] = $list['propId']; $row['propId'] = $list['propId']; $row['title'] = $list['title']; $row['imgUrl'] = $list['imgUrl'] ?: ''; $row['commId'] = $list['commid']; $row['commName'] = $list['commname']; $row['roomNum'] = $list['roomnum']; $row['hallNum'] = $list['hallnum']; $row['toiletNum'] = $list['toilnetnum']; $row['area'] = round($list['areanum']); $row['price'] = round($list['pricenum']); $row['priceUnit'] = '元/月'; $row['todayClicks'] = $todayClicks[$list['propId']][$startDate] ?: 0; $row['totalClicks'] = $totalClicks[$list['propId']] ?: 0; $row['totalClicks'] = $row['totalClicks'] + $row['todayClicks']; $row['isBid'] = isset($list['isBid']) ? $list['isBid'] : 0; $row['isChoice'] = isset($list['isChoice']) ? $list['isChoice'] : 0; $row['isVisible'] = (int) ($list['status'] != 6); $row['isMoreImg'] = (int) $list['quality']; $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker'); $row['publishDays'] = floor((time() - $list['created']) / 86400); $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布'; $row['createTime'] = date('Y-m-d H:i:s', $list['created']); //$row['updateTime'] = date('Y-m-d H:i:s', $list['updated']); //是否委托 $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $ajkBrokerId, Model_House_Commission::TYPE_RENT); $row['isEntrust'] = $isEntrust ? 1 : 0; $row['publishDays'] > 30 ? $oldList[] = $row : ($newList[] = $row); } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus - $currentSpreadHouseCount, 'hasCombo' => $hasCombo)); }
/** * * 根据经纪人查询套餐房源的标签(优、良、中、待评) * 根据房源的rank大段 * @param $brokerId * @param $siteType * @return array * $result['list'][proid]['rankStar'] 大段 * $result['list'][proid]['rankStarName'] 大段名称 * $result['count'][0][rankStar] 各大段的数量标记 * $result['count'][0][rankStarName] 各大段的数量名称 * $result['count'][0][rankStarNum] 各大段的数量 */ public static function getBrokerComboProRank($brokerId, $siteType, $cityId = '') { //标签返回值 $result = array(); switch ($siteType) { case 'ajk': //二手房 //分类计算标签数量 $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } $houseInfo = array(); foreach ($comboList as $combo) { $houseInfo['houseIdList'][] = $combo['houseId']; $tmp = array('proId' => $combo['houseId'], 'postDate' => strtotime($combo['created']), 'cityId' => $combo['cityId']); $houseInfo['comboSpreadHouseList'][$combo['houseId']] = $tmp; } if (empty($houseInfo)) { return $result; } $housePostDate = array(); $housePostDateTmp = Bll_House_EsfHouse::getHouseInfo($houseInfo['houseIdList'], $cityId); foreach ($housePostDateTmp as $k => $v) { $housePostDate[$v['proId']] = $v; } foreach ($houseInfo['comboSpreadHouseList'] as $k => &$v) { $v['postDate'] = $housePostDate[$k]['postDate']; } //获取房源的标签 $houseSollyResultList = Bll_House_EsfHouse::getHouseRankEx($houseInfo); $houseRank = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseRank[$houseSollyResult['propId']] = $houseSollyResult['rankStar']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($rankTips[$houseRank[$houseId]])) { $rankStar = $houseRank[$houseId]; } else { $rankStar = 0; } //数据列表 $result['list'][$houseId]['rankStar'] = $rankStar; $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar]; //统计数据 $result['count'][$rankStar]['rankStar'] = $rankStar; $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar]; if (isset($result['count'][$rankStar]['rankStarNum'])) { $result['count'][$rankStar]['rankStarNum'] += 1; } else { $result['count'][$rankStar]['rankStarNum'] = 1; } } break; case 'hz': //租房 //分类计算标签数量 $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } //获取房源的标签 //$houseSollyResultList = Model_Stats_HzPropQuality::getPropsqualityv2($houseIds); $houseInfo = array(); $tmp = array(); foreach ($comboList as $v) { $tmp['propId'] = $v['houseId']; $tmp['cityid'] = $v['cityId']; $tmp['created'] = strtotime($v['created']); $houseInfo[$v['houseId']] = $tmp; $tmp = array(); } $housePostDate = array(); $housePostDateTmp = Bll_House_HzHouse::getValidPropsByBrokerIdEx($brokerId, $cityId); foreach ($housePostDateTmp as $k => $v) { $housePostDate[$v['proid']] = $v; } foreach ($houseInfo as $k => &$v) { $v['created'] = $housePostDate[$k]['created']; } $houseSollyResultListTmp = Bll_Broker_Combo_ManageHz::getHzPropsQuality($houseInfo); foreach ($houseSollyResultListTmp as $v) { $tmp['cityId'] = $v['cityId']; $tmp['proId'] = $v['proId']; $tmp['rank'] = $v['rank']; $houseSollyResultList[] = $tmp; } $houseRank = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseRank[$houseSollyResult['proId']] = $houseSollyResult['rank']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($rankTips[$houseRank[$houseId]])) { if ($houseRank[$houseId] == 1) { $rankStar = 3; //优 } elseif ($houseRank[$houseId] == 2) { $rankStar = 2; //良 } elseif ($houseRank[$houseId] == 3) { $rankStar = 1; //中 } else { $rankStar = 0; //优 } } else { $rankStar = 0; } //数据列表 $result['list'][$houseId]['rankStar'] = $rankStar; $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar]; //统计数据 $result['count'][$rankStar]['rankStar'] = $rankStar; $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar]; if (isset($result['count'][$rankStar]['rankStarNum'])) { $result['count'][$rankStar]['rankStarNum'] += 1; } else { $result['count'][$rankStar]['rankStarNum'] = 1; } } break; case 'jp': //金铺 $exquisite = array(1 => '精品', 2 => '非精品'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_JP, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } //获取房源的标签 $jpOfficeRent = Model_House_JpOfficeRent::getPropInfoByIds($houseIds); $jpOfficeSale = Model_House_JpOfficeSale::getPropInfoByIds($houseIds); $jpShopRent = Model_House_JpShopRent::getPropInfoByIds($houseIds); $jpShopSale = Model_House_JpShopSale::getPropInfoByIds($houseIds); $houseSollyResultList = array_merge($jpOfficeRent, $jpOfficeSale, $jpShopRent, $jpShopSale); $houseExquisite = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseExquisite[$houseSollyResult['id']] = $houseSollyResult['isExquisite']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($exquisite[$houseExquisite[$houseId]])) { $exquisiteStar = $houseExquisite[$houseId]; } else { $exquisiteStar = 2; } //数据列表 $result['list'][$houseId]['exquisiteStar'] = $exquisiteStar; $result['list'][$houseId]['exquisiteStarName'] = $exquisite[$exquisiteStar]; //统计数据 $result['count'][$exquisiteStar]['exquisiteStar'] = $exquisiteStar; $result['count'][$exquisiteStar]['exquisiteStarName'] = $exquisite[$exquisiteStar]; if (isset($result['count'][$exquisiteStar]['exquisiteStarNum'])) { $result['count'][$exquisiteStar]['exquisiteStarNum'] += 1; } else { $result['count'][$exquisiteStar]['exquisiteStarNum'] = 1; } } break; default: break; } return $result; }
public function getComboPropsInOneComm($brokerId, $cityId, $commId = '') { $siteType = Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_HZ; $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, $siteType, 1); if (empty($comboList)) { return array(); } $propIds = array(); foreach ($comboList as $row) { $propIds[] = $row['houseId']; } $propertyList = Model_House_HzProp::getPropsByPropIds($propIds); //获取是否精选或者竞价 $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING)); if (!empty($relations)) { $planPropMap = array(); foreach ($relations as $relation) { $planIds[] = $relation['plan_id']; $planPropMap[$relation['plan_id']] = $relation['proid']; } if (!empty($planIds)) { $plans = Model_Plan_HzPlanBasic::getPlansByIds($planIds); foreach ($plans as $plan) { if ($plan->flag == 0) { continue; } if ($plan->bid_version == 2) { $propId = $planPropMap[$plan['id']]; $propertyList[$propId]['isChoice'] = 1; } else { $propId = $planPropMap[$plan['id']]; $propertyList[$propId]['isBid'] = 1; } } } } // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds); if (!empty($defaultImages)) { foreach ($defaultImages as $defaultImage) { $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } krsort($propertyList); $base_domain = APF::get_instance()->get_config('base_domain'); $startDate = $endDate = date('Ymd'); $todayClicks = Bll_Combo_Broker_BrokerComboInfo::getHouseComboClickEx($propIds, $startDate, $endDate, Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_HZ); $totalClicks = Bll_House_HzHouse::getComboHouseAccumulateClick($brokerId, $propIds, $cityId); foreach ($propertyList as $key => $prop) { if (in_array($prop['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { continue; } $row = array(); $row['id'] = $prop['propId']; $row['title'] = $prop['title']; $row['commId'] = $prop['commid']; $row['commName'] = $prop['commname']; $row['roomNum'] = $prop['roomnum']; $row['hallNum'] = $prop['hallnum']; $row['toiletNum'] = $prop['toilnetnum']; $row['area'] = round($prop['areanum']); $row['price'] = round($prop['pricenum']); $row['priceUnit'] = '元/月'; $row['isVisible'] = (int) ($prop['status'] != 6); $row['imgUrl'] = $prop['imgUrl'] ?: ''; $row['isMoreImg'] = (int) $prop['quality']; $row['isPhonePub'] = (int) (isset($prop['from']) && $prop['from'] == 'mobile-ajk-broker'); $row['propUrl'] = 'http://' . $base_domain . '/web/rent/x/' . $prop['cityid'] . '/' . $prop['propId'] . '-3'; $row['isBid'] = isset($prop['isBid']) ? $prop['isBid'] : 0; $row['isChoice'] = isset($prop['isChoice']) ? $prop['isChoice'] : 0; $todayClick = $todayClicks[$prop['propId']][$startDate] ?: 0; $row['totalClicks'] = $totalClicks[$prop['propId']] ?: 0; $row['totalClicks'] = $row['totalClicks'] + $todayClick; $row['createTime'] = date('Y-m-d H:i:s', $prop['created']); $row['updateTime'] = date('Y-m-d H:i:s', $prop['updated']); $commProps[$prop['commid']][$key] = $row; } // 如果是获取某单个小区房源列表 if ($commId) { $ret['status'] = 'ok'; $ret['data']['propertyList'] = isset($commProps[$commId]) && !empty($commProps[$commId]) ? array_values($commProps[$commId]) : array(); } else { $ret = isset($commProps) && !empty($commProps) ? $commProps : array(); } return $ret; }
/** * 市场分析 * @param $out * @return array */ private static function prepareAnaly(&$out) { $analy = array(); $commId = $out['propInfo']['commid']; //$commId = 10284; if (!$commId) { $analy['vppvOrderAndPropNum']['propNum'] = 0; $analy['vppvOrderAndPropNum']['order'] = 0; return $analy; } // 获取小区所在板块的排名和小区房源数 $analy['vppvOrderAndPropNum'] = Bll_House_HzHouse::getVppvOrderAndPropNum($commId); // 获取小区对应的户型供需信息 $analy['commSRInfo'] = Bll_House_HzHouse::getCommHouseTypeSRInfo($commId); // 小区价格段供需 $analy['priceSRInfo'] = Bll_House_HzHouse::getCommPriceSRInfo($commId); return $analy; }
public function handle_request_combo() { $brokerId = $this->brokerId; $cityId = $this->cityId; $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); //获取所有有效房源 $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId); $propertyList = array(); if (!empty($props)) { //获取套餐推广房源列表 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); //获取精选房源列表 $bllChoice = new Bll_Zufang_Choice(); $choices = $bllChoice->get_active_choice_plans($hzBrokerId, array(1, 13, 2, 3, 7, 8)); $choicePropIds = array(); if (!empty($choices)) { $keyedPlans = array(); foreach ($choices as $choice) { $keyedPlans[$choice->id] = $choice; } // 获取所有的房源和精选的关系 $choiceRelations = $bllChoice->get_prop(array_keys($keyedPlans)); foreach ($choiceRelations as $choiceRelation) { $choicePropIds[] = $choiceRelation->proid; } } //所有有效房源-套餐推广房源-精选推广房源 = 待推广房源 if (!empty($comboList)) { foreach ($comboList as $row) { unset($props[$row['houseId']]); } } if (!empty($choicePropIds)) { foreach ($choicePropIds as $k => $v) { unset($props[$v]); } } if (!empty($props)) { // 批量获取房源的默认图片 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props)); if (!empty($defaultImages)) { foreach ($defaultImages as $defaultImage) { $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl(); } } //是否是精选城市,城市是否精选分离 $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::HAOZU); $cityIsChoiceIndependent = Bll_City::isChoiceIndependentCity($cityId, Const_Site::HAOZU); foreach ($props as $list) { $row = array(); $row['id'] = $row['propId'] = $list['propId']; $row['title'] = $list['title']; $row['imgUrl'] = $list['imgUrl'] ?: ''; $row['commId'] = $list['commid']; $row['commName'] = $list['commname']; $row['roomNum'] = $list['roomnum']; $row['hallNum'] = $list['hallnum']; $row['toiletNum'] = $list['toilnetnum']; $row['area'] = round($list['areanum']); $row['price'] = round($list['pricenum']); $row['priceUnit'] = '元/月'; $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0; $row['isVisible'] = (int) ($list['status'] != 6); $row['isMoreImg'] = (int) $list['quality']; $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker'); $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT); $row['isEntrust'] = $isEntrust ? 1 : 0; $row['createTime'] = date('Y-m-d H:i:s', $list['created']); //精选状态 $choiceStatus = Bll_HzProp::getZuFangChoiceStatus($list, $cityId, $cityIsChoice); if (!$cityIsChoiceIndependent && $choiceStatus['choiceStatus']) { //城市未精选分离 $choiceStatus['choiceStatus'] = 0; $choiceStatus['choiceStatusName'] = ''; } $row['choiceStatus'] = $choiceStatus['choiceStatus']; $row['choiceStatusName'] = $choiceStatus['choiceStatusName']; $propertyList[] = $row; } } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList)); }
/** * @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; }
/** * 返回必须参数(参数拼接) * @param $val * @param $propMainNew //租房扩展信息 * @return array */ public static function getZfShowInfo($val, $propMainNew) { $pro = array(); $pro['id'] = $val['proid']; $pro['name'] = $propMainNew[$val['proid']]['contentBasic']['title']; $pro['commName'] = $val['commname']; $pro['area'] = $propMainNew[$val['proid']]['contentBasic']['areanum']; $pro['roomNum'] = $propMainNew[$val['proid']]['contentBasic']['roomnum']; //室 $pro['hallNum'] = $propMainNew[$val['proid']]['contentBasic']['hallnum']; //厅 $pro['toiletNum'] = $propMainNew[$val['proid']]['contentBasic']['toilnetnum']; //卫 $pro['floor'] = intval($propMainNew[$val['proid']]['contentBasic']['floor']); $pro['floorAll'] = intval($propMainNew[$val['proid']]['contentBasic']['totalfloor']); $pro['price'] = $val['pricenum']; $pro['day'] = Bll_House_HzHouse::getLeftDays($val['created']); if ($pro['day']) { $pro['day'] .= '天'; } else { $pro['day'] = '<1天'; } return $pro; }
/** * 构造发房数据 * @return string * @throws Exception */ public static function buildPropPostData($info) { if (!isset($info["ajkBrokerId"]) || !isset($info["cityId"])) { return Util_GlobalFunc::buildReturn(0, '缺少参数: ajkBrokerId | cityId'); } // 装修 例子:2|普通装修 $decorationArr = explode('|', $info["decoration"]); $params["broker_id"] = $info["ajkBrokerId"]; //经纪人ID $params["comm_id"] = (int) $info["commonid"]; //小区ID $params["trade_type"] = 2; //交易类型-租房 $params["area"] = $info["housearea"]; //产证面积(输入) $params["rooms"] = $info["room"] . ',' . $info["hall"] . ',' . $info['toliet']; // 房间数,客厅数,卫生间 $params["price"] = $info["rentprice"]; //价格(输入) $params["floor"] = $info["floor"] . ',' . $info['floorall']; //楼层(选择) $params["fitment"] = Bll_House_HzHouse::getFitmentMappingId($decorationArr, $info["cityId"]); //装修(默认+选择) $params['style'] = self::buildHouseType($info['housetype']); // 需要映射 $params["exposure"] = $info["renttype"] == 1 ? $info["toward"] : $info["roomtoward"]; //朝向(默认+选择) $params["title"] = $info["housetitle"]; //房源标题(输入) $params["description"] = $info["ProDesc"]; //房源描述(输入) $params["equipment"] = self::buildHouseConfig(isset($info["houseconfig"]) ? $info["houseconfig"] : array()); $params["rentType"] = $info["renttype"]; //租房类型(1.整租 2.合租) $params["shareType"] = isset($info["shareType"]) ? $info["shareType"] : 1; //合租类型1单间 2隔断间 3床位 新的发房页只有单间 $params["shareSex"] = $info["rentsex"] ? $info["rentsex"] : 0; //0男女不限 1限男生 2限女生 $params["rent_deposit_and_cycle"] = $info["paytype"] ? $info["paytype"] : '0|0'; //付款方式。仅对出租房(trade_type==2)。目前仅支持押几付几的形式,例如'3|1'表示押金为一个月的price,一次付款3个月price。(0|0)面议、(3|1)付3押1、(1|1)付1押1、(2|1)付2押1、(1|2)付1押2、(12|0)年付不押、(6|0)半年付不押、(12|1)年付押1、(6|1)半年付押1 ,其中年付押1、半年付押1只适用于大连、西安、成都经纪人 $params['from'] = 'my.anjuke.com'; // 如果小区id为0 if (!$params["comm_id"]) { $params['commName'] = $info['commname']; $params['commAddress'] = $info['comm_address']; $params['areaId'] = $info['areaid']; $params['blockId'] = $info['blockid']; } return Util_GlobalFunc::buildReturn(1, $params); // 下面这段逻辑的字段api不需要 /* // 房屋类型(读取) 读取所选择小区的“物业类型” // 建造年代(读取) 读取所选择小区的“竣工时间” $comminfo = Bll_Community_HzComm::getCommInfo($params["commId"]); if ($comminfo['status']) { $usetype = Dao_Broker_AjkProp::get_prop_usetype($info["cityId"],intval($comminfo['msg']['commBaseInfo']['USETYPE'])); $usetype_name_id = array('公寓'=>1,'别墅'=>4,'新里洋房'=>3,'其它'=>5,'老公房'=>2,'普通住宅'=>8,'四合院'=>7,'酒店公寓'=>6); $change_style = array(1=>1, 4=>2, 3=>3, 5=>4, 2=>5, 6=>6, 7=>7, 8=>8); $usetype_id = $change_style[$usetype_name_id[$usetype['TYPENAME']]]; $params["style"] = $usetype_id ? $usetype_id : intval($params["style"]); //物业类型 if (2 == $params["style"])//别墅强制转换楼层 { $pos = strpos($params["floor"],','); $params["floor"] = '0' . substr($params["floor"],$pos); } $params["year"] = $comminfo['msg']['commExtInfo']['SENDDATE'] ? date("Y", strtotime($comminfo['msg']['commExtInfo']['SENDDATE'])) : date("Y"); //竣工日期 if ($params["year"] > date('Y')) { $params["year"] = date('Y'); } //删除该经纪人房源缓存 $key = self::MEMCACHE_KEY_ZUFANG_CHAT_GETCOMMPROPS . '_' . $info["brokerId"] . '_' . $info["commId"] . '_' . date("Ymd"); $memcache = APF_Cache_Factory::get_instance()->get_memcache(); $result = $memcache->delete($key); } else { Util_GlobalFunc::buildReturn(0, $comminfo['msg']); } $params["style"] = $params["style"] ? $params["style"] : 1;//房屋类型 (//1公寓;2老公房;3新里洋房;4别墅;5其它 ;6洒店公寓;7四合院; 8普通住宅) return Util_GlobalFunc::buildReturn(1, $params); */ }
public function initComboZfProData($proInfos, $propMianNew, $combolist) { $data = $orderProId = array(); $tD = date('Ymd'); foreach ($proInfos as $proInVal) { $pro = array(); $orderProId[] = $proInVal->proid; $pro['id'] = $proInVal->proid; $pro['name'] = $propMianNew[$proInVal->proid]['contentBasic']['title']; $pro['commName'] = Util_String::truncate($proInVal->commname, 20, ''); $pro['area'] = $propMianNew[$proInVal->proid]['contentBasic']['areanum']; $roomStr = ''; if ($propMianNew[$proInVal->proid]['contentBasic']['roomnum']) { $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['roomnum'] . '室'; } if ($propMianNew[$proInVal->proid]['contentBasic']['hallnum']) { $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['hallnum'] . '厅'; } $pro['houseType'] = $roomStr; $pro['floor'] = intval($propMianNew[$proInVal->proid]['contentBasic']['floor']); $pro['floorAll'] = intval($propMianNew[$proInVal->proid]['contentBasic']['totalfloor']); $pro['price'] = $proInVal->pricenum; $pro['day'] = Bll_House_HzHouse::getLeftDays($proInVal->created); if ($pro['day']) { $pro['day'] .= '天'; } else { $pro['day'] = '<1天'; } /* $createDay = date('Ymd',$proInVal->created); if ($tD == $createDay) { $pro['day'] = '新发'; } else { $timeFixstr = strtotime($createDay) + 86400; $leftDays = 90 - floor((time() - $timeFixstr) / 86400); $leftDays = $leftDays > 0 ? $leftDays : 0; $pro['day'] = $leftDays . '天'; } */ foreach ($combolist as $val) { if ($val['houseId'] == $proInVal->proid) { $pro['status'] = $val['state']; } } if (!$pro['status']) { $pro['status'] = 2; } $pro['rentType'] = $propMianNew[$proInVal->proid]['contentBasic']['renttype'] == 1 ? 0 : 1; //出租方式,0整租,1合租 $data[] = $pro; } //根据最新发布时间排序 array_multisort($orderProId, SORT_DESC, $data); return $data; }
/** * 获取板块 * @return array */ public function do_getBlocks() { $result = Bll_House_HzHouse::getBlocks($this->cityId, $this->params['areaId']); return Util_GlobalFunc::buildReturn(1, $result); }
public function afterPost() { // 推广 if ($this->ctx['html_action'] == 'publish') { //伪登陆不能推广 if ($this->ctx['isManagerCookie']) { $this->redirect2Result(Const_PublishCode::PSEUDO_ERROR, $this->site, $this->action, $this->ctx['proId']); } if (Bll_City::isComboCity($this->ctx['cityId'])) { // 套餐推广 $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->ctx['ajkBrokerId'], $this->ctx['cityId'], $this->ctx['proId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ); } else { // 双证审核未通过 不能推广 // 获取经纪人信息 $brokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($this->ctx['hzBrokerId']); // 身份是否通过 $this->ctx['isPassVerify'] = $brokerInfo && Bll_Broker_HzBroker::isPassVerify($brokerInfo['profileVerify']); //if (!$isPassVerify) // $this->redirect2Result(Const_PublishCode::NOT_PASS_VERIFY, $this->site, $this->action, $this->ctx['proId']); // 获取账户余额 $balance = Bll_Broker_HzBroker::getAccountInfo($this->ctx['ajkBrokerId'], 'balance'); $this->ctx['validMoney'] = $balance && $balance['msg'] ? round($balance['msg'] / 100, 2) : 0; //if (!$validMoney) // $this->redirect2Result(Const_PublishCode::NOT_MONEY, $this->site, $this->action, $this->ctx['proId']); // ppc推广 $spreadResult = Bll_Plan_Fix_HzFix::addPropToPlan($this->ctx['planId'], $this->ctx['proId'], $this->ctx['cityId'], $this->ctx['ajkBrokerId']); } // 推广出错 if ($spreadResult['status'] <= 0) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, $this->site, $this->action, $this->ctx['proId'], $spreadResult['msg']); } } //++++++ others actions // 委托 if (isset($this->ctx['isCommission']) && $this->ctx['isCommission']) { // 房源发布成功,回写委托信息 if ($this->ctx['commission'] && $this->ctx['proId']) { Bll_House_HzHouse::updateCommission($this->ctx['commissionId'], $this->ctx['proId']); } } }
/** * 获取租房的精选状态(可精选,可排队) * @param $list * @param $cityId * @param int $cityIsChoice * @return array */ public static function getZuFangChoiceStatus($list, $cityId, $cityIsChoice = 0) { $result = array('choiceStatus' => 0, 'choiceStatusName' => ''); if (empty($list) || empty($cityId) || !$cityIsChoice) { return $result; } $propId = $list['propId']; $created = $list['created']; $quality = $list['quality']; $expiredDay = Bll_House_HzHouse::getLeftDays($created); $list['proId'] = !$list['proId'] ? $propId : $list['proId']; $choiceStatusArr = self::getPropChoiceStatus(array($list), $cityId); if ($quality && $expiredDay >= 75) { $choiceStatus = $choiceStatusArr && !empty($choiceStatusArr[$propId]['choiceStatus']) ? $choiceStatusArr[$propId]['choiceStatus'] : '1'; } else { $choiceStatus = 0; } switch ($choiceStatus) { case 1: $result['choiceStatus'] = 1; $result['choiceStatusName'] = '可精选'; break; case 2: $result['choiceStatus'] = 2; $result['choiceStatusName'] = '可排队'; break; default: $result['choiceStatus'] = 0; $result['choiceStatusName'] = ''; } return $result; }