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_JpOfficeSale::data_access()->filter('id', $id)->get_row(); return $houseInfo; }
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 = trim($params['office_area']); $efficientRate = intval($params['office_efficient_rate']); $floorId = intval($params['office_floor']); $title = trim($params['office_title']); $desc = trim($params['ProDesc']); $totalPrice = trim($params['office_total_price']); $dailyPrice = trim($params['office_unit_price']); $officeManageFee = trim($params['office_manage_fee2']) === '' ? 0.001 : round(floatval($params['office_manage_fee2']), 1); $postOffice = array(); if (isset($this->officeId) && $this->act == 'edit') { //编辑 $OfficeData = Model_House_JpOfficeSale::data_access()->get_row($this->officeId); 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['txtCode'] = trim($params['fileNo']); $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("jpPublishOfficeSalePrice", "jpPublish"); $jpPublishOfficeSalePrice = $jpPublish[$this->cityId]; if ($jpPublishOfficeSalePrice == 'priceA' || $jpPublishOfficeSalePrice == 'priceB') { $postOffice['price'] = $dailyPrice; } else { $postOffice['price'] = $totalPrice * 10000; } /* $CityArray = array('11', '12', '13', '14'); if (in_array($this->cityId, $CityArray)) { $postOffice['price'] = $dailyPrice; } else { $postOffice['price'] = $totalPrice * 10000; } */ /* if (in_array($this->cityId, $CityArray)) { $postOffice['unitPrice'] = $dailyPrice; $postOffice['officePrice'] = round($postOffice['unitPrice'] * $postOffice['officeArea']); } else { $postOffice['unitPrice'] = round($totalPrice * 10000 / $area, 2); $postOffice['officePrice'] = $totalPrice * 10000; } */ $postOffice['officeDesc'] = $desc; $postOffice['type'] = 2; 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; }