public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $plans = Model_Plan_EsfFixedPlan::getValidPlan($brokerId); $props = 0; $result['status'] = 'ok'; if (!empty($plans)) { $planId = $plans['id']; $cityId = $plans['cityid'] ?: 0; $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($planId, $cityId); if (!empty($relations)) { $propIds = array(); foreach ($relations as $row) { $propIds[] = $row['proId']; } $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); $props = count($houseInfo); } $planBll = new DAO_My_Ppc_PlanOpe(); $clicks = $planBll->planTodayNewCost($planId); $data['planId'] = $planId; $data['todayClicks'] = $clicks['allclick']; $data['todayConsume'] = Util_Formatter::formatTodayConsume($clicks['allamount']); $data['todayConsumeUnit'] = '元'; $data['totalProps'] = $props; //获取计划状态 $api_url = '/service-ppc/rest/ppc/getPpcPlan/' . $planId . '?resType=1'; $plan_info = Util_CallAPI::get_data_from_java_api($api_url); $data['planStatus'] = $plan_info['data']['plan']['statusDescrip'] == '推广中' ? 1 : 0; $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId); $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0; $data['budgetUnit'] = '元'; } else { $brokerInfo = Model_Broker_AjkBrokerExtend::getDataByBrokerId($brokerId); $planId = Model_Plan_EsfFixedPlan::addPlan('定价推广组', 1, $brokerInfo->cityId, $brokerInfo->userId, $brokerInfo->brokerId); $data['planId'] = $planId; $data['todayClicks'] = $data['todayConsume'] = $data['totalProps'] = $data['planStatus'] = 0; $data['todayConsumeUnit'] = $data['budgetUnit'] = '元'; $limitInfo = Bll_Fixedspread_AjkFixedSpread::getLimitInfo($brokerId); $data['budget'] = !empty($limitInfo) ? round($limitInfo['amountLimit'] / 100, 2) : 0; } $result['data'] = $data; return $result; }
public function handle_request_internal() { // TODO: Implement handle_request_internal() method. $result['status'] = 'ok'; $cityId = $this->_params['cityId']; $brokerId = $this->_params['brokerId']; $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($this->_params['planId'], $cityId); $propertyList = array('newList' => array(), 'oldList' => array()); if (!empty($relations)) { $propIds = array(); foreach ($relations as $row) { $propIds[] = $row['proId']; } $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array('postDate' => 'desc')); //房源点击量 $proClickDao = new DAO_My_Ppc_PlanOpe(); $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901")); $spreads = Model_Plan_AjkPropspread::getAjkPropSpreadByIds($propIds); if (!empty($spreads)) { foreach ($spreads as $row) { $spreadArr[$row['propId']]['bidVersion'] = $row['bidVersion']; $spreadArr[$row['propId']]['status'] = $row['status']; } } foreach ($houseInfo as $row) { $propId = $row['proId']; $list['propId'] = $propId; $list['title'] = $row['proName']; $list['commId'] = $row['commId']; $list['commName'] = $row['commName']; $list['roomNum'] = $row['roomNum']; $list['hallNum'] = $row['hallNum']; $list['toiletNum'] = $row['toiletNum']; $list['area'] = round($row['areaNum']); $list['price'] = is_float($row['proPrice']) ? round($row['proPrice'], 1) : $row['proPrice']; $list['priceUnit'] = '万'; $list['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0; $list['isBid'] = $list['isChoice'] = 0; if (isset($spreadArr) && isset($spreadArr[$propId])) { if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) { $list['isBid'] = 1; } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) { $list['isChoice'] = 1; } } $list['isMoreImg'] = $row['isHighQulity']; $list['isVisible'] = $row['isVisible']; $list['isPhonePub'] = $row['uriCode'] == 'mobile.asyn' || $row['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $list['createTime'] = $row['postDate']; $imgBll = Bll_Image_EsfHouseImage::getInstance(); $list['imgUrl'] = $imgBll->getThumbImageUrl($propId, $row['commId']); //增加委托房源标签 if ($row['commitionType'] == 2) { $list['isEntrust'] = 1; } else { $list['isEntrust'] = 0; } //计算出房源推广天数 $timeFixStr = strtotime(date("Ymd", $row['postDate'])); $leftDay = floor((time() - $timeFixStr) / 86400); if ($leftDay >= 30) { $propertyList['oldList'][] = $list; } else { $propertyList['newList'][] = $list; } } } $result['data'] = $propertyList; return $result; }
/** * 根据定价计划ID和城市获取定价推广房源 * @param $cityId * @param array $planIds * @return array|bool */ public static function getFixedOnlineProByPlanIds($cityId, $planIds = array()) { if (empty($cityId) || !is_numeric($cityId) || empty($planIds)) { return array(); } return Model_Plan_AjkFixRelation::getRelationListByPlanId($planIds, $cityId); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; //经纪人信息 $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } $communityList = array(); $cityId = $brokerInfo->cityId; $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($brokerId); if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { /** 租房 */ $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); //套餐列表 $propIds = array(); foreach ($comboList as $combo) { $propIds[] = $combo['houseId']; } if ($propIds && $hzBrokerId) { $hzPropList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $cityId); //房源信息 foreach ($hzPropList as $list) { //过滤无效房源 if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { continue; } $row = array(); $row['commId'] = $list['commid']; $row['commName'] = $list['commname']; $communityList[$list['commid']] = $row; } } /** 二手房 */ $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); if ($comboSpreadHouseList) { //获取房源信息 $propIds = array_keys($comboSpreadHouseList); $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); foreach ($propsInfo as $prop) { $row = array(); $row['commId'] = $prop->commId; $row['commName'] = $prop->commName; $communityList[$prop->commId] = $row; } } } else { //定价的情况 $brokerProps = Bll_Broker_HzBroker::getBrokerProps($brokerId, $cityId); // 获取房源关系列表 if ($brokerProps['status']) { /** 租房*/ $brokerProps = $brokerProps['msg']; $plans = $brokerProps['plans'][0]; //定价计划 $plannings = $brokerProps['plannings']; //计划房源关系 $propsTemp = $brokerProps['props']; //定价房源 if (empty($plans)) { $hzPropList = array(); } else { $hzPropList = array(); foreach ($propsTemp as $prop) { $hzPropList[$prop['proId']] = $prop; } foreach ($plannings as $key => $planning) { // 非有效 过滤掉 if (!Bll_HzFixPlan::isValidPlanning($planning['isValid'])) { unset($hzPropList[$planning['proId']]); } } } foreach ($hzPropList as $prop) { $row = array(); $row['commId'] = $prop['commId']; $row['commName'] = $prop['commName']; $communityList[$prop['commId']] = $row; } } /** 二手房*/ //获取经纪人有效定价计划 计划表 $fixSpreadPlanList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList($brokerId); $fixPlanId = $fixSpreadPlanList[0]['id']; //关系表中获取房源; if ($fixPlanId) { $relations = Model_Plan_AjkFixRelation::getRelationListByPlanId($fixPlanId, $cityId); $propIds = array(); foreach ($relations as $relation) { $propIds[] = $relation['proId']; } if ($propIds) { $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); foreach ($propsInfo as $prop) { $row = array(); $row['commId'] = $prop->commId; $row['commName'] = $prop->commName; $communityList[$prop->commId] = $row; } } } } //对小区按首字母排序 $communityList = $this->communitySortByCommCode($communityList); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('communityList' => array_values($communityList))); }