/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MZhongqiuScore::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['score_id' => $this->score_id, 'score' => $this->score, 'create_time' => $this->create_time, 'status' => $this->status]); $query->andFilterWhere(['like', 'author_openid', $this->author_openid]); return $dataProvider; }
->limit(50) ->all(); */ /* foreach ($votes as $vote) { $top_num ++; if($vote->author_openid == $zhongqiu_score->author_openid) break; } */ $top_num = 0; $top = 0; //至少获得10票 才能上榜 $votes = \app\models\MZhongqiuScore::find()->where(['>', 'score', 499])->orderBy(['score' => SORT_DESC, 'create_time' => SORT_ASC])->limit(50)->all(); foreach ($votes as $vote) { $top_num++; if ($vote->author_openid == $zhongqiu_score->author_openid) { break; } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>襄阳联通中秋抢iPhone6s活动</title>