public function actionIndex() { foreach (PendingNews::find()->where("id <= 4293")->each() as $pn) { if ($pn->search_content) { $mq = new RabbitMQComponent(); $mq->postMessage("compile", "compile", json_encode(["pn_id" => $pn->id])); } } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = PendingNews::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if ($this->load($params) && !$this->validate()) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'source_id' => $this->source_id, 'pq_id' => $this->pq_id, 'processed' => $this->processed, 'created_at' => $this->created_at, 'update_at' => $this->update_at]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'search_content', $this->search_content])->andFilterWhere(['like', 'thumb_src', $this->thumb_src])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'group_hash', $this->group_hash]); return $dataProvider; }