diff --git a/modules/news/api/News.php b/modules/news/api/News.php index b0d8e1c..e195106 100644 --- a/modules/news/api/News.php +++ b/modules/news/api/News.php @@ -55,7 +55,7 @@ public function api_last($limit = 1) public function api_get($id) { - if(!($news = NewsModel::findOne(['news_id' => $id, 'status' => NewsModel::STATUS_ON]))){ + if(!($news = NewsModel::find()->where(['or', 'news_id=:id_slug', 'slug=:id_slug'], [':id_slug' => $id])->andWhere(['and', 'status=:st'], [':st' => NewsModel::STATUS_ON])->one())){ return $this->notFound(); } @@ -138,4 +138,4 @@ private function notFound() return $this->createObject($this->errorText('WRONG NEWS_ID')); } } -} \ No newline at end of file +}