/** * @param $request object * @param $brokerInfo array * @param $type string rent || sale * @return array */ public static function getShopBeforePost($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($jpCityId, Const_Site::JINPU); $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('shop'); $arrCategory['all'] = $arrAllCates; $arrCategory['classify'] = array_fill_keys(array_keys($arrAllCates), 0); $out['arrCategory'] = $arrCategory; // 描述引导 $out['descGuide'] = self::getShopDescGuideTitle($type); //编辑图片,用于展示退回照片模块 $out['editPic'] = $params['edit_pic']; //北上广深 四城市 $citySpecial = array('13', '14'); $out['priceType'] = in_array($jpCityId, $citySpecial) ? 1 : 0; $out['isPost'] = $request->is_post_method(); if ($type == 'rent') { //交租方式 $out['rentModeFirst'] = Model_House_JpShopRent::getRentModeFirst(); $out['rentModeSecond'] = Model_House_JpShopRent::getRentModeSecond(); } //---------是否编辑---------------// $shopInfo = array(); $shopId = 0; $propertyId = 0; // 初始化参数 $matches = $request->get_router_matches(); if (isset($matches[2]) && !empty($matches[2])) { $shopId = intval($matches[2]); $shopInfo = $type == 'rent' ? Model_House_JpShopRent::getPropInfoById($shopId) : Model_House_JpShopSale::getPropInfoById($shopId); $propertyId = $shopInfo['propertyId']; } $out['isEdit'] = empty($shopInfo) ? 0 : 1; //四选一弹层 $out['bolFlag'] = $out['isEdit'] || !isset($params['from']) ? 0 : 1; $out['shopInfo'] = $shopInfo; $out['shopId'] = $shopId; if (!$out['isCombo']) { $planInfo = BLL_House_JpHouseManage::getFixPlanInfo($shopId); 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('shop', $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); } } //经营信息模块的配置信息 list($out['enumShopType'], $out['enumShopMatching'], $out['enumShopIndustry'], $out['enumShopIndustryLimit'], $out['enumShopPassengerType']) = BLL_House_JpProperty::getShopEnum(); //页面精品房源url $out['exquisiteUrl'] = BLL_Plan_JpPlanUrl::buildHelpUrl('1026'); //页面经典范例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' ? 3 : 4); //城市区域列表,选择区域使用 $out['districts'] = Model_Jinpu_District::getCityDistricts($jpCityId); //经纪人定价推广组信息 $out['fixPlanInfo'] = $out['isCombo'] ? array() : Bll_Plan_JpPlanManage::getInstance()->getBrokerFixPlans($out['brokerInfo']['jpMemberId']); if ($out['isEdit']) { //编辑状态下的特殊信息 //编辑 验证房源是否属于经纪人 if ($out['brokerInfo']['jpMemberId'] != $out['shopInfo']['memberId']) { return array('status' => 'error', 'errCode' => Const_PublishCode::NOT_OWN_HOUSE); } //房源交租方式(付一押一) list($out['rentModelFirst'], $out['rentModelSecond']) = explode(',', $shopInfo['rentMode']); //单层 多层 独栋 $out['floorType'] = 1; if ($shopInfo['isFullFloor']) { $out['floorType'] = 3; } elseif ($shopInfo['upFloor']) { $out['floorType'] = 2; } //房源推广信息,被编辑的房源是否在推广中 $houseCanSpread = 1; if ($out['isCombo']) { $houseCombo = Model_Combo_HouseRelation::getOnlineHousebyHouseId($out['ajkBrokerId'], $shopId, $cityId, Model_Combo_HouseRelation::SITE_TYPE_JP); if (!empty($houseCombo)) { $houseCanSpread = 0; } } else { $shopIdx = Model_House_JpHouseIdx::data_access()->filter('id', $shopId)->get_row(); if (!empty($shopIdx['fixSpreadId'])) { $houseCanSpread = 0; } } $out['houseCanSpread'] = $houseCanSpread; //图片退回信息 $out['backRows'] = array(); if ($shopId && $out['isEdit']) { $out['backRows'] = Bll_Image_JpHouseImage::getBackRows($shopId, $type == 'rent' ? 3 : 4); } //房源描述 $desc = $type == 'rent' ? Model_Jinpu_ShopRentDesc::getByPk($shopId) : Model_Jinpu_ShopSaleDesc::getByPk($shopId); $out['shopDesc'] = $desc['desc']; //房源物业信息 $out['propertyData'] = $propertyData = (array) BLL_House_JpProperty::getProperty($shopInfo['propertyId']); if (!$propertyData) { return array('status' => 'error', 'errCode' => Const_PublishCode::NOT_OWN_HOUSE); } if ($propertyData['isRoad'] == 1 && ($shopInfo['districtId'] || !$shopInfo['blockId'])) { $out['forceBlockEdit'] = true; } elseif ($propertyData['isRoad'] == 0 && (!$propertyData['districtId'] || !$propertyData['blockId'])) { $out['forceBlockEdit'] = true; } if (!$out['forceBlockEdit']) { //逻辑好多啊 妹子的 $districtIdForSearch = !$propertyData['isRoad'] ? $propertyData['districtId'] : $shopInfo['districtId']; $blockIdForSearch = !$propertyData['isRoad'] ? $propertyData['blockId'] : $shopInfo['blockId']; $districtInfo = Model_Jinpu_District::data_access()->filter('id', $districtIdForSearch)->get_row(); $districtName = $districtInfo['is_actived'] == 1 ? $districtInfo['name'] : ''; $blockInfo = Model_Jinpu_Block::data_access()->filter('id', $blockIdForSearch)->get_row(); $blockName = $blockInfo['isActived'] == 1 ? $blockInfo['name'] : ''; $titleStr = $districtName . ' ' . $blockName . ' ' . (!$propertyData['isRoad'] ? $propertyData['address'] : '') . (!empty($shopInfo['closeRoad']) ? '靠近:' . $shopInfo['closeRoad'] : ''); $showStr = strlen($titleStr) > 90 ? Util_GlobalFunc::cutchar($titleStr, 28) : $titleStr; $out['titleStr'] = $titleStr; $out['showStr'] = $showStr; } $out['hasLibrary'] = BLL_House_JpProperty::hasLibrary($out['brokerInfo']['jpMemberId'], $shopInfo['propertyId'], 'property'); //房源图片查询和排序 $images = self::handleShopImages($shopId, $type); //个人图库图片是否被锁定 foreach ($images as $key => $imgVal) { $imgVal['isLock'] = 0; if ($imgVal && $imgVal['personalImgId']) { $personalImg = Model_Jinpu_PersonalGallery::getImgById($imgVal['personalImgId']); 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; } $lng = $lat = $mapDataFlag = 0; //地图标注商铺位置的逻辑 $DShopMap = Model_Jinpu_MapShop::getByPK($shopId); if (!empty($DShopMap)) { $lng = $DShopMap['lng']; $lat = $DShopMap['lat']; $mapDataFlag = 1; } else { if ($propertyId > 0) { $shopLocation = Model_Jinpu_MapProperty::getPropertyMapById($propertyId); if (!empty($shopLocation)) { $lng = $shopLocation['lng']; $lat = $shopLocation['lat']; } } else { list($lng, $lat) = BLL_House_JpHouseManage::getDefaultMap($out['brokerInfo']['CITYID']); } $mapDataFlag = 0; } $out['lng'] = $lng; $out['lat'] = $lat; $out['mapDataFlag'] = $mapDataFlag; return array('status' => 'ok', 'info' => $out, 'logArr' => $logGiveArr); }
public function handlePost() { //房源发布数量上限 if (BLL_House_JpHouseManage::houseNumLimit($this->jpMemberId, $this->brokerId, true) && !$this->act == 'edit') { $this->redirect2Result(Const_PublishCode::PUBLISH_OUT_OF_LIMIT, self::SITE_JP, $this->act); } $params = APF::get_instance()->get_request()->get_parameters(); $area = floatval($params['area']); //所在楼层 $floorType = ''; $selectFloor = intval($params['select_floor']); $singleFloor = intval($params['single_floor']); $fromFloor = intval($params['from_floor']); $toFloor = intval($params['to_floor']); $singleFamily = intval($params['single_family']); if ($selectFloor == 1) { $floorType = $selectFloor . ',' . $singleFloor; } elseif ($selectFloor == 2) { $floorType = $selectFloor . ',' . $fromFloor . ',' . $toFloor; } elseif ($selectFloor == 3) { $floorType = $selectFloor . ',' . $singleFamily; } $title = trim($params['shop_title']); $desc = trim($params['ProDesc']); $businessState = intval($params['business_state']); $totalPrice = trim($params['shop_total_price']); $dailyPrice = trim($params['shop_unit_price']); $postShop = array(); if (isset($this->shopId) && $this->act == 'edit') { //编辑 $shopData = Model_House_JpShopRent::data_access()->get_row($this->shopId); if (empty($shopData)) { $this->redirect2Result(Const_PublishCode::HOUSE_NOT_EXIST, self::SITE_JP, $this->act); } $postShop['shopPropertyId'] = $shopData['propertyId']; } else { //新发 if ($params['communityId'] == null || intval($params['communityId']) == 0) { $this->redirect2Result(Const_PublishCode::HOUSE_PARAM_COMPLETE, self::SITE_JP, $this->act); } $postShop['shopPropertyId'] = $params['communityId']; } $postShop['brokerId'] = $this->brokerId; $postShop['shopTitle'] = $title; $postShop['shopArea'] = $area; $postShop['floorType'] = $floorType; $postShop['businessState'] = $businessState; $jpPublish = APF::get_instance()->get_config("jpPublishShopSalePrice", "jpPublish"); $jpPublishShopSalePrice = $jpPublish[$this->cityId]; if ($jpPublishShopSalePrice == 'priceA') { $postShop['price'] = $dailyPrice; } else { $postShop['price'] = $totalPrice * 10000; } /* if($this->cityId == 13 || $this->cityId == 14) { $postShop['price'] = $dailyPrice; } else { $postShop['price'] = $totalPrice * 10000; } */ /* if($this->cityId == 13 || $this->cityId == 14) { $postShop['unitPrice'] = $dailyPrice; $postShop['shopPrice'] = round($postShop['unitPrice'] * $postShop['shopArea']); } else { $postShop['unitPrice'] = round($totalPrice * 10000 / $postShop['shopArea']); $postShop['shopPrice'] = $totalPrice * 10000; } */ $postShop['shopDesc'] = $desc; $postShop['type'] = 2; $postShop['rentType'] = intval($params['rentType']); if ($this->act == 'edit') { list($postShop['newShopPics'], $postShop['delShopPics']) = BLL_House_JpHouseManage::revertEditImageArray($params['oldroom'], $params['selroom'], $params['dropDesc'], $params['newupdroom'], $params['defaultImgID'], $params['delRoom'], $params['delHandlePic'], 'shop'); } else { $postShop['shopPics'] = json_encode(BLL_House_JpHouseManage::revertPublishImageArray($params['selroom'], $params['dropDesc'], $params['newupdroom'], $params['defaultImgID'])); } //区域 $postShop['districtId'] = intval($params['district_id']); //商圈 $postShop['blockId'] = intval($params['block_id']); //靠近 $postShop['near'] = trim($params['close_road']); //物业费 $postShop['manageFee'] = round(floatval($params['office_manage_fee']), 2); //商铺特性 $postShop['shopType'] = trim($params['shop-features-ipt']); //商铺其他特性 $postShop['shopTypeOther'] = trim($params['shop-features-other']); //客流人群 $postShop['clientType'] = trim($params['passenger-flow-ipt']); //客流人群其他 $postShop['clientTypeOther'] = trim($params['passenger-flow-other']); //推荐行业 $postShop['businessType'] = trim($params['featured-industries-ipt']); //物业配置 $postShop['industryConfig'] = trim($params['houses-matching-ipt']); //当前行业 经营中商铺必选 $postShop['currentIndustry'] = intval($params['select_industry']); ////商铺坐标 $postShop['shopPoints'] = !empty($params['map_lng']) && !empty($params['map_lat']) ? trim($params['map_lng']) . ',' . trim($params['map_lat']) . ',1' : ''; //新发或者更新基础房源信息 @todo call api if ($this->act == 'edit') { $postShop['shopId'] = $this->shopId; $apiHouseInfo = BLL_House_JpHouseManage::housePublishApi('s_e', $postShop); } else { $apiHouseInfo = BLL_House_JpHouseManage::housePublishApi('s_p', $postShop); } if ($apiHouseInfo['status'] != 'ok') { $this->redirect2Result($apiHouseInfo['code'], self::SITE_JP, $this->act, '', $apiHouseInfo['info']); } else { $this->shopId = $apiHouseInfo['id']; } return true; }
private function modifyShopRentHouse($task) { //取数据 $params = array(array('id', '>', 0), array('districtId', '=', $task['areaId']), array('blockId', '=', $task['blockId'])); $sort = array('id', 'asc'); $tasks = Model_House_JpShopRent::getPropLists($params, $this->houseLimit, $sort); if (empty($tasks)) { return array('status' => 'none', 'msg' => 'house list is empty'); } while ($tasks) { //处理数据 foreach ($tasks as $key => $val) { $this->cursor3 = $val['id']; $propertyInfo = Model_House_JpProperty::getPropertyById($val['propertyId']); //自选 if ($propertyInfo['districtId'] == 0 && $propertyInfo['blockId'] == 0) { if ($val['districtId'] == $task['areaId'] && $val['blockId'] == $task['blockId']) { try { // call api update house $data = array('shopId' => $val['id'], 'districtId' => $this->newDistrictId, 'blockId' => $this->newBlockId); $result = $this->updateShopHouse($data); $info = $result['info']; if ($result['status'] == 'ok') { $this->setLog('[' . date('Y-m-d H:i:s') . '] update shopRent: 自选 更新房源[ ' . $val['id'] . ' ]的districtId=' . $this->newDistrictId . ',blockId=' . $this->newBlockId . ' 【 成功 】data:' . $info); } else { $this->setLog('[' . date('Y-m-d H:i:s') . '] update shopRent: 自选 更新房源[ ' . $val['id'] . ' ]的districtId=' . $this->newDistrictId . ',blockId=' . $this->newBlockId . ' 【 失败 】data:' . $info); } } catch (Exception $e) { $this->setLog('[' . date('Y-m-d H:i:s') . '] update shopRent: 自选 更新房源[ ' . $val['id'] . ' ]的districtId=' . $this->newDistrictId . ',blockId=' . $this->newBlockId . ' 【 异常 】'); $this->setLog($e->getMessage()); } } } } $this->setLog('[' . date('Y-m-d H:i:s') . '] update shopRent: 更新房源 current cursor: ' . $this->cursor3); //取数据 $params = array(array('id', '>', $this->cursor3), array('districtId', '=', $task['areaId']), array('blockId', '=', $task['blockId'])); $sort = array('id', 'asc'); $tasks = Model_House_JpShopRent::getPropLists($params, $this->houseLimit, $sort); } return array('status' => 'over', 'msg' => 'house list is empty'); }
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 * @throws Exception */ public static function getPropInfoById($id) { $houseInfo = Model_House_JpShopRent::data_access()->filter('id', $id)->get_row(); return $houseInfo; }
/** * * 获取经纪人的违规房源数 * * @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; }