public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $planId = $this->_params['planId']; // 获取定价计划 $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId); if (!$fixPlan) { throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND); } // 暂停定价计划 $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "stop"); if (!$result['status']) { switch ($result['msg']) { case Const_HzErrorInfo::PLANSTOPING: throw new Exception('计划已经停止', Const_APIStatus::E_PLAN_ALREADY_STOPPED); break; default: return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } } // 记录定价上下架日志 $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_stop', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId); if ($result['status'] != 'ok') { return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']); } return array('status' => 'ok', 'data' => array()); }
public function handle_request_internal() { /* @params planId :计划id @params resType :默认为0,0表示不取计划房源信息,1为取房源信息 @params from :来源 @success return 该计划id的信息 */ if (!isset($this->_params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS); } if (!isset($this->_params['planId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1); } //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true); if (!empty($result)) { $return = array(); $return["status"] = "ok"; $return['data'] = $result; } else { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return $return; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propIds = $this->_params['propIds']; $planId = isset($this->_params['planId']) ? $this->_params['planId'] : null; $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $propIds = explode(',', $propIds); // 转换成数组 // 判断定价推广房源数量 $fixPlans = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId); if (empty($fixPlans)) { throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND); } // 定价房源总数不能超过50套 $fixPropNum = 0; foreach ($fixPlans as $planInfo) { $fixPropNum = $fixPropNum + $planInfo['prop_count']; } if ($fixPropNum + count($propIds) > 50) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3014); } // 房源加入定价计划组 if (is_null($planId)) { $planId = $fixPlans[0]['id']; } $ret = Bll_HzFixPlan::batchprop_into_fix($hzBrokerId, $propIds, $planId); if (!$ret['status']) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return array('status' => 'ok', 'data' => array()); }
public function handle_request_internal() { /* @params planId :计划id @params resType :默认为0,0表示不取计划房源信息,1为取房源信息 @params from :来源 @success return 该计划id的信息 */ if (!isset($this->_params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS); } if (!isset($this->_params['planId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR1); } //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $result = Bll_HzFixPlan::get_plan_detail($brokerId_hz, $this->_params['cityId'], $this->_params['planId'], true); if (!empty($result)) { $return = array(); $return["status"] = "ok"; if (!empty($result['property'])) { foreach ($result['property'] as $propertyList) { foreach ($propertyList['props'] as $propinfo) { $proprow["id"] = $propinfo['proid']; $proprow["type"] = $propinfo['content_basic']['protype']; $proprow["area"] = round($propinfo['content_basic']['areanum']); $proprow["commId"] = $propinfo['content_basic']['commid']; $proprow["commName"] = $propinfo['content_basic']['commname']; $proprow["hallNum"] = $propinfo['content_basic']['hallnum']; $proprow["price"] = round($propinfo['content_basic']['pricenum']); $proprow["priceUnit"] = "元"; $proprow["roomNum"] = $propinfo['content_basic']['roomnum']; $proprow["title"] = $propinfo['content_basic']['title']; $proprow["toiletNum"] = $propinfo['content_basic']['toilnetnum']; $proprow["clickNum"] = $propinfo['fix_click']; $proprow["isBid"] = $propinfo['is_bid']; if ($propinfo['content_basic']['quality']) { $proprow["isMoreImg"] = 1; //多图 } else { $proprow["isMoreImg"] = 0; } $result['propertyList'][] = $proprow; unset($proprow); } } unset($result['property']); } $return['data'] = $result; $cityTop = Bll_HzFixPlan::get_citytop($this->_params['cityId']); //播种城市 if (!empty($cityTop)) { $fixPlanPropCeiling = round($cityTop['money'] / 100, 2); $return['data']['plan']['fixPlanPropCeiling'] = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0; } } else { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return $return; }
public function handle_request_internal() { $ajkBrokerId = $this->_params['brokerId']; //根据安居客经纪人ID获取好租经纪人ID $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId); //获取租房定价信息 $fixPlansInfo = Bll_HzFixPlan::get_broker_fixplans($hzBrokerId); //获取竞价计划状态 $fixPlanStatus = $fixPlansInfo[0]['status'] == 1 ? V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_1 : V1_Zufang_Fix_SummaryController::RETURN_CODE_NUM_0; //获取计划ID $fixPlanId = $fixPlansInfo[0]['id']; $cityId = $fixPlansInfo[0]['city_id']; //获取租房点击和花费信息 $promotion = Dao_Broker_HzPlan::get_plan_fee($hzBrokerId, $fixPlanId, date('Ymd'), 1); // 获取租房今日点击 $fixPropIds = Model_Plan_HzPlanning::getFixPropIdsByPlanId($fixPlanId); $clicks = Model_Stats_PropClick::getPropBidClick($fixPropIds, $hzBrokerId, $cityId); $fixClickSums = Model_Stats_PropClick::calculateClickSumsGroupByPropId($clicks, 'fix'); $todayClicks = 0; foreach ($fixClickSums as $clickSum) { $todayClicks += $clickSum; } //租房某计划的房源总量 $totalProps = Model_Plan_HzPlanning::getFixPlanPropNum($fixPlanId); //查询经纪人新封顶模式信息 //todo 等多档封顶合并了方法迁移到多档封顶 $ppcLimitInfo = $this->getPpcBrokerLimitInfo($ajkBrokerId, V1_Zufang_Fix_SummaryController::PPC_BROKER_LIMIT_HZ_SITE); if (!$ppcLimitInfo) { return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => '封顶数据未能取到!'); } $todayConsume = $promotion[$fixPlanId]['total_cost'] ? $promotion[$fixPlanId]['total_cost'] : 0; return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('planId' => $fixPlanId, 'todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps, 'planStatus' => $fixPlanStatus, 'budget' => $ppcLimitInfo['amountLimit'] / 100, 'budgetUnit' => '元')); }
public function handle_request_internal() { $brokerId_ajk = $this->_params['brokerId']; if (empty($brokerId_ajk)) { return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS); } //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk); $fixplans = Bll_HzFixPlan::get_broker_fixplans($brokerId_hz); $ret = array('status' => 'ok', 'data' => array()); if ($fixplans) { $plan = array(); $status_arr = array(1 => '有效', 2 => '计划上限', 3 => '手工结束', 4 => '暂停', 5 => '待推广', 6 => '删除', 7 => '余额上限', 9 => '手动停止'); $city_id = $fixplans[0]['city_id']; if (empty($city_id)) { $user_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); $city_id = $user_info['cityid']; } $cityTop = Bll_HzFixPlan::get_citytop($city_id); //播种城市 foreach ($fixplans as $planInfo) { if (!empty($cityTop)) { $fixPlanPropCeiling = round($cityTop['money'] / 100, 2); $fixPlanPropCeiling = $fixPlanPropCeiling ? $fixPlanPropCeiling : 0; } else { $fixPlanPropCeiling = $planInfo['amount'] ? $planInfo['amount'] : 0; } $tmp = array('fixPlanId' => $planInfo['id'], 'fixPlanName' => $planInfo['plan_title'], 'fixPlanPropCeiling' => $fixPlanPropCeiling, 'fixPlanPropNum' => $planInfo['prop_count'] ? $planInfo['prop_count'] : 0, 'fixPlanState' => $planInfo['status'], 'fixPlanStateDesc' => $status_arr[$planInfo['status']]); $plan['planList'][] = $tmp; } $ret = array('status' => 'ok', 'data' => $plan); } return $ret; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propId = $this->_params['propId']; $budget = $this->_params['budget']; $offer = $this->_params['offer']; //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); if ($brokerId_hz) { $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); if (!Bll_City::isBidCity($broker_info['cityid'])) { $error_code = Const_HzErrorInfo::NOBIDCITY; return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code)); } } $plan_id = Bll_HzBidPlan::get_planid_by_propid($propId); //@todo 不明白为什么一定要用propid而不用计划id $ret_offer = Bll_HzBidPlan::change_bid_offer($plan_id, $offer); //修改出价 $ret_budget = Bll_HzBidPlan::change_bid_budget($plan_id, $budget); //修改预算 ----$new_amount 为需要增加的预算 $r = array(); if ($ret_offer['status'] && $ret_budget['status']) { $r = array('status' => 'ok', 'data' => array()); } else { if (!$ret_offer['status']) { $r = array('status' => 'error', 'errcode' => $ret_offer['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_offer['msg'])); } if (!$ret_budget['status']) { $r = array('status' => 'error', 'errcode' => $ret_budget['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret_budget['msg'])); } } return $r; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propIds = $this->_params['propIds']; $cityId = $this->_params['cityId']; $paramsApi['from'] = APF::get_instance()->get_config('java_api_from'); $paramsApi['proids'] = $propIds; $paramsApi['proid'] = $propIds; $paramsApi['token'] = $this->_params['token']; $paramsApi['brokerId'] = $brokerId; $paramsApi['tradeType'] = 2; if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $paramsApi['isComboBroker'] = true; $api_url = 'rent/properties/deletes?json'; $data = Util_CallAPI::callJavaInternalApi($api_url, $paramsApi, false); if ($data['data']['status'] === 'ok') { $ret = array('status' => 'ok', 'data' => array()); } else { $ret = Util_MobileAPI::error(Const_APIStatus::E_PROP_DEL_FAILED); } return $ret; } else { $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $ret = Bll_HzProp::delete_prop($brokerId_hz, $cityId, $propIds); if ($ret) { $return = array('status' => 'ok', 'data' => array()); } else { $return = Util_MobileAPI::error(Const_APIStatus::E_PROP_DEL_FAILED); } return $return; } }
public function beforeUpDownWorkerHandler() { if (empty($this->params['broker_id'])) { throw new Exception_BllErrorException("经纪人ID为空"); } $this->params['ajk_broker_id'] = $this->params['broker_id']; // 获取好租brokerid if (!($this->params['broker_id'] = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->params['broker_id']))) { throw new Exception_BllErrorException("获取好租经纪人失败"); } }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $city_id = $this->_params['cityId']; $result = Bll_HzFixPlan::get_outline_list($brokerId_hz, $city_id, 0); $return = array(); $return["status"] = "ok"; $return['data']['num'] = $result; return $return; }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId = $this->_params['brokerId']; $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $city_id = $this->_params['cityId']; //get bid flg for city $choiceCityFlag = Bll_City::isChoiceCity($city_id, Const_Site::HAOZU); if ($choiceCityFlag) { return array('status' => 'ok', 'data' => array('propertyList' => array(), 'codeNum' => Const_HzErrorInfo::NOBIDCITY)); } $result = Bll_HzBidPlan::get_broker_bidprop($brokerId_hz, $city_id); if (!empty($result)) { $props = array(); foreach ($result as $key => $prop) { $prop_basic['id'] = $prop['proid']; $prop_basic['title'] = $prop['prop']['content_basic']['title']; $prop_basic['commId'] = $prop['prop']['content_basic']['commid']; $prop_basic['commName'] = $prop['prop']['content_basic']['commname']; $prop_basic['roomNum'] = $prop['prop']['content_basic']['roomnum']; $prop_basic['hallNum'] = $prop['prop']['content_basic']['hallnum']; $prop_basic['toiletNum'] = $prop['prop']['content_basic']['toilnetnum']; $prop_basic['area'] = round($prop['prop']['content_basic']['areanum']); $prop_basic['price'] = round($prop['prop']['content_basic']['pricenum']); $prop_basic['priceUnit'] = "元"; $prop_basic['bidStatus'] = $prop['plan']['status']; $prop_basic['index'] = $prop['rank']; $prop_basic['clickNum'] = $prop['clicks']; $prop_basic['offer'] = $prop['offer']; $prop_basic['budget'] = $prop['reconsume']; $prop_basic['yusuan'] = $prop['consume']; if ($prop['plan']['status'] != 1) { $prop_basic['yusuan'] = 20; $prop_basic['bidStatus'] = 3; //@todo 此处是个坑,后续要改 } //增加委托房源标签 $isEntrust = Bll_Zufang_Choice::isCommissionHouse($prop['proid'], $brokerId, Model_House_Commission::TYPE_RENT); if ($isEntrust) { $prop_basic['isEntrust'] = 1; } else { $prop_basic['isEntrust'] = 0; } $prop_basic['planId'] = $key; $props['propertyList'][] = $prop_basic; } } else { $props['propertyList'] = array(); } $ret = array('status' => 'ok', 'data' => $props); return $ret; }
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)); }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $city_id = $this->_params['cityId']; $result = Bll_HzFixPlan::get_broker_plans($brokerId_hz, $city_id); if (!empty($result)) { $return = array(); $return["status"] = "ok"; if (!Bll_City::isBidCity($city_id)) { $result['bidPlan']['bidPlanPropNum'] = 0; } $return['data'] = $result; } else { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return $return; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propIds = $this->_params['propId']; $propIds = explode(',', $propIds); $planId = $this->_params['planId']; // 获取定价计划 $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId); if (!$fixPlan) { throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND); } // 批量取消房源定价推广 $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $result = Bll_HzFixPlan::batchprop_out_fix($hzBrokerId, $propIds, $planId); if (!$result['status']) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return array('status' => 'ok', 'data' => array()); }
public function handle_request_internal() { $brokerId_ajk = (int) $this->_params['brokerId']; $planId = (int) $this->_params['planId']; $amount = $this->_params['ceiling']; if (!($amount >= 10 && $amount <= 1000)) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId_ajk); $result = Bll_HzFixPlan::change_fix_budget($brokerId_hz, $planId, $amount); if ($result['status'] == 1) { $return = array(); $return["status"] = "ok"; $return['data'] = array(); } else { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_ERR_3013); } return $return; }
public function handle_request_combo() { $ajkBrokerId = $this->brokerId; //获取经纪人套餐推广今日点击量 $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($ajkBrokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_HZ); $comboList = Bll_Combo_HouseRelation::getHouseRelations($ajkBrokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($ajkBrokerId); $propIds = array(); foreach ($comboList as $row) { $propIds[] = $row['houseId']; } $propertyList = Model_House_HzPropSearch::getPropList($propIds, $hzBrokerId, $this->cityId); foreach ($propertyList as $key => $list) { $row['publishDays'] = floor((time() - $list['created']) / 86400); if (in_array($list['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { unset($propertyList[$key]); } } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $comboClick, 'totalProps' => count($propertyList))); }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); if ($brokerId_hz) { $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); if (!Bll_City::isBidCity($broker_info['cityid'])) { $error_code = Const_HzErrorInfo::NOBIDCITY; return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code)); } } $ret = Bll_HzBidPlan::prop_out_bid($brokerId_hz, $this->_params['propId']); $r = array(); if ($ret['status']) { $r = array('status' => 'ok', 'data' => array()); } else { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } return $r; }
public function handle_request_internal() { /* @params planId :计划id @params resType :默认为0,0表示不取计划房源信息,1为取房源信息 @params from :来源 @success return 该计划id的信息 */ if (!isset($this->_params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS); } if (!isset($this->_params['cityId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS); } //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $result = Bll_HzFixPlan::get_outline_list($brokerId_hz, $this->_params['cityId'], 1, false); $return = array(); $return["status"] = "ok"; $return["data"]['propertyList'] = array(); if (!empty($result)) { $proprow = array(); foreach ($result as $propertyList) { $proprow["id"] = $propertyList['proid']; $proprow["title"] = $propertyList['content_basic']['title']; $proprow["commId"] = $propertyList['content_basic']['commid']; $proprow["commName"] = $propertyList['content_basic']['commname']; $proprow["roomNum"] = $propertyList['content_basic']['roomnum']; $proprow["hallNum"] = $propertyList['content_basic']['hallnum']; $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum']; $proprow["area"] = round($propertyList['content_basic']['areanum']); $proprow["price"] = round($propertyList['content_basic']['pricenum']); $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0; $proprow["priceUnit"] = "元"; $return["data"]['propertyList'][] = $proprow; unset($proprow); } unset($result); } return $return; }
public function beforeUpDownWorkerHandler() { if (empty($this->params['broker_id'])) { throw new Exception_BllErrorException('broker_id 为空'); } if (empty($this->params['pro_id'])) { throw new Exception_BllErrorException('房源ID为空'); } $this->params['ajk_broker_id'] = $this->params['broker_id']; // 获取好租brokerid if (!($this->params['broker_id'] = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->params['broker_id']))) { throw new Exception_BllErrorException('获取好租经纪人失败'); } // 是否套餐经纪人 //$this->params['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($this->params['ajk_broker_id']); $this->params['isComboCity'] = Bll_City::isComboCity($this->params['city_id']); // 房子非空判断 if (!Bll_HzProp::get_prop($this->params['pro_id'], true)) { throw new Exception_BllErrorException('房源' . $this->params['pro_id'] . '不存在'); } }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); if ($brokerId_hz) { $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); if (!Bll_City::isBidCity($broker_info['cityid'])) { $error_code = Const_HzErrorInfo::NOBIDCITY; return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code)); } } $propId = $this->_params['propId']; $planId = $this->_params['planId']; $ret = Bll_HzBidPlan::delete_bid($brokerId_hz, $planId, $propId); //竞价解冻开发中 if ($ret['status']) { $r = array('status' => 'ok', 'data' => array()); } else { $r = array('status' => 'error', 'errcode' => $ret['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret['msg'])); } return $r; }
public function handle_request_internal() { //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($this->_params['brokerId']); $proid = $this->_params['propId']; $cityId = $this->_params['cityId']; if (!Bll_City::isBidCity($cityId)) { $error_code = Const_HzErrorInfo::NOBIDCITY; return array('status' => 'error', 'errcode' => $error_code, 'message' => Bll_HzFixPlan::get_message_from_code($error_code)); } $offer = $this->_params['offer']; //offer竞价出价 $budget = $this->_params['budget']; //amount竞价预算(冻结金额) $ret = Bll_HzBidPlan::prop_into_bid($brokerId_hz, $cityId, $proid, $offer, $budget, $this->_params['brokerId']); $r = array(); if ($ret['status']) { $r = array('status' => 'ok', 'data' => array()); } else { $r = array('status' => 'error', 'errcode' => $ret['msg'], 'message' => Bll_HzFixPlan::get_message_from_code($ret['msg'])); } return $r; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $planId = $this->_params['planId']; // 获取定价计划 $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId); if (!$fixPlan) { throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND); } // 开启定价计划 $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "repeat"); if (!$result['status']) { switch ($result['msg']) { case Const_HzErrorInfo::PLANFIXING: throw new Exception('计划已经开启', Const_APIStatus::E_PLAN_ALREADY_STARTED); break; case Const_HzErrorInfo::BROKERCHECK: throw new Exception('您的身份认证未通过审核,请联系你的客户经理', Const_APIStatus::E_BROKER_ISNOT_VERFIYED); break; case Const_HzErrorInfo::PLANMONEY: throw new Exception('账户余额不足,请充值后操作', Const_APIStatus::E_BROKER_NO_MONEY); break; case Const_HzErrorInfo::PLANAMOUNT: throw new Exception('今日限额已经用完,请调整限额后操作', Const_APIStatus::E_PLAN_ERR_3013); break; default: return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR); } } // 记录定价上下架日志 $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_start', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId); if ($result['status'] != 'ok') { return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']); } return array('status' => 'ok', 'data' => array()); }
public static function get_broker_ppc_info_hz($brokerId, $cityId) { $brokerid_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $hzClick = $hzConsume = $hzBidHouseNum = $hzNotFixHouseNum = 0; $hzFixHouse = array(); $hz_ppc_temp = Bll_HzFixPlan::get_broker_plans($brokerid_hz, $cityId); $hzBidHouseNum = intval($hz_ppc_temp['bidPlan']['bidPlanPropNum']); foreach ((array) $hz_ppc_temp['fixPlan'] as $fix_plan) { $hzFixHouse[] = array('fixId' => $fix_plan['fixPlanId'], 'fixName' => $fix_plan['fixPlanName'], 'fixNum' => $fix_plan['fixPlanPropNum'], 'fixStatus' => $fix_plan['fixPlanState'], 'fixStatusDesc' => $fix_plan['fixPlanStateDesc']); } $hzNotFixHouseNum = $hz_ppc_temp['unRecommendPropNum']; $hz_click_temp = Bll_HzFixPlan::get_all_clickinfo($brokerid_hz, $cityId); $hzClick = $hz_click_temp['total_click']; $hzConsume = $hz_click_temp['total_consume']; return array('hzClick' => $hzClick, 'hzConsume' => $hzConsume, 'hzFixHouse' => $hzFixHouse, 'hzBidHouseNum' => $hzBidHouseNum, 'hzNotFixHouseNum' => $hzNotFixHouseNum); }
public function getPpcPropsInOneComm($brokerId, $cityId, $commId = '') { //获取该经纪人下所有的房源列表(竞价、定价、待推广房源) $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); $plannings = Dao_Broker_HzPlan::get_broker_planning($hzBrokerId); $base_domain = APF::get_instance()->get_config('base_domain'); $commProps = array(); if (!empty($plannings)) { $planIds = array(); foreach ($plannings as $arr) { $planIds[] = $arr['plan_id']; } //参与推广房源 $plansProps = Bll_HzFixPlan::get_plan_props($planIds, $cityId); $propCommPair = array(); foreach ($plansProps as $planProps) { foreach ($planProps['props'] as $propId => $prop) { $contentBasic = $prop['content_basic']; $row = array(); $row['id'] = $propId; $row['title'] = $contentBasic['title']; $row['commId'] = $contentBasic['commid']; $row['commName'] = $contentBasic['commname']; $row['roomNum'] = $contentBasic['roomnum']; $row['hallNum'] = $contentBasic['hallnum']; $row['toiletNum'] = $contentBasic['toilnetnum']; $row['area'] = round($contentBasic['areanum']); $row['price'] = round($contentBasic['pricenum']); $row['priceUnit'] = '元/月'; $row['imgUrl'] = 'http://pages.haozu.ajkcdn.com/20120824/img/global/nopic2_100-75.gif'; $row['isMoreImg'] = $contentBasic['quality'] ? 1 : 0; $row['renttype'] = $contentBasic['renttype']; $row['propUrl'] = 'http://' . $base_domain . '/web/rent/x/' . $contentBasic['cityid'] . '/' . $propId . '-3'; $row['isBid'] = 0; $row['isChoice'] = 0; $row['isVisible'] = intval($contentBasic['status'] != 6); $row['isPhonePub'] = intval(isset($contentBasic['from']) && $contentBasic['from'] == 'mobile-ajk-broker'); $row['publishDays'] = floor((time() - $contentBasic['created']) / 86400); $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布'; $row['createTime'] = date('Y-m-d H:i:s', $contentBasic['created']); $row['updateTime'] = date('Y-m-d H:i:s', $contentBasic['updated']); $commProps[$contentBasic['commid']][$propId] = $row; // 房源小区映射关系,用于添加房源的默认图片 $propCommPair[$propId] = $contentBasic['commid']; } } if ($propCommPair) { $propIds = array_keys($propCommPair); // 添加房源默认图 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds); foreach ($defaultImages as $defaultImage) { $propId = $defaultImage['proid']; $commProps[$propCommPair[$propId]][$propId]['imgUrl'] = $defaultImage->imageUrl(); } $relations = Model_Plan_HzPlanning::getBidRelationsByHouseIds($propIds, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING)); // 批量获取房源竞价计划 $planIds = array(); $planPropMap = array(); foreach ($relations as $relation) { $planIds[] = $relation['plan_id']; $planPropMap[$relation['plan_id']] = $relation['proid']; } if ($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']]; $commProps[$propCommPair[$propId]][$propId]['isChoice'] = 1; } else { $propId = $planPropMap[$plan['id']]; $commProps[$propCommPair[$propId]][$propId]['isBid'] = 1; } } } } } $return = $commProps; // 如果是获取某单个小区房源列表 if ($commId) { $ret['status'] = 'ok'; $ret['data']['propertyList'] = $return[$commId] ? array_values($return[$commId]) : array(); } else { $ret = $return; } return $ret; }
public function handle_request_internal() { /* @params planId :计划id @params resType :默认为0,0表示不取计划房源信息,1为取房源信息 @params from :来源 @success return 该计划id的信息 */ if (!isset($this->_params['brokerId'])) { return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS); } $brokerId = $this->_params['brokerId']; //根据安居客经纪人ID获取好租经纪人ID $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId); if ($brokerId_hz) { $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz); if (!Bll_City::isBidCity($broker_info['cityid'])) { return array('status' => 'ok', 'data' => array('propertyList' => array())); } } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { //获取套餐推广房源列表 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); if (!empty($comboList)) { foreach ($comboList as $combo) { $comboIds[$combo['houseId']] = 1; } //获取竞价房源 去除竞价房源 $validBidPlans = Model_Plan_HzPlanBasic::getBidPlansByBrokerId($brokerId_hz); $planIds = array(); if (!empty($validBidPlans)) { foreach ($validBidPlans as $plan) { if ($plan['flag'] == 1 && $plan['status'] != Const_HzPlan::DELETE) { $planIds[] = $plan['id']; } } if (!empty($planIds)) { $bidPlannings = Model_Plan_HzPlanning::getPlanningByPlanIds($planIds); } if (!empty($bidPlannings)) { foreach ($bidPlannings as $bid) { unset($comboIds[$bid['proid']]); } } } //$propertyList = Model_House_HzProp::getPropsByPropIds(array_keys($comboIds)); $propertyList = Dao_Broker_HzProp::get_prop(array_keys($comboIds)); if (!empty($propertyList)) { foreach ($propertyList as $key => $list) { if ($list['content_basic']['quality'] != 1) { unset($propertyList[$key]); } } } $result = $propertyList; } else { $result = array(); } //去除竞价房源和非多图房源 } else { $result = Bll_HzBidPlan::get_canbid_props($brokerId_hz); } $return = array(); $return["status"] = "ok"; $return["data"]['propertyList'] = array(); if (!empty($result)) { $proprow = array(); foreach ($result as $propertyList) { $proprow["id"] = $propertyList['proid']; $proprow["title"] = $propertyList['content_basic']['title']; $proprow["commId"] = $propertyList['content_basic']['commid']; $proprow["commName"] = $propertyList['content_basic']['commname']; $proprow["roomNum"] = $propertyList['content_basic']['roomnum']; $proprow["hallNum"] = $propertyList['content_basic']['hallnum']; $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum']; $proprow["area"] = round($propertyList['content_basic']['areanum']); $proprow["price"] = round($propertyList['content_basic']['pricenum']); $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0; $proprow["priceUnit"] = "元"; $return["data"]['propertyList'][] = $proprow; unset($proprow); } unset($result); } return $return; }
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)); }
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)); }
/** * 检查参数 * @param $params * @return array */ private static function checkParams(&$params) { if (empty($params['planId'])) { return Bll_HzPropBll::build_return(0, array("planId 为空")); } if (empty($params['brokerId'])) { return Bll_HzPropBll::build_return(0, array("brokerId 为空")); } $params['ajkBrokerId'] = $params['brokerId']; // 获取好租brokerid if (!($params['brokerId'] = Bll_HzBroker::get_brokerid_by_ajk_brokerid($params['brokerId']))) { return Bll_HzPropBll::build_return(0, array("获取好租经纪人失败")); } return Bll_HzPropBll::build_return(1, array("success")); }
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)); } }