FIX выборка интересной точки из непрошедших модерацию
This commit is contained in:
parent
2b88ddc44a
commit
b12a1c55b3
|
|
@ -35,10 +35,10 @@ class Point extends Model
|
||||||
|
|
||||||
public function getRandom()
|
public function getRandom()
|
||||||
{
|
{
|
||||||
$res = App::DB()->query("SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `" . $this->_tableName_ . "`")->fetch(PDO::FETCH_ASSOC);
|
$res = App::DB()->query("SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM `" . $this->_tableName_ . "` WHERE `moderate` = 1")->fetch(PDO::FETCH_ASSOC);
|
||||||
$offset = $res['offset'];
|
$offset = $res['offset'];
|
||||||
|
|
||||||
$res = App::DB()->query('SELECT `id` FROM ' . $this->_tableName_ . ' LIMIT ' . $offset . ',1;')->fetch(PDO::FETCH_ASSOC);
|
$res = App::DB()->query('SELECT `id` FROM ' . $this->_tableName_ . ' WHERE `moderate` = 1 LIMIT ' . $offset . ',1;')->fetch(PDO::FETCH_ASSOC);
|
||||||
$pointId = $res['id'];
|
$pointId = $res['id'];
|
||||||
|
|
||||||
return $this->getByPK($pointId);
|
return $this->getByPK($pointId);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue