public function handle_request_internal() { if (mb_strlen($this->_params['title'], 'UTF-8') < 5 || mb_strlen($this->_params['title'], 'UTF-8') > 30) { return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE); } $params = Bll_ZuProp::gen_prop_info($this->_params); $params['proid'] = $this->_params['propId']; //unset($params['style']); //获取租房房信息 /*$propInfo = Bll_HzProp::get_prop($this->_params['propId']); $style = intval($propInfo['protype']) ? intval($propInfo['protype']) : 1; $change_style = array(1=>1, 4=>2, 3=>3, 5=>4, 2=>5, 6=>6, 7=>7, 8=>8); $params['style'] = $change_style[$style];*/ unset($params['year']); if (isset($params['status']) and $params['status'] === 'error') { return $params; } $brokerId = $this->_params['brokerId']; if (isset($brokerId) && Bll_Broker_HzBroker::isComboBroker($brokerId)) { $params['isComboBroker'] = true; $api_url = 'rent/properties/update?json=1'; } else { $params['isServiceInternal'] = 1; $params['isComboBroker'] = false; $api_url = '/service-internal/rest/properties/update?json=1'; } $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false); if ($result['data']['status'] !== 'ok') { return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code'])); } $return = array(); $return["status"] = "ok"; $return['data'] = array(); return $return; }
public function handle_request_internal() { /** * @var $request AJKRequest */ $request = APF::get_instance()->get_request(); $houseIds = $request->get_parameter('houseIds'); if (!is_array($houseIds)) { $houseIds = explode(',', $houseIds); } if (empty($houseIds)) { echo '{"status":"error"}'; return; } $cityId = $request->getBrokerCityId(); $houseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx(static::$intBrokerID, $houseIds, $cityId, array('proId', 'brokerId', 'cityId')); if (empty($houseInfoList) || count($houseInfoList) != count($houseIds)) { echo '{"status":"error"}'; return; } if (Bll_Broker_HzBroker::isComboBroker(static::$intBrokerID)) { if (Bll_House_EsfHouse::deleteHouseCombo(static::$intBrokerID, $cityId, $houseIds)) { echo '{"status":"ok"}'; return; } } else { if (Bll_House_EsfHouse::deleteHouse(static::$intBrokerID, $cityId, $houseIds)) { echo '{"status":"ok"}'; return; } } echo '{"status":"error"}'; }
public function handle_request_internal() { // @params proids :房源id 多个id以逗号间隔如22,33,44【必填】 // @params brokerId :经纪人id【必填】 // @params token :token【必填】 // @params from :请求来源【必填】 $paramsApi['from'] = APF::get_instance()->get_config('java_api_from'); $paramsApi['proids'] = $this->_params['propIds']; $paramsApi['token'] = $this->_params['token']; $paramsApi['brokerId'] = $this->_params['brokerId']; $brokerId = $this->_params['brokerId']; //判断经纪人为ppc经纪人 & 套餐经纪人 //根据不同类型判断调用不同的java接口 if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $paramsApi['isComboBroker'] = true; $api_url = 'sale/properties/deletes?json'; } else { $paramsApi['isComboBroker'] = false; $api_url = 'ppc/properties/deletes?json'; } $data = Util_CallAPI::callJavaInternalApi($api_url, $paramsApi, false); if ($data['data']['status'] === 'ok') { $ret = array('status' => 'ok', 'data' => array()); } else { $errcode = $data['data']['code']; $translate_errcode = $this->my_err_code($errcode); return Util_MobileAPI::error($translate_errcode); } return $ret; }
public function handle_request_internal() { if (!isset($this->_params["brokerId"])) { return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS); } if (!isset($this->_params["cityId"])) { return Util_MobileAPI::error(Const_APIStatus::E_PARAM_CITYID_MISS); } $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; $commProps = new V1_Anjuke_Chat_GetCommPropsController(); if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $props = $commProps->getComboPropsInOneComm($brokerId, $cityId); } else { $props = $commProps->getPpcPropsInOneComm($brokerId, $cityId); } if (!empty($props)) { $i = 0; foreach ($props as $propArr) { $tmpArr = array_keys($propArr); $commList[$i]['commId'] = $propArr[$tmpArr[0]]['commId']; $commList[$i]['commName'] = $propArr[$tmpArr[0]]['commName']; $commList[$i]['propNums'] = count($propArr); $i++; } } else { $commList = array(); } $return = array('status' => 'ok', 'data' => $commList); return $return; }
/** * init env * @param AJKRequest $request * @param $out * @throws Exception */ private static function initEnv($request, &$out) { $out['debug'] = isset($_GET['debug']) ? true : false; $out['cityId'] = $request->getBrokerCityId(); $out['ajkBrokerId'] = $request->getBrokerId(); $out['isComboBroker'] = Bll_Broker_HzBroker::isComboBroker($out['ajkBrokerId']); $route_matches = $request->get_router_matches(); $out['proId'] = trim($route_matches[2], "/ \t\n\r\v"); if (!$out['proId']) { throw new Exception('缺少房源Id参数'); } $jpMemberInfo = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']); // 获取金铺brokerId $out['jpBrokerId'] = $jpMemberInfo->id; // 是否精选 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::JINPU); $out['isBidCity'] = Bll_City::isBidCity($out['cityId'], Const_Site::JINPU); if ($out['isChoiceCity'] || $out['isBidCity']) { $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价'; $out['bidUrl'] = $out['isChoiceCity'] ? '/ajkbroker/user/choice/set/jp/' . $out['proId'] : '/jinpu/bid/new/' . $out['proId']; } $multicity = APF::get_instance()->get_config("cities", "multicity"); $out['cityName'] = $multicity[$out['cityId']]; // 获取经纪人信息 if (!($out['brokerInfo'] = Model_Broker_JpBroker::data_access()->filter('id', $jpMemberInfo->id)->get_row())) { throw new Exception('获取金铺经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']'); } }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; //检测title $checkRes = $this->checkTitle($this->_params); if (!$checkRes) { return Util_MobileAPI::error(Const_APIStatus::E_PROP_LENGTH_ERROE); } //构造房源接口数据 $params = Bll_Prop::gen_prop_info($this->_params); $params['proid'] = $this->_params['propId']; if (isset($params['status']) and $params['status'] === 'error') { return $params; } //判断经纪人为ppc经纪人 & 套餐经纪人 //根据不同类型判断调用不同的java接口 if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $params['isComboBroker'] = true; $api_url = 'sale/properties/update?json'; } else { $params['isComboBroker'] = false; $api_url = 'ppc/properties/update?json'; } //调用房源编辑接口 $result = Util_CallAPI::callJavaInternalApi($api_url, $params, false); if ($result['data']['status'] !== 'ok') { return Util_MobileAPI::error(Bll_Prop::changeJavaAPICodeToSelfCode($result['data']['code'])); } $return = array(); $return["status"] = "ok"; $return['data'] = array(); return $return; }
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 handle_request_internal() { $this->brokerId = $this->_params['brokerId']; $result = Bll_Broker_HzBroker::isComboBroker($this->brokerId); if ($result === false) { throw new Exception('非套餐经纪人'); } $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($this->brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } $this->cityId = $brokerInfo['cityId']; return $this->handle_request_combo(); }
public function handle_request_internal() { $app = $this->_params['app']; $cv = $this->_params['cv']; $cityId = $this->_params['cityId']; $brokerId = isset($this->_params['brokerId']) ? $this->_params['brokerId'] : 0; if ($app == 'i-broker2' && $cv == 4.3) { if (Bll_City::isBidCity($cityId)) { $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID); } else { if (Bll_City::isChoiceCity($cityId)) { $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE); } else { $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_NOTCHOICE_NOTBID, 'businessTypeName' => self::RETURN_CODE_MSG_NOTCHOICE_NOTBID); } } } else { if (Bll_City::isBidCity($cityId)) { $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_BID, 'businessTypeName' => self::RETURN_CODE_MSG_BID); } else { $return['businessType'] = array('businessTypeId' => self::RETURN_CODE_NUM_CHOICE, 'businessTypeName' => self::RETURN_CODE_MSG_CHOICE); } } //查询房源库权限 //$brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); //$fykStatus = V1_Fyk_User_PrivilegesController::getFykStatus($brokerInfo->userId,$cityId); $fykStatus = array('isOpen' => 0, 'status' => -1, 'message' => '房源库功能已关闭'); $return['fykStatus'] = $fykStatus; //获取是否试套餐城市 $timeBool = Model_Combo_BusinessUseConfig::getCityComboConfig($cityId); if (Bll_City::isComboCity($cityId) && !empty($timeBool) && time() > $timeBool['startTime']) { $return['comboBusinessType']['businessTypeId'] = self::RETURN_COMBO_CITY_NUM_YES; $return['comboBusinessType']['businessTypeName'] = self::RETURN_COMBO_CITY_MSG_YES; if ($brokerId) { $result = Bll_Broker_HzBroker::isComboBroker($brokerId); if ($result === false) { $return['updateComboBusiness']['isUpdateToComboBusiness'] = 1; $return['updateComboBusiness']['updateMessage'] = '移动经纪人由定价模式升级为套餐模式,立即切换使用吧!'; } else { $return['updateComboBusiness']['isUpdateToComboBusiness'] = 0; $return['updateComboBusiness']['updateMessage'] = ''; } } } else { $return['comboBusinessType'] = array('businessTypeId' => self::RETURN_COMBO_CITY_NUM_NO, 'businessTypeName' => self::RETURN_COMBO_CITY_MSG_NO); } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $return); }
public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect_to_login(); } /** * @var AJKRequest $request */ $request = APF::get_instance()->get_request(); $response = APF::get_instance()->get_response(); $params = $this->getParameters(); $route_matches = $request->get_router_matches(); $cityId = $request->getBrokerCityId(); $brokerId = $request->getBrokerId(); $response->set_content_type('text/html', 'utf-8'); if (empty($route_matches) || !isset($route_matches[1])) { APF::get_instance()->get_response()->redirect('/ajkbroker/user/house/propview/ajk/'); return false; } $business = trim($route_matches[1], "/ \t\n\r\v"); /** * 三网统一Controller入口,但是业务实现层使用各自的。 * @link http://php.net/manual/zh/language.types.callable.php */ $businessCallback = array('ajk' => array('Bll_House_PropView_AjkPropView', 'handlerPropViewRequest'), 'hz' => array('Bll_House_PropView_HzPropView', 'handlerPropViewRequest'), 'jp' => array('Bll_House_PropView_JpPropView', 'handlerPropViewRequest')); if (!isset($businessCallback[$business])) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '地址错误')))); } /** * 调用三网业务回调函数 * @link http://php.net/manual/zh/function.call-user-func.php */ $pageParams = call_user_func($businessCallback[$business], $this, $request, $response); if (false === $pageParams) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '系统繁忙')))); } //添加房东信息 $houseOwerInfo = $this->getCommissionHouseInfo($pageParams['houseInfo']['proId'], $pageParams['houseInfo']['brokerId']); if ($houseOwerInfo) { $this->setAttribute('houseOwerInfo', $houseOwerInfo); } $this->setAttributes($pageParams); $this->setAttribute('pageType', $business); $this->setAttribute('broker', self::$BrokerInfo); $this->setAttribute('isComboBroker', Bll_Broker_HzBroker::isComboBroker($brokerId)); return 'House_Propview'; }
/** * @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 int $brokerId * @param int $cityId * @param int $commissionId * @param AJKRequest $request * @return array * @throws Exception */ public static function preparePageParam($brokerId, $cityId, $commissionId, $request) { $commissionHouseInfo = static::getCommission($commissionId, $brokerId); if (empty($commissionHouseInfo)) { throw new Exception('获取委托房源信息失败', Const_PublishCode::COMMISSION_ERROR); } if ($commissionHouseInfo['brokerHouseId'] > 0) { throw new Exception('委托房源已经发布过【ID:' . $commissionHouseInfo['brokerHouseId'] . '】', Const_PublishCode::COMMISSION_ERROR_HOUSE_EXISTS); } $houseInfo = static::getCommissionHouseInfo($commissionHouseInfo['house']); $houseInfo['cityId'] = $cityId; /** 获取房源发布&编辑页面的示例URL */ $pageParams = Bll_House_EsfPublish::getExampleURL($cityId); $pageParams['houseInfo'] = $houseInfo; $pageParams['commissionId'] = $commissionId; /** 是否需要显示备案信息 */ $pageParams['houseRecordNumberConfig'] = Bll_House_EsfPublish::getHouseRecordNumberConfig($cityId); $pageParams['priceMentionUrl'] = Bll_House_EsfPublish::getPriceMentionUrl($cityId); $pageParams['publishHouseProtocolUrl'] = Bll_House_EsfPublish::getPublishHouseProtocolUrl($cityId); $pageParams['brokerId'] = $brokerId; $pageParams['cityId'] = $cityId; /** 装修情况 */ $pageParams['fitmentList'] = Model_House_FitmentType::getFitment($cityId); /** 房屋类型 */ $pageParams['useTypeList'] = Model_Community_UseType::getUseTypeByCityId($cityId); /** 房屋朝向 */ $pageParams['orientateList'] = APF::get_instance()->get_config('house_orientate', 'house'); /** 获取小区和房源公共标签 */ $pageParams['privateTagList'] = Bll_House_EsfPublish::getPrivateTagList(); /** 获取上传图片服务器 */ $pageParams['uploadImgService'] = Bll_House_EsfPublish::getUploadImageServer(); $pageParams['picData'] = array('UPDROOM' => array(), 'ALLMODEL' => array(), 'ALLCOMM' => array(), 'NEWUPDROOM' => Bll_House_EsfCommission::getCommissionImage($commissionHouseInfo['houseId'])); /** 最低首付配置 */ $miniPayDownConfig = Bll_House_EsfPublish::getMiniPayDownConfig($cityId); if (Bll_Broker_HzBroker::isPpcBroker($brokerId)) { $pageParams['canSpread'] = Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId); $pageParams['brokerActionTip'] = '推广房源已满,只能保存到未推广房源'; } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $checkCanSpreadResult = Bll_Combo_HouseRelation::housePublishComboCheck($brokerId, $cityId, Bll_Combo_HouseRelation::SITE_TYPE_AJK); $pageParams['canSpread'] = $checkCanSpreadResult['status'] == 1; $pageParams['brokerActionTip'] = $checkCanSpreadResult['msg']; } return array_merge($pageParams, $miniPayDownConfig); }
public function beforeHandlerRequest() { if (!$this->params['brokerId']) { $this->outPut(0, '参数缺失'); } // 获取经纪人信息 $brokerInfo = Model_Broker_AjkBrokerExtend::getDataByBrokerId($this->params['brokerId']); $this->params['cityId'] = $brokerInfo->cityId; $this->params['userId'] = $brokerInfo->userId; /** 不是套餐城市就直接返回 */ if (!Bll_City::isComboCity($this->params['cityId'])) { $this->outPut(0, '未开通套餐业务'); } /** 不是套餐经纪人直接返回 */ if (!Bll_Broker_HzBroker::isComboBroker($this->params['brokerId'])) { $this->outPut(0, '不是套餐经纪人'); } }
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); } if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } /** 套餐信息 */ $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId); usort($comboInfoList, function ($a, $b) { return $a['startTime'] > $b['startTime'] ? 1 : ($a['startTime'] == $b['startTime'] ? 0 : -1); }); $currentCombo = array(); $nextCombo = array(); $currentDate = time(); $currentComboStartDate = 0; $currentComboEndDate = 0; foreach ($comboInfoList as $comboInfo) { $startDate = strtotime($comboInfo['startTime']); $endDate = strtotime($comboInfo['endTime']); $totalPropNum = $comboInfo['rentPropNum'] + $comboInfo['salePropNum']; /** 获取当前使用的非商铺套餐 */ if ($currentDate >= $startDate && $currentDate < $endDate && $totalPropNum > 0) { $currentCombo = $comboInfo; $currentComboStartDate = $startDate; $currentComboEndDate = $endDate; } /** 获取续买的非商铺套餐 */ if ($comboInfo['rentPropNum'] > 0 && $startDate > $currentDate) { if (!empty($nextCombo)) { $nextComboEffectTime = strtotime($nextCombo['startTime']); if ($nextComboEffectTime > $startDate) { $nextCombo = $comboInfo; } } else { $nextCombo = $comboInfo; } } } return array('status' => 'ok', 'data' => array('currentCombo' => $currentCombo['name'], 'startDate' => date('Y.m.d', $currentComboStartDate), 'endDate' => date('Y.m.d', $currentComboEndDate), 'nextCombo' => $nextCombo['name'])); }
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); } if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } /** 套餐信息 */ $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId); $currentDate = time(); foreach ($comboInfoList as $comboInfo) { $startDate = strtotime($comboInfo['startTime']); $endDate = strtotime($comboInfo['endTime']); /** 获取当前使用的套餐 */ if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) { $currentCombo = $comboInfo; break; } } //获取经纪人套餐推广今日点击量 $comboClick = Bll_Ppc_NewPackageStatsBrokerDay::getComboClickInfo($brokerId, date('Ymd'), Model_Ppc_NewPackageStatsBrokerDay::SITE_TYPE_AJK); //经纪人没有套餐 if (!isset($currentCombo)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => 0)); } $cityId = $brokerInfo->cityId; //获取套餐推广信息 $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); //获取房源信息 $propIds = array_keys($comboSpreadHouseList); if ($propIds) { $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); $propsNum = count($propsInfo); } else { $propsNum = 0; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => intval($comboClick), 'totalProps' => $propsNum)); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propId = $this->_params['propIds']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //是否是端口经纪人 $cityId = $brokerInfo->cityId; if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } //可以批量取消推广 $params['houseIds'] = $propId; $res = Bll_Combo_HouseRelation::houseStopSpreadAction($brokerId, $cityId, $params); if ($res['status'] == 'error') { throw new Exception_HouseStopComboSpreadFailed($res['msg']); } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('msg' => '套餐取消推广成功')); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; if (!Bll_City::isBidCity($cityId)) { return array('status' => 'ok', 'data' => array('propertyList' => array())); } if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $props = Bll_BrokerInfoApp::get_combo_canbid_props($brokerId, $cityId); } else { $props = Bll_BrokerInfoApp::get_canbid_props($brokerId, $cityId); } if (!empty($props)) { $return = array(); $return["status"] = "ok"; $return["data"]['propertyList'] = array(); $proprow = array(); foreach ($props as $propertyList) { $proprow["id"] = isset($propertyList['ProId']) ? $propertyList['ProId'] : $propertyList->proId; $proprow["title"] = isset($propertyList['ProName']) ? $propertyList['ProName'] : $propertyList->proName; $proprow["commId"] = isset($propertyList['CommId']) ? $propertyList['CommId'] : $propertyList->commId; $proprow["commName"] = isset($propertyList['CommName']) ? $propertyList['CommName'] : $propertyList->commName; $proprow["roomNum"] = isset($propertyList['RoomNum']) ? $propertyList['RoomNum'] : $propertyList->roomNum; $proprow["hallNum"] = isset($propertyList['HallNum']) ? $propertyList['HallNum'] : $propertyList->hallNum; $proprow["toiletNum"] = isset($propertyList['ToiletNum']) ? $propertyList['ToiletNum'] : $propertyList->toiletNum; $proprow["area"] = isset($propertyList['AreaNum']) ? $propertyList['AreaNum'] : $propertyList->areaNum; $proprow["price"] = isset($propertyList['ProPrice']) ? $propertyList['ProPrice'] : $propertyList->proPrice; $proprow["isMoreImg"] = isset($propertyList['IsHighQulity']) ? $propertyList['IsHighQulity'] : $propertyList->isHighQulity; $proprow["priceUnit"] = "万"; $return["data"]['propertyList'][] = $proprow; unset($proprow); } } else { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array())); } return $return; }
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); } if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } /** 套餐信息 */ $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId); $currentDate = time(); foreach ($comboInfoList as $comboInfo) { $startDate = strtotime($comboInfo['startTime']); $endDate = strtotime($comboInfo['endTime']); /** 获取当前使用的套餐 */ if ($currentDate >= $startDate && $currentDate < $endDate && $comboInfo['salePropNum'] > 0) { $currentCombo = $comboInfo; $comboPropNum = $currentCombo['salePropNum']; if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { $comboPropNum = $currentCombo['rentPropNum'] + $currentCombo['salePropNum']; } break; } } $hasCombo = 0; //没有二手房套餐 if (!isset($currentCombo)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => 0, 'hasCombo' => $hasCombo)); } else { $hasCombo = 1; } $cityId = $brokerInfo->cityId; //获取套餐推广信息 $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); if (Bll_Combo_Broker_BrokerComboInfo::isOpenUp($currentCombo)) { $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCount($brokerId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK, true); } else { $currentSpreadHouseCount = Bll_Combo_HouseRelation::getHouseCountEx($brokerId, $cityId, Bll_Combo_Broker_BrokerComboInfo::SITE_TYPE_AJK); } //套餐还可以推的房源数量 $surplus = $comboPropNum - $currentSpreadHouseCount; if (empty($comboSpreadHouseList)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => array(), 'oldList' => array(), 'surplus' => $surplus, 'hasCombo' => $hasCombo)); } //获取房源信息 $propIds = array_keys($comboSpreadHouseList); $propsInfo = Bll_House_EsfHouse::getHouseBaseInfo($propIds, $cityId); //批量获取默认图片 $propDefImages = Model_House_AjkPropertyData::getDafImages($propIds); //批量获取房源总点 $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propIds); $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propIds, $cityId); //房源竞价&精选计划 $propSpreadInfo = Model_Plan_EsfAjkPropSpread::getPlanByPropIds($propIds); //拼接房源列表中房源数据 $newList = array(); $oldList = array(); foreach ($propsInfo as $prop) { $row = array(); $row['propId'] = $prop->proId; $row['title'] = $prop->proName; $row['commId'] = $prop->commId; $row['commName'] = $prop->commName; $row['roomNum'] = $prop->roomNum; $row['hallNum'] = $prop->hallNum; $row['area'] = round($prop->areaNum); $row['toiletNum'] = $prop->toiletNum; $row['price'] = intval($prop->proPrice); $row['priceUnit'] = '万'; $row['isBid'] = 0; $row['isChoice'] = 0; $row['isMoreImg'] = $prop->isHighQulity; $row['isPhonePub'] = $prop->uriCode == 'mobile.asyn' || $prop->uriCode == 'mobile-ajk-broker.asyn' ? 1 : 0; $row['isVisible'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1; //0-违规房源 1-非违规房源 $row['createTime'] = $prop->postDate; //房源发布时间 $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$prop->proId]); if ($prop->commitionType == 2) { $row['isEntrust'] = 1; } else { $row['isEntrust'] = 0; } $row['totalClicks'] = $houseTodayClickInfo[$prop->proId] + $houseClickInfo[$prop->proId]; if (isset($propSpreadInfo[$prop->proId])) { if ($propSpreadInfo[$prop->proId]->bidVersion == 1 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) { $row['isBid'] = 1; } elseif ($propSpreadInfo[$prop->proId]->bidVersion == 2 && ($propSpreadInfo[$prop->proId]->status == 1 || $propSpreadInfo[$prop->proId]->status == 11)) { $row['isChoice'] = 1; } } //计算出房源发布天数 $timeFixStr = strtotime(date("Ymd", $row['createTime'])); $leftDay = floor((time() - $timeFixStr) / 86400); if ($leftDay >= 30) { $oldList[] = $row; } else { $newList[] = $row; } } // 排序 usort($oldList, function ($a, $b) { if ($a['createTime'] == $b['createTime']) { return 0; } return $a['createTime'] > $b['createTime'] ? -1 : 1; }); usort($newList, function ($a, $b) { if ($a['createTime'] == $b['createTime']) { return 0; } return $a['createTime'] > $b['createTime'] ? -1 : 1; }); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('newList' => $newList, 'oldList' => $oldList, 'surplus' => $surplus > 0 ? $surplus : 0, 'hasCombo' => $hasCombo)); }
public function handlePost() { $this->request = APF::get_instance()->get_request(); $brokerId = $this->request->getBrokerId(); $cityId = $this->request->getBrokerCityId(); $params = $this->request->get_parameters(); $params['broker_id'] = $brokerId; $result = array(); try { if ($this->action == 'edit') { $houseInfo = Bll_House_EsfEdit::getHouseBaseInfo($this->houseId); /** 违规房源不可以编辑 */ if (isset($houseInfo['isIllegal']) && $houseInfo['isIllegal']) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', 'edit', $this->houseId, '已违规房源不可编辑'); } $result = Bll_House_EsfEdit::saveHouseInfo($brokerId, $cityId, $this->houseId, $params); } if ($this->action == 'publish') { $result = Bll_House_EsfPublish::saveHouseInfo($brokerId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } /** 委托房源发布 */ if ($this->action == 'commission') { $result = Bll_House_EsfCommission::saveHouseInfo($brokerId, $cityId, $this->commissionId, $params, $this->isComboBroker); if ($result['status'] == 'ok') { $this->houseId = $result['houseId']; } } if ($result['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $result['info']); } } catch (Exception $e) { $params['brokerId'] = self::$intBrokerID; APF::get_instance()->get_nlogger()->log(__CLASS__, $params); $this->redirect2Result(Const_PublishCode::PUBLISH_PROP_ERROR, 'ajk', $this->action, $this->houseId, $e->getMessage()); } /** 立即推广 */ if (isset($params['broker_action']) && $params['broker_action'] == 'publish') { /** 套餐推广 */ if ($this->isComboBroker) { $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($brokerId, $cityId, array($this->houseId), Bll_Combo_HouseRelation::SITE_TYPE_AJK); if ($spreadResult['status'] != 1) { switch ($spreadResult['status']) { /** 没有套餐 */ case -1: case -2: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_NO_COMBO, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 套餐未生效 */ /** 套餐未生效 */ case -3: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_ACTIVE, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; /** 推广房源数已满 */ /** 推广房源数已满 */ case -4: case -5: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_LIMIT, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); break; default: $this->redirect2Result(Const_PublishCode::SPREAD_PROP_COMBO_FAIL, 'ajk', $this->action, $this->houseId, $spreadResult['msg']); } } } else { /** 定价推广 */ if ($this->action == 'edit') { /** 定价推广失败 房源已经推广 */ if (BLL_Plan_EsfPropFixedPlanRelation::isHouseOnline($cityId, $this->houseId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_PLAN_IN, 'ajk', $this->action, $this->houseId, '房源已经推广'); } } $fixPlanList = BLL_Plan_EsfPropFixedPlanRelation::getBrokerValidPlan($brokerId); if (empty($fixPlanList)) { $this->redirect2Result(Const_PublishCode::UNKNOWN_ERROR, 'ajk', $this->action, $this->houseId, '获取定价计划信息失败'); } $fixPlan = $fixPlanList[0]; /** 定价推广失败 已经超出推广房源上限 */ if (!Bll_Broker_HzBroker::ajkPpcBrokerCanSpreadHouse($cityId, $brokerId)) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_OUT_LIMIT, 'ajk', $this->action, $this->houseId, '已经超出推广房源上限'); } $spreadResult = Bll_Ppc_ServiceAPI::fixPlanAddHouse($brokerId, $this->houseId, $fixPlan['id'], '23532'); if (isset($spreadResult['status'])) { if ($spreadResult['status'] != 'ok') { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, $spreadResult['info']); } } else { $this->redirect2Result(Const_PublishCode::API_ERROR, 'ajk', $this->action, $this->houseId, '系统繁忙(推广房源超时)'); } /** 定价推广失败 计划已经手动停止 */ if ($fixPlan['viewTime'] == 1861891200) { /** 定价推广失败 认证未通过 */ $brokerCheckState = Bll_Broker_BrokerCheckInfo::getCheckStateByBrokerId($brokerId); if ($brokerCheckState != 1) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_AUDITED_ERROR, 'ajk', $this->action, $this->houseId, '认证未通过'); } $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, 'ajk', $this->action, $this->houseId, '计划已经手动停止'); } /** 定价推广失败 账户余额不足,充值后自动推广 */ if ($fixPlan['viewTime'] == 1893427200) { $this->redirect2Result(Const_PublishCode::SPREAD_PROP_BALANCE_ERROR, 'ajk', $this->action, $this->houseId, '账户余额不足,充值后自动推广'); } } /** 推广成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SPREAD_SUCCESS, 'ajk', $this->action, $this->houseId); } /** 发布成功 */ $this->redirect2Result(Const_PublishCode::HOUSE_SAVE_SUCCESS, 'ajk', $this->action, $this->houseId); }
/** * 房源发布 * * @param int $brokerId * @param $params * @throws * * @return int */ public static function publishHouse($brokerId, $params) { if (!is_array($params) || empty($params)) { throw new Exception('发布房源,房源信息不能为空'); } $params['broker_id'] = $brokerId; if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $result = Bll_Service_House::esfAddHouseCombo($params); } elseif (Bll_Broker_HzBroker::isPpcBroker($brokerId)) { $result = Bll_Service_House::esfAddHousePPC($params); } else { throw new Exception('经纪人不是新套餐或PPC经纪人'); } if ($result['status'] == 'ok') { return $result['action']['proid']; } return 0; }
/** * 租房精选房源取消推广 * 1. 维护计划状态 * 2. 通知solr上下 */ public static function choicePropOutBid($broker_id, $proid) { $flag_array = array('status' => 0, 'msg' => ''); //获取精选 房源、计划关系表信息(promotion_prop_planning) $planning = Dao_Broker_HzPlan::get_prop_all_planning($proid, Const_HzPlan::BID_TYPE); if (empty($planning)) { $flag_array['msg'] = Const_HzErrorInfo::PROPFIXNULL; return $flag_array; } //根据计划查询精选计划的信息 $plan_info = Dao_Broker_HzPlan::get_plan($planning[0]['plan_id']); if (empty($plan_info)) { $flag_array['msg'] = Const_HzErrorInfo::NULLPLAN; return $flag_array; } //判断计划是否为该经纪人的 if ($plan_info['user_id'] != $broker_id) { $flag_array['msg'] = Const_HzErrorInfo::PLANINFOERROR; return $flag_array; } //获取精选计划的冻结号 $sn = Dao_Broker_HzPlan::get_bid_sn($plan_info['id']); $sn = $sn['sn']; if (empty($sn)) { $flag_array['msg'] = Const_HzErrorInfo::PROPERROR; return $flag_array; } //获取精选花费 // $amount = $plan_info['total_consume']; $amount = $plan_info['amount'] - $plan_info['total_consume']; $note = urlencode('推广房源' . $proid); $user_id = Bll_HzBroker::get_userid_by_hzbrokerid($broker_id); /** 精选结算 调用3次 */ $charge_sn = false; $unfreezeOrderData = array('userId' => $user_id, 'proId' => $proid, 'serialNumber' => $sn, 'planId' => $plan_info['id'], 'amount' => $amount); $unfreezeOrder = Bll_Ppc_BidUnfreeze::createHzOrder($unfreezeOrderData); for ($i = 0; $i < 3 && !$charge_sn; $i++) { $charge_sn = Bll_PayAccount::cancel_frozen($user_id, $amount, $proid, Const_PaymentApp::HZ_CHOICE, $sn, $note, true); } if (!$charge_sn) { $unfreezeOrder->fail(); $flag_array['msg'] = Const_HzErrorInfo::CHARGEFAIL; // 此处不需要block,由job保证此处解冻正确 //return $flag_array; } else { $unfreezeOrder->complete(); } //查询房源信息 $proInfo = Model_House_HzProp::get_prop_info_by_prop_id($proid); //房源违规的、删除的不能更新房源状态 $prop_status = $proInfo['contentBasic']['status']; // 兼容新套餐 $ajkBrokerId = Model_Broker_HzMapping::get_ajk_broker_id($broker_id); if (Bll_Broker_HzBroker::isComboBroker($ajkBrokerId)) { /** 判断房源是否在套餐推广中 */ if (!Bll_Combo_HouseRelation::getOnlineRelationByHouseId($proid, Bll_Combo_HouseRelation::SITE_TYPE_HZ)) { $prop_status = Const_HzStatus::OUTLINE; } } else { //查询房源是否在计划里面 $fix_planning = Dao_Broker_HzPlan::get_prop_planning($proid, Const_HzPlan::SPREAD_TYPE); if (!in_array($proInfo['contentBasic']['status'], array(Const_HzStatus::VERIFY, Const_HzStatus::REMOVE, Const_HzStatus::EXPIRED))) { if (empty($fix_planning)) { //房源不在计划里面 $prop_status = Const_HzStatus::OUTLINE; //房源不在计划里面 } elseif ($fix_planning[0]['is_valid'] == Const_HzPlan::SPREAD) { $prop_status = Const_HzStatus::ONLINE; //定价正在推广 } elseif ($fix_planning[0]['is_valid'] == Const_HzPlan::UPPERLIMIT) { //定价非推广(没钱状态) $prop_status = Const_HzStatus::NOCASH; //房源没钱 } else { $prop_status = Const_HzStatus::MANUALLY; //房源状态更新为9手动停止 } } } //维护精选关联关系 if (!Dao_Broker_HzPlan::update_planning($planning[0]['id'], Const_HzPlan::MENUOVER)) { $flag_array['msg'] = Const_HzErrorInfo::UPDATAPLANNINGFAIL; return $flag_array; } //维护计划状态 if (!Dao_Broker_HzPlan::update_plan_status($plan_info['id'], Const_HzPlan::MENUOVER)) { $flag_array['msg'] = Const_HzErrorInfo::UPDATAPLANFAIL; return $flag_array; } //通知solr if ($prop_status == Const_HzStatus::ONLINE) { //定价正在推广 Dao_Broker_HzProp::into_prop_lucene($proid, $planning[0]['city_id'], 1); //竞价下,定价还在线。则更新上 } else { Dao_Broker_HzProp::into_prop_lucene($proid, $planning[0]['city_id'], 2); //下线房源 } $flag_array['status'] = 1; return $flag_array; }
/** * 获取经纪人列表 * * @param array $cityIds * @param int $startId * @return array */ private function getBrokerList($cityIds, $startId) { return Bll_Broker_HzBroker::getBrokerListByCityId($cityIds, $startId, self::BROKER_LIMIT, array('brokerId', 'cityId')); }
public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect_to_login(); } /** * @var $request AJKRequest */ $request = APF::get_instance()->get_request(); $response = APF::get_instance()->get_response(); $params = $this->getParameters(); $routeMatches = $request->get_router_matches(); $business = $routeMatches[1]; $cityId = $request->getBrokerCityId(); /** 判断是否是精选开放城市 */ $siteType = $business == 'ajk' ? Const_Site::ANJUKE : ($business == 'hz' ? Const_Site::HAOZU : Const_Site::JINPU); if (!Bll_City::isChoiceIndependentCity($cityId, $siteType)) { $this->redirect('/ajkbroker/combo/broker/manage/' . $business . '/?from=V2'); } $brokerId = $request->getBrokerId(); $response->set_content_type('text/html', 'utf-8'); if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { if ($business == 'jp') { $this->redirect('/jinpu/house/managementv3'); } else { $this->redirect('/ajkbroker/user/manage/proplist/' . $business . '/'); } } /** * 三网统一Controller入口,但是业务实现层使用各自的。 */ $businessCallback = array('ajk' => array('Bll_Broker_Combo_ManageAjk', 'getComboInfo'), 'hz' => array('Bll_Broker_Combo_ManageHz', 'getComboInfo'), 'jp' => array('Bll_Broker_Combo_ManageJp', 'getComboInfo')); if (!isset($businessCallback[$business])) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '地址错误')))); } /** * 调用三网业务回调函数 * @link http://php.net/manual/zh/function.call-user-func.php */ $pageParams = call_user_func($businessCallback[$business], $this, $request, $response); //echo "<pre>";print_r($pageParams);exit; if (false === $pageParams) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '系统繁忙')))); } $this->setAttributes($pageParams); $this->setAttribute('pageType', $business); $this->setAttribute('business', $business); $this->setAttribute('broker', self::$BrokerInfo); /** * 添加委托房源信息栏 * add by xiongjianxu */ $areaCode = $this->getBrokerAreaCode(self::$BrokerInfo['BaseInfo']); $this->getCommissionInfo($brokerId, $cityId, $areaCode, 1); //echo '<!--- ', PHP_EOL, print_r($pageParams, true), PHP_EOL, ' --->'; //获取一元精选的配置 $isUnitaryChoice = Bll_Stats_DaUploadUnitarySiteCommPriceDaily::getUnitaryChoiceConfig($cityId); $this->setAttribute('isUnitaryChoice', $isUnitaryChoice); //判断房源季活动是否开始 $activityStatus = Bll_City_BizType::isOnActivity($cityId, 4, Const_CityBizType::TYPE_ACTIVITY_RES); $this->setAttribute('activityStatus', $activityStatus); if ($business == 'ajk') { return 'Combo_Broker_HouseManageAjkV2'; } else { return 'Combo_Broker_HouseManageV2'; } }
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); } if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } //获取套餐推广信息 $cityId = $brokerInfo->cityId; $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); $comboSpreadHouseIds = array_keys($comboSpreadHouseList); //获取精选推广信息 $bll = new BLL_Choice_EsfAPPAPIChoice(); $choiceHouseList = $bll->getBrokerPropChoiceInfo($brokerId); $choiceHouseIds = array(); foreach ($choiceHouseList as $list) { foreach ($list as $v) { $choiceHouseIds[] = $v['propId']; } } //获取经纪人所有房源信息 $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId); if (empty($tempHouseInfoList)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array())); } //未推广房源列表 $tempNoSpreadHouseList = array(); $noSpreadHouseIds = array(); foreach ($tempHouseInfoList as $houseInfo) { if (!in_array($houseInfo['proId'], $comboSpreadHouseIds) && !in_array($houseInfo['proId'], $choiceHouseIds)) { $houseInfo['illegal'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1; //0-违规房源 1-非违规房源 $tempNoSpreadHouseList[$houseInfo['proId']] = $houseInfo; $noSpreadHouseIds[] = $houseInfo['proId']; } } // 获取城市价格段信息 $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE); /** 过滤违规房源 */ $tmpIllegalList = array(); if (!$noSpreadHouseIds) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array())); } foreach ($tempNoSpreadHouseList as $propId => $houseInfo) { if ($houseInfo['illegal'] == 0 && $houseInfo['expireWorker'] != 'propertyReport') { $tmpIllegalList[$propId] = $houseInfo; unset($tempNoSpreadHouseList[$propId]); } } //是否是精选城市,是否精选分离 $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::ANJUKE); $cityIsChoiceIndependent = Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE); //违规房源排在前面 $noSpreadHouseList = array_merge($tmpIllegalList, $tempNoSpreadHouseList); $propDefImages = Model_House_AjkPropertyData::getDafImages($noSpreadHouseIds); $propertyList = array(); foreach ($noSpreadHouseList as $houseInfo) { $row = array(); $row['propId'] = $houseInfo['proId']; $row['title'] = $houseInfo['proName']; $row['commId'] = $houseInfo['commId']; $row['commName'] = $houseInfo['commName']; $row['roomNum'] = $houseInfo['roomNum']; $row['hallNum'] = $houseInfo['hallNum']; $row['area'] = round($houseInfo['areaNum']); $row['toiletNum'] = $houseInfo['toiletNum']; $row['price'] = intval($houseInfo['proPrice']); $row['priceUnit'] = '万'; $row['isBid'] = 0; $row['isChoice'] = 0; $row['isMoreImg'] = $houseInfo['isHighQulity']; $row['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $row['isVisible'] = $houseInfo['illegal']; //0-违规房源 1-非违规房源 $row['createTime'] = $houseInfo['postDate']; //房源发布时间 $row['imgUrl'] = $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$houseInfo['proId']]); if ($houseInfo['commitionType'] == 2) { $row['isEntrust'] = 1; } else { $row['isEntrust'] = 0; } //精选状态: 可精选;可排队;精选中;排队中 $choiceStatusRecommend = Bll_House_EsfHouse::getEsfChoiceStatusAndRecommend($priceSegmentList, array(), $houseInfo, $cityIsChoice, $cityIsChoiceIndependent); $row['choiceStatus'] = $choiceStatusRecommend['choiceStatus']; $row['choiceStatusName'] = $choiceStatusRecommend['choiceStatusName']; $row['choiceRecommend'] = $choiceStatusRecommend['choiceRecommend']; $propertyList[] = $row; } //排序 usort($propertyList, function ($a, $b) { if ($a['createTime'] == $b['createTime']) { return 0; } return $a['createTime'] > $b['createTime'] ? -1 : 1; }); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList)); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $cityId = $this->_params['cityId']; $props = Bll_BrokerInfoApp::get_outline_prop($brokerId, $cityId); $return = array(); $return['status'] = 'ok'; $return['data']['propertyList'] = array(); //APP套餐城市调错API了 需要做一下套餐城市的兼容处理 $isComboBroker = Bll_Broker_HzBroker::isComboBroker($brokerId); if (!$isComboBroker) { if (!empty($props)) { $propRow = array(); foreach ($props as $propertyList) { $propRow['propId'] = $propRow['id'] = $propertyList['ProId']; $propRow['title'] = $propertyList['ProName']; $propRow['commId'] = $propertyList['CommId']; $propRow['commName'] = $propertyList['CommName']; $propRow['roomNum'] = $propertyList['RoomNum']; $propRow['hallNum'] = $propertyList['HallNum']; $propRow['toiletNum'] = $propertyList['ToiletNum']; $propRow['area'] = round($propertyList['AreaNum']); $propRow['price'] = is_float($propertyList['ProPrice']) ? round($propertyList['ProPrice'], 1) : $propertyList['ProPrice']; $propRow['priceUnit'] = '万'; $propRow['isMoreImg'] = $propertyList['IsHighQulity']; $propRow['isVisible'] = $propertyList['IsVisible']; $propRow['isPhonePub'] = $propertyList['UriCode'] == 'mobile.asyn' || $propertyList['UriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $propRow['createTime'] = date('Y-m-d H:i:s', $propertyList['PostDate']); $imgBll = Bll_Image_EsfHouseImage::getInstance(); $propRow['imgUrl'] = $imgBll->getThumbImageUrl($propertyList['ProId'], $propertyList['commId']); //增加委托房源标签 if ($propertyList['CommitionType'] == 2) { $propRow['isEntrust'] = 1; } else { $propRow['isEntrust'] = 0; } $return['data']['propertyList'][] = $propRow; unset($propRow); } } return $return; } else { $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //获取套餐推广信息 $cityId = $brokerInfo->cityId; $comboSpreadHouseList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); $comboSpreadHouseIds = array_keys($comboSpreadHouseList); //获取经纪人所有房源信息 $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId); if (empty($tempHouseInfoList)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array())); } //未推广房源列表 $tempNoSpreadHouseList = array(); $noSpreadHouseIds = array(); foreach ($tempHouseInfoList as $houseInfo) { if (!in_array($houseInfo['proId'], $comboSpreadHouseIds)) { $houseInfo['illegal'] = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1; //0-违规房源 1-非违规房源 $tempNoSpreadHouseList[$houseInfo['proId']] = $houseInfo; $noSpreadHouseIds[] = $houseInfo['proId']; } } /** 过滤违规房源 */ $tmpIllegalList = array(); if (!$noSpreadHouseIds) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => array())); } foreach ($tempNoSpreadHouseList as $propId => $houseInfo) { if ($houseInfo['illegal'] == 0 && $houseInfo['expireWorker'] != 'propertyReport') { $tmpIllegalList[$propId] = $houseInfo; unset($tempNoSpreadHouseList[$propId]); } } //违规房源排在前面 $noSpreadHouseList = array_merge($tmpIllegalList, $tempNoSpreadHouseList); $propDefImages = Model_House_AjkPropertyData::getDafImages($noSpreadHouseIds); $propertyList = array(); foreach ($noSpreadHouseList as $houseInfo) { $row = array(); $row['propId'] = $houseInfo['proId']; $row['title'] = $houseInfo['proName']; $row['commId'] = $houseInfo['commId']; $row['commName'] = $houseInfo['commName']; $row['roomNum'] = $houseInfo['roomNum']; $row['hallNum'] = $houseInfo['hallNum']; $row['area'] = round($houseInfo['areaNum']); $row['toiletNum'] = $houseInfo['toiletNum']; $row['price'] = intval($houseInfo['proPrice']); $row['priceUnit'] = '万'; $row['isBid'] = 0; $row['isChoice'] = 0; $row['isMoreImg'] = $houseInfo['isHighQulity']; $row['isPhonePub'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $row['isVisible'] = $houseInfo['illegal']; //0-违规房源 1-非违规房源 $row['createTime'] = $houseInfo['postDate']; //房源发布时间 $row['imgUrl'] = $row['imgUrl'] = Model_House_AjkPropertyData::imageUrl($propDefImages[$houseInfo['proId']]); //print_r($houseInfo['commitionType']);exit; $row['isEntrust'] = $houseInfo['commitionType'] == 2 ? 1 : 0; $propertyList[] = $row; } //排序 usort($propertyList, function ($a, $b) { if ($a['createTime'] == $b['createTime']) { return 0; } return $a['createTime'] > $b['createTime'] ? -1 : 1; }); return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList)); } }
/** * @param House_PropviewController $controller * @param AJKRequest $request * @param AJKResponse $response * * @return array */ public static function handlerPropViewRequest($controller, $request, $response) { $routeMatches = $request->get_router_matches(); $houseId = $routeMatches[2]; $cityId = $request->getBrokerCityId(); $brokerId = $request->getBrokerId(); $pageParams = array('houseId' => $houseId); $houseInfo = Bll_House_EsfHouse::getHouseBaseInfoEx($houseId, $cityId); /** 不是当前经纪人的房源则返回到房源管理页去 */ if (empty($houseInfo) || $houseInfo['brokerId'] != $brokerId) { $response->redirect('/ajkbroker/user/manage/proplist/ajk/'); } $pageParams['title'] = $houseInfo['proName']; $houseInfo['mobile'] = $houseInfo['uriCode'] == 'mobile.asyn' || $houseInfo['uriCode'] == 'mobile-ajk-broker.asyn' ? 1 : 0; $pageParams['info'] = sprintf('%s %d平米,%d室%d厅%d卫,%d/%d层,%.2f万 (房源ID:%d)', $houseInfo['commName'], $houseInfo['areaNum'], $houseInfo['roomNum'], $houseInfo['hallNum'], $houseInfo['toiletNum'], $houseInfo['proFloor'], $houseInfo['floorNum'], $houseInfo['proPrice'], $houseId); $currentDate = strtotime(date('Y-m-d 00:00:00')); $postDate = strtotime(date('Y-m-d 00:00:00', $houseInfo['postDate'])); $pageParams['leftDay'] = max(0, 90 - floor(($currentDate - $postDate) / 86400)); $pageParams['houseInfo'] = $houseInfo; $pageParams['viewLink'] = Util_Url::ajkHouseDetailUrl($houseId, $cityId); $pageParams['editURL'] = Bll_Ppc_LinkManager::getSaleEditUrl($houseId); $houseAdShow = Model_House_AdPropShowSale::getHouseAdSale($brokerId, $houseInfo['proId']); $pageParams['AdShow'] = empty($houseAdShow) ? false : true; $pageParams['isIllegal'] = $houseInfo['isVisible'] == 0 && $houseInfo['expireWorker'] != 'propertyReport'; // TODO 获取小区在线房源和排名 需要重构 $pageParams['communitySaleCount'] = Model_Community_AjkSaleRentCount::getCommunitySaleNum($houseInfo['commId']); $isBidCity = Bll_City::isBidCity($cityId); if ($isBidCity) { $pageParams['bidTip'] = '竞价'; } $isChoiceCity = Bll_City::isChoiceCity($cityId); /** 精选城市 */ if ($isChoiceCity) { $pageParams['bidTip'] = '精选'; } $pageParams['isChoiceCity'] = $isChoiceCity; $pageParams['isBidCity'] = $isBidCity; $houseRank = Bll_Broker_Manage_AjkPropList::getHouseSollyResult(array($houseId)); if (isset($houseRank[$houseId])) { $pageParams['houseRank'] = $houseRank[$houseId]; } else { $pageParams['houseRank'] = '待评'; } $houseSpreadDate = array(); for ($interval = -6; $interval <= 0; $interval++) { $houseSpreadDate[] = date('m.d', strtotime("{$interval} day")); } $pageParams['houseSpreadDate'] = $houseSpreadDate; $fixPlanId = Bll_Plan_Fix_AjkPlan::getPlanIdByHouseId($brokerId, $houseId, $cityId); $startDate = date('Ymd', strtotime('-6 day')); $endDate = date('Ymd'); $houseFixDailyCostList = array(); for ($i = -6; $i <= 0; $i++) { $date = date('m.d', strtotime("{$i} day")); $houseFixDailyCostList[$date] = 0; } /** 获取房源指定日期内每天的定价点击 */ if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $pageParams['houseFixSpreadClickInfoList'] = static::getHouseComboSpreadClickInfo($houseId); } else { $pageParams['houseFixSpreadClickInfoList'] = static::getHouseFixSpreadClickInfoEx($brokerId, $houseId); /** 获取房源指定日期内每天的定价花费 */ $pageParams['houseFixDailyCostList'] = array_merge($houseFixDailyCostList, static::getHouseFixDailyCost($brokerId, $fixPlanId, $houseId, $startDate, $endDate)); } if ($isChoiceCity || $isBidCity) { $houseBidSpreadInfo = static::getHouseBidSpreadInfo($houseId, $cityId); $pageParams['houseBidSpreadInfo'] = $houseBidSpreadInfo; } // $pageParams['houseDetail'] = Bll_Ppc_ServiceAPI::getHouseInfo($houseId); $houseImageInfo = Bll_Ppc_ServiceAPI::getHouseImageInfo($houseId); $pageParams['optimize'] = static::getHouseOptimizeInfo($houseId, $houseImageInfo, $houseInfo, $cityId); $pageParams['imageCount'] = count($houseImageInfo['imageBaseInfo']); if (count($houseImageInfo['imageBaseInfo']) <= 0) { $pageParams['houseDefaultImage'] = 'http://pages.anjukestatic.com/img/global/nopic_150x113.gif'; } else { $pageParams['houseDefaultImage'] = static::getThumbImageUrl($houseId, $houseImageInfo['imageBaseInfo']); } $pageParams['houseStatisticsInfo'] = static::getHouseStatisticsInfo($houseId, $cityId, $houseInfo['commId'], $houseInfo['proPriceInt']); //市场分析,小区价格段供需比。获取前天的数据 $pageParams['demandSupplyPriceInfo'] = static::getDemandSupplyByPriceInfo($houseInfo['commId']); //市场分析,小区户型供需比。获取前天数据 $pageParams['demandSupplyRoomInfo'] = static::getCommTotalRoomInfo($houseInfo['commId']); $pageParams['subRegionRank'] = static::getCommunityRank($houseInfo['areaCode'], $houseInfo['commId']); return $pageParams; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propId = $this->_params['propId']; //好丑陋。。。。。。好无奈。。。。。。 //委托房源自动转发停用,为了app能够展示报错信息。。。 if (empty($propId)) { $this->_params['apiDebug'] = 1; return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => '0000', 'message' => '委托房源自动转发功能已停用;若要发布请手动发布'); } $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } if (!Bll_Broker_HzBroker::isComboBroker($brokerId)) { throw new Exception_ISNotComboBrokerException('不是套餐经纪人。'); } $cityId = $brokerInfo->cityId; /** 套餐信息 */ $comboInfoList = Bll_Combo_Broker_BrokerComboInfo::getBrokerComboList($brokerId); $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; } } //没有二手房套餐 if (!isset($currentCombo)) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 0, 'statusMsg' => '尚未购买套餐,请购买套餐', 'currentComboInfo' => '尚未购买套餐')); } $currentComboName = $currentCombo['name']; $currentComboUsed = 0; $currentComboTotal = $currentCombo['salePropNum'] + $currentCombo['rentPropNum']; //二手房套餐列表 $comboEsfList = Bll_Broker_Combo_ManageAjk::getComboSpreadHouseList($brokerId, $cityId); $comboEsfPropIds = array_keys($comboEsfList); //租房套餐列表 $comboZuFangList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, 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 : (!$currentCombo['openUp'] && !$currentCombo['salePropNum'] ? 0 : 1); if (in_array($propId, array_merge($comboEsfPropIds, $comboZuFangPropIds))) { $status = 2; $statusMsg = '套餐推广中'; } else { $status = 1; $statusMsg = '好房源,不推广就浪费了~'; } //房源今日点击 房源总点击 $houseTodayClickInfo = Bll_House_EsfHouse::getHouseTodayComboClick($propId); $todayClicks = $houseTodayClickInfo[$propId]; //房源总点击 $houseClickInfo = Bll_House_EsfHouse::getComboHouseAccumulateClickByPropIds($brokerId, $propId, $cityId); $totalClicks = $todayClicks + $houseClickInfo[$propId]; $currentComboInfo = isset($currentCombo) ? $currentComboName . " ({$currentComboUsed}/{$currentComboTotal})" : '尚未购买套餐'; return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'totalClicks' => $totalClicks, 'status' => $status, 'statusMsg' => $statusMsg, 'canSpread' => $canSpread, 'currentComboInfo' => $currentComboInfo)); }
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)); } }
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']); } } }
public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect_to_login(); } /** * @var $request AJKRequest */ $request = APF::get_instance()->get_request(); /** * @var $response AJKResponse */ $response = APF::get_instance()->get_response(); $params = $this->getParameters(); $routeMatches = $request->get_router_matches(); $business = $routeMatches[1]; $cityId = $request->getBrokerCityId(); //增加个人房源审核城市 if (in_array($cityId, array(11))) { $this->setAttribute('propCheck', 0); } else { $this->setAttribute('pageType', 1); } $brokerId = $request->getBrokerId(); $response->set_content_type('text/html', 'utf-8'); if (Bll_Broker_HzBroker::isComboBroker($brokerId)) { $this->redirect('/ajkbroker/combo/broker/manage/' . $business . '/'); } /** * 三网统一Controller入口,但是业务实现层使用各自的。 * @link http://php.net/manual/zh/language.types.callable.php */ $businessCallback = array('ajk' => array('Bll_Broker_Manage_AjkPropList', 'getBrokerSpreadInfo'), 'hz' => array('Bll_Broker_Manage_HzPropList', 'handlerPropListRequest'), 'jp' => array()); if (!isset($businessCallback[$business])) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '地址错误')))); } /** * 调用三网业务回调函数 * @link http://php.net/manual/zh/function.call-user-func.php */ $pageParams = call_user_func($businessCallback[$business], $this, $request, $response); if (false === $pageParams) { $this->redirect(sprintf('/ajkbroker/user/manage/proplist/ajk/?%s', http_build_query(array('err' => '系统繁忙')))); } $this->setAttributes($pageParams); $this->setAttribute('pageType', $business); $this->setAttribute('business', $business); $this->setAttribute('broker', self::$BrokerInfo); /** * 添加委托房源信息栏 * add by xiongjianxu */ $areaCode = $this->getBrokerAreaCode(self::$BrokerInfo['BaseInfo']); $this->getCommissionInfo($brokerId, $cityId, $areaCode, 1); //echo '<!--- ', PHP_EOL, print_r($pageParams, true), PHP_EOL, ' --->'; //获取一元精选的配置 $isUnitaryChoice = Bll_Stats_DaUploadUnitarySiteCommPriceDaily::getUnitaryChoiceConfig($cityId); $this->setAttribute('isUnitaryChoice', $isUnitaryChoice); if ($business == 'ajk') { return "Manage_ProplistAjk"; } else { return "Manage_Proplist"; } }