public function handle_request_internal() { //判断房源是否定价 拿propid去static_price_relation 查PlanId 再去static_price_plan表中查定价信息 $propId = $this->_params['propId']; $cityId = $this->_params['cityId']; //好丑陋。。。。。。好无奈。。。。。。 //委托房源自动转发停用,为了app能够展示报错信息。。。 if (empty($propId)) { $this->_params['apiDebug'] = 1; return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布'); } $relation = Model_Plan_AjkFixRelation::getRelationByProId($propId, $cityId); $result['status'] = 'ok'; $data['totalClicks'] = $data['todayClicks'] = $data['clickPrice'] = 0; $data['planId'] = ''; if (!empty($relation)) { if ($relation['status'] == Model_Plan_AjkFixRelation::STATUS_NORMAL) { $data['status'] = 1; //房源在定价推广中 } else { $data['status'] = 0; //未推广 } $plan = Model_Plan_EsfFixedPlan::getValidStaticPricePlanById($relation['planId']); $data['planId'] = $plan[0]['id']; if (!empty($plan)) { //房源在定价推广中 //房源点击量 $proClickDao = new DAO_My_Ppc_PlanOpe(); $proClickInfo = $proClickDao->getProClick($propId, strtotime("20120901")); if (!empty($proClickInfo)) { if (isset($proClickInfo[$propId])) { $data['totalClicks'] = $proClickInfo[$propId]; } $data['todayClicks'] = $proClickInfo['todayClicks']; } } } else { $data['status'] = 0; //未推广 } //获取点击单价 $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $cityId); if (!empty($houseInfo)) { $proPriceInt = $houseInfo[0]['proPriceInt']; $priceArr = DAO_My_Ppc_UtilTool::getPriceInterval($cityId, $proPriceInt - 0.01); if (!empty($priceArr)) { $data['clickPrice'] = round($priceArr['price'], 2); } } $data['clickPriceUnit'] = '元'; $result['data'] = $data; return $result; }
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() { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; $result['status'] = 'ok'; $propertyList = array(); $subscriptionInfo = Model_Choice_Subscription::selectData(array(Model_Choice_Subscription::SITE => Model_Choice_Subscription::SITE_AJK, Model_Choice_Subscription::BROKER_ID => $brokerId, Model_Choice_Subscription::STATUS => Model_Choice_Subscription::SUBSCRIPTION_START)); if (!empty($subscriptionInfo)) { $propIds = array(); foreach ($subscriptionInfo as $row) { $propIds[] = $row['propId']; } $houseInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId, array('postDate' => 'desc')); //房源点击量 $proClickDao = new DAO_My_Ppc_PlanOpe(); $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901")); 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'] = round($row['proPrice']); $list['priceUnit'] = '万'; $list['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0; $list['isBid'] = $list['isChoice'] = 0; $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']); //委托房源标签 $list['isEntrust'] = $row['commitionType'] == 2 ? 1 : 0; $propertyList[] = $list; } } $result['data']['propertyList'] = $propertyList; 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; }
public function getPpcPropsInOneComm($brokerId, $cityId, $commId = '') { //获取该经纪人下所有的房源列表(竞价、定价) $props = Bll_BrokerInfoApp::get_broker_fixprops($brokerId, $cityId); $base_domain = APF::get_instance()->get_config('base_domain'); $propIds = array(); foreach ($props as $propArr) { $propIds[] = $propArr['ProId']; } //房源点击量 $proClickDao = new DAO_My_Ppc_PlanOpe(); $proClickInfo = $proClickDao->getProClick($propIds, strtotime("20120901")); //房源计划形态(是精选还是竞价) $spreads = array(); if ($propIds) { $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']; } } if (!empty($props)) { foreach ($props as $propArr) { $propId = $propArr['ProId']; $commProps[$propArr['CommId']][$propId]['id'] = $propId; $commProps[$propArr['CommId']][$propId]['title'] = $propArr['ProName']; $commProps[$propArr['CommId']][$propId]['commId'] = $propArr['CommId']; $commProps[$propArr['CommId']][$propId]['commName'] = $propArr['CommName']; $commProps[$propArr['CommId']][$propId]['roomNum'] = $propArr['RoomNum']; $commProps[$propArr['CommId']][$propId]['hallNum'] = $propArr['HallNum']; $commProps[$propArr['CommId']][$propId]['toiletNum'] = $propArr['ToiletNum']; $commProps[$propArr['CommId']][$propId]['area'] = $propArr['AreaNum']; $commProps[$propArr['CommId']][$propId]['price'] = $propArr['ProPrice']; $commProps[$propArr['CommId']][$propId]['priceUnit'] = '万'; $commProps[$propArr['CommId']][$propId]['isVisible'] = $propArr['IsVisible']; $commProps[$propArr['CommId']][$propId]['imgUrl'] = 'http://pages.anjukestatic.com/img/global/nopic_100x75.gif'; $commProps[$propArr['CommId']][$propId]['isMoreImg'] = $propArr['IsHighQulity'] ? 1 : 0; $commProps[$propArr['CommId']][$propId]['isPhonePub'] = $propArr['UriCode'] == 'mobile.asyn' || $propArr['UriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $commProps[$propArr['CommId']][$propId]['propUrl'] = 'http://' . $base_domain . '/web/sale/x/' . $propArr['CityId'] . '/' . $propId; $commProps[$propArr['CommId']][$propId]['createTime'] = date('Y-m-d H:i:s', $propArr['PostDate']); $commProps[$propArr['CommId']][$propId]['totalClicks'] = isset($proClickInfo[$propId]) ? $proClickInfo[$propId] : 0; $commProps[$propArr['CommId']][$propId]['isBid'] = $commProps[$propArr['CommId']][$propId]['isChoice'] = 0; if (isset($spreadArr) && isset($spreadArr[$propId])) { if ($spreadArr[$propId]['bidVersion'] == 1 && $spreadArr[$propId]['status'] == 1) { $commProps[$propArr['CommId']][$propId]['isBid'] = 1; } elseif ($spreadArr[$propId]['bidVersion'] == 2 && ($spreadArr[$propId]['status'] == 1 || $spreadArr[$propId]['status'] == 11)) { $commProps[$propArr['CommId']][$propId]['isChoice'] = 1; } } $imgBll = Bll_Image_EsfHouseImage::getInstance(); $commProps[$propArr['CommId']][$propId]['imgUrl'] = $imgBll->getThumbImageUrl($propId, $propArr['CommId']); } } $return = $commProps; if ($commId) { $ret['status'] = 'ok'; $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array(); } else { $ret = $return; } return $ret; }
/** * 获取二手房房源数据 * [getBrokerEsfPro description] */ private function getBrokerEsfPro() { //判断是否是套餐城市 $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_AJK, 1); $proIds = $this->getObjFieldInfo($comboList, 'houseId'); $clicksInfo = Bll_Ppc_NewPackageStatsBrokerDay::getHouseComboClickInfo($proIds, date('Ymd'), Model_Ppc_NewPackageStatsHouseDay::SITE_TYPE_AJK); 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 { //经纪人计划信息 $brokerPlanInfo = BLL_Plan_EsfPropFixedPlanRelation::get_instance()->getBrokerEsfOnlinePlan($this->brokerId); if (empty($brokerPlanInfo)) { //计划数据为空 $this->outData($data, 1); } //计划IDs $planIds = $this->getObjFieldInfo($brokerPlanInfo, 'id'); //定价推广房源 $fixedProInfos = Bll_Fixedspread_AjkFixedSpread::getFixedOnlineProByPlanIds($this->cityId, $planIds); if (empty($fixedProInfos)) { $this->outData($data, 1); } //房源IDs $proIds = $this->getObjFieldInfo($fixedProInfos, 'proId'); //房源点击量 $proClickDao = new DAO_My_Ppc_PlanOpe(); $proClickInfo = $proClickDao->getProClick($proIds); } $proInfos = Bll_House_EsfHouse::getHouseInfo($proIds, $this->cityId); if (empty($proInfos)) { $this->outData($data, 1); } //经纪人橱窗房源设置信息 $adProInfos = Bll_Broker_ShowcaseAdSetPro::getInstance()->getBrokerAdSalePropInfo($this->brokerId); $addPro = array(); if (!empty($adProInfos)) { foreach ($adProInfos as $adProVal) { $addPro[$adProVal->propId] = true; } } $this->initEsfProData($proInfos, $proClickInfo, $addPro); }