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
 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;
 }
Esempio n. 3
0
 /**
  * @param $id
  * @return array
  * @throws Exception
  */
 public static function getPropInfoById($id)
 {
     $houseInfo = Model_House_JpShopRent::data_access()->filter('id', $id)->get_row();
     return $houseInfo;
 }