Beispiel #1
0
 public function handle_request_internal()
 {
     $type = "sale";
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $baseUrl = "http://my.{$baseDomain}";
     $commissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     $myCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     $myRentCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     $cityId = $this->request->getBrokerCityId();
     if ($cityId == 11) {
         $this->request->set_attribute('propCheck', 0);
     } else {
         $this->request->set_attribute('propCheck', 1);
     }
     $params = $this->request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 10;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     // 获取经纪人的委托
     $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('type', 1)->filter('isDelete', Model_House_Commission::DELETE_NO);
     $daTotal = clone $daCommissions;
     $commissions = $daCommissions->limit($per)->offset(($page - 1) * $per)->sort('id', 'desc')->find_all();
     // 获取委托关联的房源
     if (!empty($commissions)) {
         $houseIds = array();
         $brokerHouseIds = array();
         foreach ($commissions as $commission) {
             $houseIds[] = $commission->houseId;
             if (!empty($commission->brokerHouseId)) {
                 $brokerHouseIds[] = $commission->brokerHouseId;
             }
         }
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
         $this->request->set_attribute('houses', $houses);
         // 获取小区默认图片 和 区域板块名称
         $communityIds = array();
         $areaCodes = array();
         foreach ($houses as $house) {
             $communityIds[] = $house->commId;
             $areaCodes[] = $house->areaCode;
         }
         // 房东房源图片
         $propImageUrls = Bll_Image_UtilsImage::getCommissionProImage($houseIds);
         $this->request->set_attribute('propImageUrls', $propImageUrls);
         // 小区默认图片
         $communityImageUrls = $this->getCommunityImageUrls($communityIds);
         $this->request->set_attribute('communityImageUrls', $communityImageUrls);
         // 区域板块
         $areaCodesNames = $this->getAreaCodeNames($areaCodes);
         $this->request->set_attribute('areaCodeNames', $areaCodesNames);
         // 是否推广数据
         $staticPro = Bll_House_EsfHouse::getHouseOnLineInfo(self::$BrokerInfo['BaseInfo']['CITYID'], $brokerId, $brokerHouseIds);
         if (!empty($brokerHouseIds)) {
             $publishedProInfo = Bll_House_EsfHouse::getHouseInfo($brokerHouseIds, self::$BrokerInfo['BaseInfo']['CITYID']);
         }
         // 分页
         $total = $daTotal->count();
         $pager = Util_MultiPage::multiPage($params, '', $total, $per, 10, $myCommissionsPageUrl);
         $this->request->set_attribute('page', $page);
         $this->request->set_attribute('pager', $pager);
         $this->request->set_attribute('showPager', $total > $per);
     }
     $proSpreadUrl1 = "http://my." . $baseDomain . "/user/ajax/ppclimit";
     $proSpreadUrl2 = "http://my." . $baseDomain . "/user/ajax/sale/staticplan/";
     // 立即推广地址
     $isCombo = Bll_Combo_HouseRelation::ifComboCity(self::$BrokerInfo['BaseInfo']['CITYID']);
     if ($isCombo == true) {
         $tgUrl = $baseUrl . "/ajkbroker/combo/broker/manage/ajk";
     } else {
         $tgUrl = $baseUrl . "/user/broker/sale/homepage";
     }
     $this->request->set_attribute('commissions', $commissions);
     $this->request->set_attribute('commissionsPageUrl', $commissionsPageUrl);
     $this->request->set_attribute('myCommissionsPageUrl', $myCommissionsPageUrl);
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('staticPro', $staticPro);
     $this->request->set_attribute('publishedProInfo', $publishedProInfo);
     $this->request->set_attribute('myRentCommissionsPageUrl', $myRentCommissionsPageUrl);
     $this->request->set_attribute('proSpreadUrl1', $proSpreadUrl1);
     $this->request->set_attribute('proSpreadUrl2', $proSpreadUrl2);
     $this->request->set_attribute('baseUrl', $baseUrl);
     $this->request->set_attribute('tgUrl', $tgUrl);
     return 'House_Commission_MySale';
 }
Beispiel #2
0
 public function handle_request_internal()
 {
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $pageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     /*
      * 1.参数获取
      */
     $params = $this->request->get_parameters();
     $type = isset($params['type']) && in_array($params['type'], array('rent', 'sale')) ? $params['type'] : '';
     // 房源类型:不限、出粗、出售
     // $room = (isset($params['room']) && in_array($params['room'], array('1', '2', '3', '4'))) ? $params['room'] : ''; // 房源房型:不限、一室、二室、三室、三室以上
     //$areaId = (isset($params['area']) && is_numeric($params['area'])) ? intval($params['area']) : 0; // 房源区域:主版块
     //$subAreaId = ($areaId && isset($params['subArea']) && is_numeric($params['subArea'])) ? intval($params['subArea']) : 0; // 房源区域:子版块
     $cityId = $this->request->getBrokerCityId();
     //如果是审核直接跳到我得房源库
     /*
     if($cityId == 11){
         APF::get_instance()->get_response()->redirect($pageUrl.'/mysale');
         return false;
     }
     */
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 10;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     /*
      * 2.获取经纪人主营板块下的所有委托房源(按照创建时间排序)
      */
     $rushedHouses = array();
     $daHouse = Model_House_CommissionHouse::data_access()->filter('cityId', $cityId)->filter('proStatus', Model_House_CommissionHouse::STATUS_ONGOING)->filter_by_op('openBrokerCnt', '<', Model_House_CommissionHouse::allowedMaxCommissionCount());
     // 房源区域
     /*$areas = $this->getCityAreas($cityId);
             $subAreas = array();
             if ($areaId) {
                 $subAreas = $this->getSubAreas($areaId);
     
                 if ($subAreas) {
                     $subAreaIds = array();
                     $subAreaCodes = array();
                     foreach ($subAreas as $subArea) {
                         $subAreaIds[$subArea->typeId] = $subArea->typeId;
                         $subAreaCodes[$subArea->typeId] = $subArea->typeCode;
                     }
     
                     if ($subAreaId && isset($subAreaCodes[$subAreaId])) {
                         $daHouse->filter('areaCode', $subAreaCodes[$subAreaId]);
                     } else {
                         $daHouse->filter('areaCode', $subAreaCodes);
                     }
                 } else {
                     $daHouse->filter('areaCode', 0);
                 }
             }
             */
     // 房源类型
     if ($type) {
         switch ($type) {
             case 'rent':
                 $daHouse->filter('commissionType', Model_House_CommissionHouse::COMMISSION_TYPE_RENT);
                 break;
             case 'sale':
                 $daHouse->filter('commissionType', Model_House_CommissionHouse::COMMISSION_TYPE_SALE);
                 break;
         }
     }
     /*
     // 房源房型
     if ($room) {
         switch ($room) {
             case '1':
             case '2':
             case '3':
                 $daHouse->filter('roomNum', $room);
                 break;
             case '4':
                 $daHouse->filter_by_op('roomNum', '>=', $room);
                 break;
         }
     }
     */
     // 获取经纪人的区域id
     $brokerAreaCode = $this->getBrokerAreaCode(self::$BrokerInfo['BaseInfo']);
     if (!empty($brokerAreaCode)) {
         $daHouse->filter_by_op('areaCode', 'like', "{$brokerAreaCode}%");
     } else {
         $daHouse->filter('id', 0);
         // 没有区域id,则不显示数据
     }
     // 获取满足条件的总量
     $daTotal = clone $daHouse;
     $total = $daTotal->count();
     // 分页
     $pager = Util_MultiPage::multiPage($params, '', $total, $per, 10, $pageUrl);
     $this->request->set_attribute('page', $page);
     $this->request->set_attribute('pager', $pager);
     $this->request->set_attribute('showPager', $total > $per);
     // 当前页面的个人房源
     $houses = $daHouse->limit($per)->offset(($page - 1) * $per)->sort('created', 'desc')->find_all();
     //print_r($daHouse->get_last_sql());
     $overHouses = $this->getHasOverHouses($cityId);
     // 获取小区默认图片 和 区域板块名称
     $houseIds = array();
     $communityIds = array();
     $areaCodes = array();
     foreach ($houses as $house) {
         $houseIds[] = $house->id;
         $communityIds[] = $house->commId;
         $areaCodes[] = $house->areaCode;
     }
     // 判断已经抢完的数据是否存在
     if (!empty($overHouses)) {
         foreach ($overHouses as $house) {
             $houseIds[] = $house->id;
             $communityIds[] = $house->commId;
             $areaCodes[] = $house->areaCode;
         }
     }
     // 房东房源图片
     $propImageUrls = Bll_Image_UtilsImage::getCommissionProImage($houseIds);
     $this->request->set_attribute('propImageUrls', $propImageUrls);
     // 小区默认图片
     $communityImageUrls = $this->getCommunityImageUrls($communityIds);
     $this->request->set_attribute('communityImageUrls', $communityImageUrls);
     // 区域板块
     $areaCodesNames = $this->getAreaCodeNames($areaCodes);
     $this->request->set_attribute('areaCodeNames', $areaCodesNames);
     // 获取当前经纪人房源委托情况,如果已经委托,提示已委托
     if ($houseIds) {
         $rushedCommissions = Model_House_Commission::data_access()->filter('houseId', $houseIds)->filter('brokerId', $brokerId)->find_all();
         $rushedHouses = array();
         foreach ($rushedCommissions as $rushedCommission) {
             $rushedHouses[$rushedCommission->houseId] = $rushedCommission->id;
         }
     }
     $rechargeUrl = "http://my.{$baseDomain}/user/broker/hpsupplement";
     $isCombo = Bll_Combo_HouseRelation::ifComboCity(self::$BrokerInfo['BaseInfo']['CITYID']);
     if ($isCombo == ture) {
         // 获取经纪人套餐房源数
         $conbosProNum = Bll_Combo_Broker_BrokerComboInfo::getTotalCombosProNum($brokerId);
         $this->request->set_attribute('conbosProNum', $conbosProNum);
     }
     $this->request->set_attribute('isCombo', $isCombo);
     $this->request->set_attribute('type', $type);
     //$this->request->set_attribute('room', $room);
     //$this->request->set_attribute('area', $areaId);
     //$this->request->set_attribute('subArea', $subAreaId);
     //$this->request->set_attribute('areas', $areas);
     //$this->request->set_attribute('subAreas', $subAreas);
     $this->request->set_attribute('pageUrl', $pageUrl);
     $this->request->set_attribute('houses', $houses);
     $this->request->set_attribute('rushedHouses', $rushedHouses);
     $this->request->set_attribute('overHouses', $overHouses);
     $this->request->set_attribute('rechargeUrl', $rechargeUrl);
     return 'House_Commission_All';
 }
 /**
  * 获取分页信息
  *
  * @param array $params
  * @param int $total
  * @param int $Page
  * @param int $PageSize
  * @return array
  */
 public function getMultiPage($params, $total, $Page, $PageSize)
 {
     return Util_MultiPage::multiPage($params, '', $total, $PageSize, $Page, $this->getURLPrefix());
 }
Beispiel #4
0
 public function handle_request_internal()
 {
     $type = "rent";
     $this->apf = APF::get_instance();
     $this->request = $this->apf->get_request();
     $this->response = $this->apf->get_response();
     $baseDomain = APF::get_instance()->get_config('base_domain', 'common');
     $baseUri = defined('BASE_URI') ? BASE_URI : '';
     $pageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     $commissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions";
     $myCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/mysale";
     $myRentCommissionsPageUrl = "http://my.{$baseDomain}{$baseUri}/commissions/my";
     // *** *** *** *** *** *** ***
     $params = $this->request->get_parameters();
     $brokerId = self::$BrokerInfo['BaseInfo']['BROKERID'];
     // TODO 替换为其他的方式
     $per = 5;
     $page = isset($params[Const_Listing::PARAM_N_PAGE]) && intval($params[Const_Listing::PARAM_N_PAGE]) > 0 ? intval($params[Const_Listing::PARAM_N_PAGE]) : 1;
     $cityId = $this->request->getBrokerCityId();
     if ($cityId == 11) {
         $this->request->set_attribute('propCheck', 0);
     } else {
         $this->request->set_attribute('propCheck', 1);
     }
     // 获取经纪人的所有委托
     $daCommissions = Model_House_Commission::data_access()->filter('brokerId', $brokerId)->filter('type', 2)->filter('isDelete', Model_House_Commission::DELETE_NO);
     $daTotal = clone $daCommissions;
     $commissions = $daCommissions->limit($per)->offset(($page - 1) * $per)->sort('id', 'desc')->find_all();
     // 获取委托关联的房源
     if (!empty($commissions)) {
         $houseIds = array();
         foreach ($commissions as $commission) {
             $houseIds[] = $commission->houseId;
         }
         $houses = Model_House_CommissionHouse::data_access()->filter('id', $houseIds)->sort('id', 'asc')->find_all();
         $this->request->set_attribute('houses', $houses);
         // 获取小区默认图片 和 区域板块名称
         $communityIds = array();
         $areaCodes = array();
         foreach ($houses as $house) {
             $communityIds[] = $house->commId;
             $areaCodes[] = $house->areaCode;
         }
         // 房东房源图片
         $propImageUrls = Bll_Image_UtilsImage::getCommissionProImage($houseIds);
         $this->request->set_attribute('propImageUrls', $propImageUrls);
         // 小区默认图片
         $communityImageUrls = $this->getCommunityImageUrls($communityIds);
         $this->request->set_attribute('communityImageUrls', $communityImageUrls);
         // 区域板块
         $areaCodesNames = $this->getAreaCodeNames($areaCodes);
         $this->request->set_attribute('areaCodeNames', $areaCodesNames);
         // 分页
         $total = $daTotal->count();
         $pager = Util_MultiPage::multiPage($params, '', $total, $per, 5, $pageUrl);
         $this->request->set_attribute('page', $page);
         $this->request->set_attribute('pager', $pager);
         $this->request->set_attribute('showPager', $total > $per);
     }
     $this->request->set_attribute('commissions', $commissions);
     $this->request->set_attribute('commissionsPageUrl', $commissionsPageUrl);
     $this->request->set_attribute('myCommissionsPageUrl', $myCommissionsPageUrl);
     $this->request->set_attribute('type', $type);
     $this->request->set_attribute('myRentCommissionsPageUrl', $myRentCommissionsPageUrl);
     return 'House_Commission_My';
 }