Для платных точек не выводятся точки того-же типа в блоке поблизости

This commit is contained in:
Krivchikov Dmitry 2016-05-07 19:27:09 +03:00
parent 90d96afb2b
commit c92c3a83da
2 changed files with 9 additions and 2 deletions

View File

@ -81,8 +81,13 @@ class PointController extends Controller
}
$photoLinksRes = implode('; ', array_keys($photoLinksRes));
$categoryId = 0;
if (array_search($point->categoryId, Category::$paidIds) !== FALSE) {
$categoryId = $point->categoryId;
}
$similarPoints = Point::model()->getAll(array('where' => '`status` = "published" AND categoryId = ' . $point->categoryId . ' AND `id` <> ' . $point->id . ' ORDER BY RAND() LIMIT 6;'));
$closestPoints = Point::model()->getClosestPoints($pointId);
$closestPoints = Point::model()->getClosestPoints($pointId, $categoryId);
$randomPoint = Point::model()->getRandom();
$randomPoint->description = mb_substr($randomPoint->description, 0, 400, 'UTF-8');
$randomPoint->description = Helper::replaceLinks($randomPoint->description);

View File

@ -47,7 +47,7 @@ class Point extends Model
return $this->getByPK($pointId);
}
public function getClosestPoints($pointId)
public function getClosestPoints($pointId, $categoryNot = 0)
{
$degrees = 1;
@ -64,6 +64,8 @@ class Point extends Model
WHERE
`status` = "published"
AND
`categoryId` != ' . $categoryNot . '
AND
`lat` BETWEEN :minLat AND :maxLat
AND
`lng` BETWEEN :minLng AND :maxLng