Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 /**
  * @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;
 }
Esempio n. 3
0
 /**
  * @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;
 }