/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = MZhongqiuVote::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['qingshi_vote_id' => $this->qingshi_vote_id, 'vote_score' => $this->vote_score, 'vote_time' => $this->vote_time]); $query->andFilterWhere(['like', 'author_openid', $this->author_openid])->andFilterWhere(['like', 'vote_openid', $this->vote_openid]); return $dataProvider; }
<br> <p align="center"> <a class="btn btn-block" href="#tppm" style="width: 300px" >返回</a> </p> </div> </div> <div id='tp_friends' class='modal'> <header class="bar bar-nav"> <a class="icon icon-close pull-right" href="#tp_friends"></a> <h1 class='title'>帮忙拆红包的好友</h1> </header> <div class="content"> <?php $tp_friends = \app\models\MZhongqiuVote::find()->where(['author_openid' => $zhongqiu_score->author_openid])->orderBy(['vote_time' => SORT_DESC])->all(); $vote_cnt = 0; ?> <ul class="table-view"> <li class='table-view-cell'> </li> <?php foreach ($tp_friends as $tp_friend) { $vote_cnt++; if ($vote_cnt > 20) { break; } $friend = \app\models\MUser::findOne(['openid' => $tp_friend->vote_openid]); ?>
/** * Finds the MZhongqiuVote model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return MZhongqiuVote the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = MZhongqiuVote::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }