/** * 查询区域内楼盘 */ public function findByBounds($minLng, $minLat, $maxLng, $maxLat) { $bounds_sql = "where point.longitude < {$maxLng} and point.longitude > {$minLng} " . "and point.latitude > {$minLat} and point.latitude < {$maxLat}"; $sql = "select premises.id pid, premises.name name, " . "point.longitude lng, point.latitude lat from premises " . "left join point on premises.point_id = point.id {$bounds_sql}"; $mysql = new MysqlAccess(); $result = $mysql->getData($sql); return $result; }
/** * 查找 */ public function find($type, $limit = 15, $page = 0) { $type_sql = empty($type) ? "" : "where person.state='{$type}'"; $sql = "select `id`, `name` from person {$type_sql} limit {$page}, {$limit}"; $mysql = new MysqlAccess(); $result = $mysql->getData($sql); return $result; }
/** * 查询区域内项目 */ public function findByBounds($type, $minLng, $minLat, $maxLng, $maxLat) { $type_sql = empty($type) ? "" : "and project.type='{$type}' "; $bounds_sql = "where point.longitude < {$maxLng} and point.longitude > {$minLng} " . "and point.latitude > {$minLat} and point.latitude < {$maxLat}"; $sql = "select project.id pid, project.name name, project.type type, " . "point.longitude lng, point.latitude lat from project " . "left join point on project.point_id = point.id {$bounds_sql} {$type_sql} "; $mysql = new MysqlAccess(); $result = $mysql->getData($sql); return $result; }