/** * @param $id * @return array|mixed|null * @throws Exception */ public static function getPropInfoById($id) { $houseInfo = Model_House_JpShopSale::data_access()->filter('id', $id)->get_row(); return $houseInfo; }
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; }