Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MHd201509t2::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['hd201509t2_id' => $this->hd201509t2_id, 'create_time' => $this->create_time, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'gh_id', $this->gh_id])->andFilterWhere(['like', 'openid', $this->openid])->andFilterWhere(['like', 'mobile', $this->mobile]);
     return $dataProvider;
 }
Beispiel #2
0
 public function actionHd201509t2()
 {
     $this->layout = false;
     $gh_id = U::getSessionParam('gh_id');
     $openid = U::getSessionParam('openid');
     $wx_user = \app\models\MUser::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($wx_user) || $wx_user->subscribe === 0) {
         return $this->render('need_subscribe');
     }
     $bindMobiles = \app\models\OpenidBindMobile::findOne(['gh_id' => $gh_id, 'openid' => $openid]);
     if (empty($bindMobiles)) {
         $url = \yii\helpers\Url::to();
         \Yii::$app->getSession()->set('RETURN_URL', $url);
         return $this->redirect(['wap/addbindmobile', 'gh_id' => $gh_id, 'openid' => $openid]);
     }
     $hd201509t1 = \app\models\MHd201509t1::findOne(['mobile' => $bindMobiles->mobile]);
     if (empty($hd201509t1)) {
         //不在能充值的用户表中, 不符合充值条件,显示对不起页面
         return $this->render('hd201509t2_1');
     }
     $hd201509t2 = \app\models\MHd201509t2::findOne(['mobile' => $hd201509t1->mobile]);
     if (empty($hd201509t2)) {
         $hd201509t2 = new \app\models\MHd201509t2();
         $hd201509t2->gh_id = $gh_id;
         $hd201509t2->openid = $openid;
         $hd201509t2->mobile = $bindMobiles->mobile;
         $hd201509t2->status = 0;
         $hd201509t2->yfzx = $hd201509t1->yfzx;
         $hd201509t2->fsc = $hd201509t1->fsc;
         $hd201509t2->save(false);
     }
     return $this->render('hd201509t2', ['observer' => $wx_user, 'hd201509t2' => $hd201509t2]);
 }
Beispiel #3
0
 /**
  * Finds the MHd201509t2 model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return MHd201509t2 the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = MHd201509t2::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #4
0
    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

<!--
    <p>
        <//?= Html::a('Create Mhd201509t2', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
-->
    <p>
    <?php 
echo Html::a('下载 <i class="glyphicon glyphicon-arrow-down"></i>', U::current(['download' => 1]), ['class' => 'btn btn-success', 'data-pjax' => '0']);
?>
    </p>
    
    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['label' => '微信昵称', 'format' => 'html', 'value' => function ($model, $key, $index, $column) {
    $user = $model->user;
    return empty($user) ? '' : "<img width=48 src=" . $model->user->headimgurl . "><br>" . emoji_unified_to_html(emoji_softbank_to_unified($user->nickname));
}, 'filter' => false, 'headerOptions' => array('style' => 'width:90px;')], 'mobile', 'yfzx', 'fsc', 'create_time', ['attribute' => 'status', 'label' => '状态', 'value' => function ($model, $key, $index, $column) {
    return MHd201509t2::getHd201509t2StatusOption($model->status);
}, 'filter' => MHd201509t2::getHd201509t2StatusOption(), 'headerOptions' => array('style' => 'width:120px;')]]]);
?>

</div>