openvk/Web/Models/sql/get-nearest-posts.tsql
n1rwana a714a0aa16
feat(wall): ability to add geopoint to post (#945)
* Гео-метки

* Update Post.xml

* Wall: geotag translation

* Wall: design + sql fix

* Карта ближайших постов

* Update al_wall.js

* VKAPI: Geo support (not tested idk)

* Update WallPresenter.php

* Better geo points

* Редактирование названия геоточки через интерфейс при создании

* SQL and geopoint name fixes

* fix js

* rewrite a lot

---------

Co-authored-by: veselcraft <veselcraft@icloud.com>
Co-authored-by: mrilyew <99399973+mrilyew@users.noreply.github.com>
2024-12-13 17:53:36 +03:00

11 lines
300 B
Text

SELECT *,
SQRT(
POW(69.1 * (? - geo_lat), 2) +
POW(69.1 * (? - geo_lon) * COS(RADIANS(geo_lat)), 2)
) AS distance
FROM posts
WHERE id <> ?
AND FROM_UNIXTIME(created) >= DATE_SUB(NOW(), INTERVAL 1 MONTH)
HAVING distance < 1 AND distance IS NOT NULL
ORDER BY distance
LIMIT 25;