/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MQingshiScore::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['score_id' => $this->score_id, 'author_openid' => $this->author_openid, 'score' => $this->score, 'status' => $this->status]); return $dataProvider; }
<div id='tppm' class='modal'> <header class="bar bar-nav"> <a class="icon icon-close pull-right" href="#tppm"></a> <h1 class='title'>投票排名</h1> </header> <div class="content"> <?php // $votes = \app\models\MQingshiVote::find() // ->groupBy(['author_openid']) // ->all(); $top = 0; //$votes = \app\models\MQingshiVote::find()->select('*, count(*) as c')->groupBy(['author_openid'])->orderBy('c DESC')->limit(50)->all(); //至少获得10票 才能上榜 $votes = \app\models\MQingshiScore::find()->where(['>', 'score', 9])->orderBy(['score' => SORT_DESC, 'create_time' => SORT_ASC])->limit(50)->all(); ?> <ul class="table-view"> <li class="table-view-cell media"> <div class="media-body"> 名次 </div> <span class="badge" style="font-size: 12pt"> 所得票数 </span> </li> <?php