/** * @param $request object * @param $brokerInfo array * @param $type string rent || sale * @return array */ public static function getOfficeBeforePost($request, $brokerInfo, $type) { $out = $logGiveArr = array(); $params = $request->get_parameters(); // manager_id不为空,说明是伪登录 $out['managerId'] = $request->get_cookie('manager_id'); // 经纪人信息 $out['brokerInfo'] = $brokerInfo; $cityId = $brokerInfo['CITYID']; //金铺城市ID转换 $jpCityId = $out['brokerInfo']['jpCityId'] = BLL_House_JpHouseManage::getMemberCityId($cityId); $out['ajkBrokerId'] = $out['brokerInfo']['BROKERID']; $jpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($out['ajkBrokerId']); $out['brokerInfo']['jpMemberId'] = intval($jpMember->id); //获取城市配置信息是否是精选推广 $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId']); $out['bidTip'] = $out['isChoiceCity'] ? '精选' : '竞价'; //是否套餐经纪人 $out['isCombo'] = $brokerInfo['PAYTYPE'] == 9999 ? 1 : 0; //套餐城市是否显示推广按钮,以及提示 $out['spreadFlagInfo'] = array('spreadFlag' => 1, 'info' => ''); if ($out['isCombo']) { $comboCheck = Bll_Combo_HouseRelation::housePublishComboCheck($out['ajkBrokerId'], $cityId, Bll_Combo_HouseRelation::SITE_TYPE_JP); if ($comboCheck['status'] != 1) { $out['spreadFlagInfo'] = array('spreadFlag' => 0, 'info' => $comboCheck['msg']); } } // 获取全部图片分类信息(用于编辑时候默认展示分类情况) $arrCategory = array(); $arrAllCates = Model_Image_Category::get_img_cates_by_type('office'); $arrCategory['all'] = $arrAllCates; $arrCategory['classify'] = array_fill_keys(array_keys($arrAllCates), 0); $out['arrCategory'] = $arrCategory; // 描述引导 $out['descGuide'] = self::getOfficeDescGuideTitle($type); //编辑图片,用于展示退回照片模块 $out['editPic'] = isset($params['edit_pic']) ? $params['edit_pic'] : 0; //北上广深 四城市 $citySpecial = array('11', '12', '13', '14'); $out['priceType'] = in_array($jpCityId, $citySpecial) ? 1 : 0; $out['isPost'] = $request->is_post_method(); //楼租和楼售 所在楼层选择 $out['floor'] = Model_House_JpOfficeRent::getEnumFloor(); //---------是否编辑---------------// $officeInfo = array(); $officeId = 0; // 初始化参数 $matches = $request->get_router_matches(); if (isset($matches[2]) && !empty($matches[2])) { $officeId = intval($matches[2]); $officeInfo = $type == 'rent' ? Model_House_JpOfficeRent::getPropInfoById($officeId) : Model_House_JpOfficeSale::getPropInfoById($officeId); } $out['isEdit'] = empty($officeInfo) ? 0 : 1; //四选一弹层 $out['bolFlag'] = isset($out['isEdit']) && $out['isEdit'] == 1 || !isset($params['from']) ? 0 : 1; $out['officeInfo'] = $officeInfo; $out['officeInfo']['pageRent'] = !empty($officeInfo) && $type == 'rent' ? self::getJPMonthlyRent($officeInfo['dailyRent']) : 0; $out['officeId'] = $officeId; if (!$out['isCombo']) { $planInfo = BLL_House_JpHouseManage::getFixPlanInfo($officeId); if ($out['isEdit'] && $planInfo['success'] && $planInfo['data']['status'] == 3) { //定价计划状态为3,不可编辑 return array('status' => 'error', 'errCode' => Const_PublishCode::UNKNOWN_ERROR); } } //新发,需要验证房源发布套数限制 if (!$out['isEdit']) { if (BLL_House_JpHouseManage::houseNumLimit($out['brokerInfo']['jpMemberId'], $out['ajkBrokerId'], true)) { //保存漏斗日志 if ($out['isPost']) { $houseType = Bll_Loudou_Log::jinpuHouseType('office', $type); $str = ''; switch ($params['goto_next_step']) { case 'planCombo': case 'planFix': $str = Bll_Loudou_Log::RESULT_TYPE_FIX_FAILED_OTHERS; break; case 'justSaveHouse': $str = Bll_Loudou_Log::RESULT_TYPE_SAVE_FAILED_HOUSE_MAX_LIMIT; break; } $logGiveArr[] = array('func' => array('Bll_Loudou_log', 'add'), 'params' => array($houseType, $str, Bll_Loudou_Log::SOURCE_TYPE_FORM)); } return array('status' => 'error', 'errCode' => Const_PublishCode::PUBLISH_OUT_OF_LIMIT); } } //页面精品房源url $out['exquisiteUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1043'); //页面经典范例url $out['exampleTitleUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1044'); //页面房源描述下方经典范例url $out['exampleDescUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1045'); //房源发布协议url $out['contractUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('554'); //房源PPC价格段信息 $out['ppcInfo'] = Bll_Plan_JpPlanManage::getInstance()->getPPCPrice($jpCityId, $type == 'rent' ? 1 : 2); //经纪人定价推广组信息 $out['fixPlanInfo'] = $out['isCombo'] ? array() : Bll_Plan_JpPlanManage::getInstance()->getBrokerFixPlans($out['brokerInfo']['jpMemberId'], true); if ($out['isEdit']) { //编辑状态下的特殊信息 //编辑 验证房源是否属于经纪人 if ($out['brokerInfo']['jpMemberId'] != $out['officeInfo']['memberId']) { return array('status' => 'error', 'errCode' => Const_PublishCode::NOT_OWN_HOUSE); } //房源推广信息,被编辑的是否在推广中 $houseCanSpread = 1; if ($out['isCombo']) { $houseCombo = Model_Combo_HouseRelation::getOnlineHousebyHouseId($out['ajkBrokerId'], $officeId, $cityId, Model_Combo_HouseRelation::SITE_TYPE_JP); if (!empty($houseCombo)) { $houseCanSpread = 0; } } else { $officeIdx = Model_House_JpHouseIdx::data_access()->filter('id', $officeId)->get_row(); if (!empty($officeIdx['fixSpreadId'])) { $houseCanSpread = 0; } } $out['houseCanSpread'] = $houseCanSpread; //物业费是否被锁定 $out['property_company_lock'] = 0; if (isset($out['officeInfo']['buildingId'])) { $all_lock = BLL_House_JpProperty::getBuildingLockById($out['officeInfo']['buildingId']); if (isset($all_lock['property_company']) && $all_lock['property_company'] == 1) { $out['property_company_lock'] = 1; } } //图片退回信息 $out['backRows'] = array(); if ($officeId && $out['isEdit']) { $out['backRows'] = Bll_Image_JpHouseImage::getBackRows($officeId, $type == 'rent' ? 1 : 2); } //房源描述 $desc = $type == 'rent' ? Model_Jinpu_OfficeRentDesc::getByPk($officeId) : Model_Jinpu_OfficeSaleDesc::getByPk($officeId); $out['officeDesc'] = $desc['desc']; //房源物业信息 $DBuilding = BLL_House_JpHouseManage::getBuildingInfo($officeInfo['buildingId']); $out['hasLibrary'] = BLL_House_JpProperty::hasLibrary($out['brokerInfo']['jpMemberId'], $officeInfo['buildingId'], 'building'); $out['building'] = $DBuilding; //房源图片查询和排序 $images = self::handleOfficeImages($officeId, $type); //个人图库图片是否被锁定 foreach ($images as $key => $imgVal) { $imgVal['isLock'] = 0; if ($imgVal && $imgVal['personalImgId']) { $personalImg = Model_Jinpu_PersonalGallery::getImgById($imgVal->personal_img_id); if ($personalImg && $personalImg->category) { $imgVal['isLock'] = 1; } } if ($imgVal['category'] && isset($out['arrCategory']['classify'][intval($imgVal['category'])])) { $out['arrCategory']['classify'][intval($imgVal['category'])] += 1; } $images[$key] = $imgVal; } $out['images'] = $images; } return array('status' => 'ok', 'info' => $out, 'logArr' => $logGiveArr); }
/** * @return bool * @throws Exception * 处理post请求 */ public function handlePost() { //房源发布数量上限 if (BLL_House_JpHouseManage::houseNumLimit($this->jpMemberId, $this->brokerId, true) && $this->act == 'publish') { $this->redirect2Result(Const_PublishCode::PUBLISH_OUT_OF_LIMIT, self::SITE_JP, $this->act); } $params = APF::get_instance()->get_request()->get_parameters(); $area = floatval($params['office_area']); $efficientRate = intval($params['office_efficient_rate']); $floorId = intval($params['office_floor']); $title = trim($params['office_title']); $desc = trim($params['ProDesc']); $officeManageFee = trim($params['office_manage_fee']) === '' ? 0.001 : round(floatval($params['office_manage_fee']), 1); $postOffice = array(); if (isset($this->officeId) && $this->act == 'edit') { //编辑 $OfficeData = Model_House_JpOfficeRent::data_access()->filter('id', $this->officeId)->get_row(); if (empty($OfficeData)) { $this->redirect2Result(Const_PublishCode::HOUSE_NOT_EXIST, self::SITE_JP, $this->act); } $postOffice['officeBuildingId'] = $OfficeData['buildingId']; } else { //新发 if ($params['communityId'] == null || intval($params['communityId']) == 0) { $this->redirect2Result(Const_PublishCode::HOUSE_PARAM_COMPLETE, self::SITE_JP, $this->act); } $postOffice['officeBuildingId'] = $params['communityId']; } $postOffice['brokerId'] = $this->brokerId; $postOffice['officeTitle'] = $title; $postOffice['officeArea'] = $area; $postOffice['floatLeft'] = $floorId; $postOffice['officeEfficientRate'] = $efficientRate; $postOffice['manageFee'] = $officeManageFee; $jpPublish = APF::get_instance()->get_config("jpPublishOfficeRentPrice", "jpPublish"); $jpPublishOfficeRentPrice = $jpPublish[$this->jpCityId]; if ($jpPublishOfficeRentPrice == 'priceA' || $jpPublishOfficeRentPrice == 'priceB') { $postOffice['price'] = trim($params['office_daily_rent']); } elseif ($jpPublishOfficeRentPrice == 'priceC') { $postOffice['price'] = trim($params['office_monthly_rent']); } else { $postOffice['price'] = trim($params['office_monthly_total_rent']); } /* if($this->jpCityId == 11 || $this->jpCityId == 14 || $this->jpCityId == 26) { $postOffice['price'] = trim($params['office_daily_rent']); } elseif ($this->jpCityId == 12 || $this->jpCityId == 13) { $postOffice['price'] = trim($params['office_monthly_rent']); } else { $postOffice['price'] = trim($params['office_monthly_total_rent']); } */ /* if($this->jpCityId == 11 || $this->jpCityId == 14 || $this->jpCityId == 26) { $postOffice['unitPrice'] = trim($params['office_daily_rent']); $postOffice['officePrice'] = $postOffice['unitPrice'] * $postOffice['officeArea'] * 30.42; } elseif ($this->jpCityId == 12 || $this->jpCityId == 13) { $postOffice['unitPrice'] = trim($params['office_monthly_rent']) / 30.42; $postOffice['officePrice'] = trim($params['office_monthly_rent']) * $postOffice['officeArea']; } else { $postOffice['officePrice'] = trim($params['office_monthly_total_rent']); $postOffice['unitPrice'] = $postOffice['officePrice'] / $postOffice['officeArea'] / 30.42; } */ $postOffice['officeDesc'] = $desc; $postOffice['type'] = 1; if ($this->act == 'edit') { list($postOffice['newOfficePics'], $postOffice['delOfficePics']) = BLL_House_JpHouseManage::revertEditImageArray($params['oldroom'], $params['selroom'], $params['dropDesc'], $params['newupdroom'], $params['defaultImgID'], $params['delRoom'], $params['delHandlePic']); } else { $postOffice['officePics'] = json_encode(BLL_House_JpHouseManage::revertPublishImageArray($params['selroom'], $params['dropDesc'], $params['newupdroom'], $params['defaultImgID'])); } //新发或者更新基础房源信息 if ($this->act == 'edit') { $postOffice['officeId'] = $this->officeId; $apiHouseInfo = BLL_House_JpHouseManage::housePublishApi('o_e', $postOffice); } else { $apiHouseInfo = BLL_House_JpHouseManage::housePublishApi('o_p', $postOffice); } if ($apiHouseInfo['status'] != 'ok') { $this->redirect2Result($apiHouseInfo['code'], self::SITE_JP, $this->act, '', $apiHouseInfo['info']); } else { $this->officeId = intval($apiHouseInfo['id']); } return true; }
/** * * 获取经纪人的违规房源数 * * @param $brokerId * @param $cityId * @param $siteType * @return int */ public static function getBrokerIllegalNum($brokerId, $cityId, $siteType) { $num = 0; switch ($siteType) { case 'ajk': $propList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $cityId); foreach ($propList as $prop) { if ($prop['isVisible'] != 1) { $num += 1; } } break; case 'hz': $brokerMapping = Bll_Broker_MainBusiness::getDataByEsfId($brokerId); //根据经纪人查询商铺相应 $propList = Model_House_HzPropSearch::getPropListByUserId($brokerMapping['hzBrokerid'], $cityId, array('status' => 6)); $num = count($propList); break; case 'jp': $brokerMapping = Bll_Broker_MainBusiness::getDataByEsfId($brokerId); //根据经纪人查询商铺相应 $baseInfo = Model_House_JpHouseIdx::data_access()->filter('memberId', $brokerMapping['jpBrokerid'])->filter('isDelete', Model_House_JpHouseIdx::ENUM_IS_DELETE_NO)->get_all(); if (!$baseInfo) { return $num; } $houseIds = array(); foreach ($baseInfo as $hInfo) { $houseIds[] = $hInfo['id']; } //获取房源的标签 $jpOfficeRent = Model_House_JpOfficeRent::getPropInfoByIds($houseIds); $jpOfficeSale = Model_House_JpOfficeSale::getPropInfoByIds($houseIds); $jpShopRent = Model_House_JpShopRent::getPropInfoByIds($houseIds); $jpShopSale = Model_House_JpShopSale::getPropInfoByIds($houseIds); $houseList = array_merge($jpOfficeRent, $jpOfficeSale, $jpShopRent, $jpShopSale); $num = 0; foreach ($houseList as $list) { if ($list['isIllegal'] == 1) { $num += 1; } } break; default: break; } return $num; }
public static function getHousesByBuildingId($buildingId, $type = 'office') { if ($type == 'office') { $house_count1 = Model_House_JpOfficeRent::data_access()->filter('buildingId', $buildingId)->filter('state', 1)->count(); $house_count2 = Model_House_JpOfficeSale::data_access()->filter('buildingId', $buildingId)->filter('state', 1)->count(); $house_count = intval($house_count1) + intval($house_count2); } else { if ($type == 'shop') { $house_count1 = Model_House_JpShopRent::data_access()->filter('propertyId', $buildingId)->filter('state', 1)->count(); $house_count2 = Model_House_JpShopSale::data_access()->filter('propertyId', $buildingId)->filter('state', 1)->count(); $house_count = intval($house_count1) + intval($house_count2); } else { if ($type == 'all') { $house_count1 = Model_House_JpOfficeRent::data_access()->filter('buildingId', $buildingId)->filter('state', 1)->count(); $house_count2 = Model_House_JpOfficeSale::data_access()->filter('buildingId', $buildingId)->filter('state', 1)->count(); $house_count3 = Model_House_JpShopRent::data_access()->filter('propertyId', $buildingId)->filter('state', 1)->count(); $house_count4 = Model_House_JpShopSale::data_access()->filter('propertyId', $buildingId)->filter('state', 1)->count(); $house_count = intval($house_count1) + intval($house_count2) + intval($house_count3) + intval($house_count4); } else { $house_count = 0; } } } return $house_count; }
/** * @param $id * @return array|mixed|null * @throws Exception */ public static function getPropInfoById($id) { $houseInfo = Model_House_JpOfficeRent::data_access()->filter('id', $id)->get_row(); return $houseInfo; }