示例#1
0
 public function get_view()
 {
     $params = $this->get_params();
     $this->assign_data('menu', $params['menu']);
     $this->assign_data('index', $params['index']);
     //添加商业地产店铺城市列表
     $this->set_city_list();
     $this->assign_data('managespace_city_list', $this->managespace_city_list);
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     $this->assign_data('cityId', $cityId);
     $this->assign_data('isNewCommunityApplyCity', Bll_City::isNewCommunityApplyCity($cityId));
     //明星中介相关
     try {
         apf_require_class('Bll_Broker_StarIntermediary');
         $starBll = new Bll_Broker_StarIntermediary($cityId);
         $starIsOpen = $starBll->checkCityIfOpen();
         $brokerId = APF::get_instance()->get_request()->getBrokerId();
         $starInfo = $starBll->getBrokerNewestInfo($brokerId);
         if (empty($starInfo['broker'])) {
             $starIsOpen = 0;
         }
         $this->assign_data('starIsOpen', $starIsOpen);
     } catch (Exception $e) {
         //todo 不做任何处理,不展示明星中介内容
     }
     return "BrokerSideNav";
 }
 public function handle_request_internal()
 {
     if (!Bll_City::isNewCommunityApplyCity(static::$intBrokerCityID)) {
         $this->redirect('/ajkbroker/broker/applygardener/?from=illegal_request');
     }
     $params = $this->getParameters();
     $page = isset($params['p']) ? max(1, $params['p']) : 1;
     $applyCommunityGardenerAd = Bll_Community_CommunityGardener::getCommunityGardenerApplyBannerAdInfo(static::$intBrokerCityID);
     if (!empty($applyCommunityGardenerAd)) {
         $this->setAttribute('applyCommunityGardenerAd', $applyCommunityGardenerAd[0]);
     }
     $houseCommunityInfo = Bll_Community_CommunityGardener::getBrokerOnlineHouseCommunityInfo(static::$intBrokerID, static::$intBrokerCityID, array('commId', 'commName', 'showDay', 'showDate'));
     $communityIds = $this->getCommunityIdFromHouseInfo($houseCommunityInfo);
     sort($communityIds, SORT_NUMERIC);
     $communityInfoList = array();
     foreach ($communityIds as $communityId) {
         $communityInfo = Bll_Community_CommunityGardener::getCommunityDetail($communityId);
         /** 过滤掉隐藏小区 */
         if ($communityInfo['baseInfo']['typeFlag'] == 0) {
             continue;
         }
         $communityInfoList[] = $communityInfo;
     }
     /** 移除完善小区 */
     $canApplyCommunityList = $this->removeCompleteCommunity($communityInfoList);
     if (!empty($canApplyCommunityList)) {
         $communityCount = count($canApplyCommunityList);
         /** 如果当前页大于最大页数,则跳转至第一页 */
         if ($page > ceil($communityCount / self::PAGE_SIZE)) {
             $this->redirect(BASE_URI . '/broker/applygardener2/?from=error_page_number');
         }
         //usort($canApplyCommunityList, array($this, 'sortCommunity'));
         $communityList = array_slice($canApplyCommunityList, ($page - 1) * self::PAGE_SIZE, self::PAGE_SIZE);
         $communityIds = $this->getCommunityIdFromCommunityInfo($communityList);
         /** 获取小区的小区园丁状态 */
         $communityStateInfoList = Bll_Community_CommunityGardener::getMultiCommunityApplyInfo($communityIds);
         /** 转换小区园丁的列表为以小区ID为key */
         $communityStateInfoList = $this->changeCommunityStateInfoList2CommunityId($communityStateInfoList);
         /** TODO 拼接小区申请额外信息 */
         $canApplyCommunityStateList = $this->initCommunityGardenerStateInfo($communityList, $communityStateInfoList, static::$intBrokerID);
         // if (!empty($canApplyCommunityStateList['gardenerIds'])) {
         //    $gardenerInfoList = Bll_Community_CommunityGardener::getMultiBrokerInfo($canApplyCommunityStateList['gardenerIds'], array('brokerId', 'trueName'));
         //    $this->setAttribute("gardenerInfos", $gardenerInfoList);
         // }
         /** 分页信息 */
         $multiPageShow = false;
         if ($communityCount > self::PAGE_SIZE) {
             $multiPage = $this->getMultiPage(array('p' => $page), $communityCount, self::PAGE_COUNT, self::PAGE_SIZE);
             $multiPageShow = true;
             $this->setAttribute("multipage", $multiPage);
         }
         $this->setAttribute("commCount", $communityCount);
         $this->setAttribute("BrokerId", static::$intBrokerID);
         $this->setAttribute("multipageShow", $multiPageShow);
         $this->setAttribute("onlineCommInfos", $canApplyCommunityStateList['communityList']);
     }
     return 'Broker_CommunityApplyGardeners2';
 }
 public function handle_request_internal()
 {
     if (!Bll_City::isNewCommunityApplyCity(static::$intBrokerCityID)) {
         $this->redirect('/ajkbroker/broker/gardener/?from=illegal_request');
     }
     $params = $this->getParameters();
     $page = isset($params['p']) ? max(1, $params['p']) : 1;
     $applyCount = Bll_Community_CommunityGardener::getBrokerApplyCount(static::$intBrokerID);
     $applyCommunityGardenerAd = Bll_Community_CommunityGardener::getCommunityGardenerHistoryApplyBannerAdInfo(static::$intBrokerCityID);
     if (!empty($applyCommunityGardenerAd)) {
         $this->setAttribute('applyCommunityGardenerAd', $applyCommunityGardenerAd[0]);
     }
     /** 如果没有申请记录则直接返回 */
     if ($applyCount == 0) {
         $this->setAttribute('applyCount', 0);
         $this->setAttribute('multipageShow', false);
         //是否显示分页
         $this->setAttribute('applyInfoList', array());
         $this->setAttribute('commInfos', array());
         return 'Broker_CommunityNewGardeners2';
     }
     if ($applyCount <= self::PAGE_SIZE) {
         $page = 1;
     }
     /** 如果当前页面大于最大页面则直接跳转到第一页去 */
     if ($page > ceil($applyCount / self::PAGE_SIZE)) {
         $redirectUrl = $this->getURLPrefix();
         $this->redirect($redirectUrl . 'from=error_page_number');
         exit;
     }
     $applyHistory = Bll_Community_CommunityGardener::getBrokerApplyHistory(static::$intBrokerID, $page, self::PAGE_SIZE);
     $failApplyIds = $this->initializationCommunityApplyInfo($applyHistory);
     // $applyFailReason = Bll_Community_CommunityGardener::getApplyFailReasonEx($failApplyIds);
     $communityIds = $this->getCommunityIdFromApplyInfo($applyHistory);
     $communityInfo = Bll_Community_CommunityGardener::getMultiCommunityInfoByCommunityId($communityIds, array('commId', 'commName'));
     $multiPageShow = false;
     if ($applyCount > self::PAGE_SIZE) {
         $multiPage = $this->getMultiPage(array('p' => $page), $applyCount, self::PAGE_COUNT, self::PAGE_SIZE);
         $multiPageShow = true;
         $this->setAttribute("multipage", $multiPage);
     }
     $this->setAttribute('applyCount', $applyCount);
     $this->setAttribute('multipageShow', $multiPageShow);
     $this->setAttribute('applyInfoList', $applyHistory);
     // $this->setAttribute('applyFailReason', $applyFailReason);
     $this->setAttribute('commInfo', $communityInfo);
     return 'Broker_CommunityNewGardeners2';
 }
示例#4
0
 public function handle_request_internal()
 {
     if (!Bll_City::isNewCommunityApplyCity(static::$intBrokerCityID)) {
         $this->redirect2Result(false, '非法请求', __LINE__);
     }
     $request = APF::get_instance()->get_request();
     $params = $this->getParameters();
     $verifyCode = $params[self::VERIFY];
     $matches = $request->get_router_matches();
     $communityId = intval($matches[1]);
     $brokerId = static::$intBrokerID;
     if ($verifyCode != Bll_Community_CommunityGardener::getVerifyCode($communityId, $brokerId)) {
         $this->redirect2Result(false, '请求不合法', __LINE__);
     }
     $communityInfo = Bll_Community_CommunityGardener::getCommunityDetail($communityId);
     if ($communityInfo['baseInfo']['typeFlag'] == 0) {
         $this->redirect2Result(false, '小区不存在', __LINE__);
     }
     if (!Bll_Community_CommunityGardener::checkCommunityCanApply($communityId, $brokerId, true)) {
         $this->redirect2Result(false, '小区不可以申请', __LINE__);
     }
     $communityGardenerApplyState = Bll_Community_CommunityGardener::getCommunityGardenerState($communityId);
     if (empty($communityGardenerApplyState)) {
         if (!Bll_Community_CommunityGardener::initCommunityGardenerState($communityId, $brokerId)) {
             $this->redirect2Result(false, '初始化小区状态失败', __LINE__);
         }
     } elseif ($communityGardenerApplyState['state'] == Model_Community_CommunityState::COMMUNITY_STATE_CHECKING) {
         $this->redirect2Result(false, '审核中的小区不允许申请', __LINE__);
     } elseif ($communityGardenerApplyState['state'] == Model_Community_CommunityState::COMMUNITY_STATE_APPLYING) {
         //状态为锁定
         if ($communityGardenerApplyState['applyExpirationTime'] < time()) {
             //锁定时间过期
             //重新锁定
             if (!Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId)) {
                 $this->redirect2Result(false, '锁定小区申请状态失败', __LINE__);
             }
         } else {
             //锁定时间未过期
             //别人不能申请
             if ($communityGardenerApplyState['applyBrokerId'] != $brokerId) {
                 $this->redirect2Result(false, '小区正在被申请', __LINE__);
             }
         }
     } else {
         if (!Bll_Community_CommunityGardener::lockCommunityGardenerApply($communityId, $brokerId)) {
             $this->redirect2Result(false, '锁定小区申请状态失败', __LINE__);
         }
     }
     $action = $params[self::ACTION];
     $applyHistory = Bll_Community_CommunityGardener::getBrokerUnfinishedApply($communityId, $brokerId);
     $history = array();
     if (!empty($applyHistory) && !empty($applyHistory['applyData'])) {
         $history = json_decode($applyHistory['applyData'], true);
     }
     // $communityImageList = Bll_Community_CommunityGardener::getValidateCommunityImagesList($communityId);
     // $communityImageCount = count($communityImageList);
     // $brokerShouldUploadPhotoCount = max(0, Bll_Community_CommunityGardener::COMMUNITY_IMAGE_BASE_COUNT - $communityImageCount);
     $brokerShouldUploadPhotoCount = Bll_Community_CommunityGardener::COMMUNITY_IMAGE_BASE_COUNT;
     if ($action == 'save') {
         $image = array();
         foreach ($params as $key => $val) {
             $keyName = explode('_', $key);
             if (isset($keyName[1]) && in_array($keyName[0], array('host', 'hash', 'content'))) {
                 if ($keyName[0] == 'content') {
                     $val = Util_PublicMethods::cutStr($val, 50);
                 }
                 $image[$keyName[1]][$keyName[0]] = htmlspecialchars($val, ENT_COMPAT | ENT_HTML401 | ENT_IGNORE, 'UTF-8');
             } else {
                 continue;
             }
         }
         if (count($image) >= $brokerShouldUploadPhotoCount) {
             $uploadedImageList = array_values($image);
             $history['images'] = array_slice($uploadedImageList, 0, Bll_Community_CommunityGardener::COMMUNITY_IMAGE_COUNT_LIMIT);
             $storeSuccess = Bll_Community_CommunityGardener::storeApplyCommunityCorrectData($communityId, $brokerId, static::$intBrokerCityID, $history, Model_Community_GardenerApply::APPLY_STATUS_PENDING_APPROVAL);
             if ($storeSuccess) {
                 Model_Community_CommunityState::setCheckGardener($communityId, $brokerId);
                 $this->redirect2Result(true, '小区申请成功', __LINE__);
             }
             $this->redirect2Result(false, '保存图片信息失败', __LINE__);
         }
         $this->redirect2Result(false, '提交的图片数量不够', __LINE__);
     }
     $hasCorrectPhoto = !empty($history['images']);
     $this->setAttribute('brokerShouldUploadPhotoCount', $brokerShouldUploadPhotoCount);
     $this->setAttribute('brokerUploadPhotoCountLimit', Bll_Community_CommunityGardener::COMMUNITY_IMAGE_COUNT_LIMIT);
     $this->setAttribute('hasCorrectPhoto', $hasCorrectPhoto);
     $this->setAttribute('updatedImageList', isset($history['images']) ? $history['images'] : array());
     $this->setAttribute('brokerId', $brokerId);
     $this->setAttribute('communityInfo', $communityInfo['baseInfo']);
     $this->setAttribute('verify', $verifyCode);
     return 'Community_Gardener2_PhotoCommit';
 }
 public function get_exchange_nav()
 {
     $cityId = $this->get_param("CityId");
     $nav[] = array("menuid" => self::EXCHANGE . "_2", "title" => "房东委托", "target" => "", "link" => '/ajkbroker/commissions');
     /*
     if(in_array($cityId,array(11))){
         $nav[] = array(
             "menuid"=>self::EXCHANGE."_2",
             "title"=>"我的委托",
             "target"=>"",
             "link"=>"/user/broker/publicdelegation/"
         );
     }else{
         $nav[] = array(
             "menuid"=>self::EXCHANGE."_2",
             "title"=>"房东委托",
             "target"=>"",
             "link"=>"/user/broker/publicdelegation/"
         );
     }
     */
     //        $nav[] = array(
     //            "menuid"=>self::EXCHANGE."_0",
     //            "title"=>"大学堂",
     //            "target"=>"",
     //            "link"=>"/user/broker/study/"
     //        );
     $nav[] = array("menuid" => self::EXCHANGE . "_1", "title" => "问答专家", "target" => "", "link" => "/user/broker/ask/");
     //        $nav[] = array(
     //            "menuid"=>self::EXCHANGE."_3",
     //            "title"=>"SNS分享",
     //            "target"=>"",
     //            "link"=>"/user/broker/propertysns/"
     //        );
     $cityId = $this->get_param('CityId');
     if (Bll_City::isNewCommunityApplyCity($cityId)) {
         $nav[] = array("menuid" => self::EXCHANGE . '_4', "title" => '小区园丁', "target" => '', "link" => '/ajkbroker/broker/applygardener2/');
     } else {
         $nav[] = array("menuid" => self::EXCHANGE . '_4', "title" => '小区园丁', "target" => '', "link" => '/ajkbroker/broker/applygardener/');
     }
     if ($this->starIsOpen) {
         $nav[] = array("menuid" => self::EXCHANGE . "_5", "title" => "明星中介", "target" => "", "link" => "/ajkbroker/broker/star/intermediary");
     }
     $nav[] = array("menuid" => self::EXCHANGE . "_6", "title" => "图片删除查询", "target" => "", "link" => "/user/broker/unpassedpic/");
     return $this->nav_selected($nav);
 }