Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Recharge::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'game_id' => $this->game_id, 'server_id' => $this->server_id, 'amount' => $this->amount, 'created_at' => $this->created_at, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'role_id', $this->role_id])->andFilterWhere(['like', 'order_id', $this->order_id]);
     return $dataProvider;
 }
Beispiel #2
0
 /**
  * Finds the Recharge model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Recharge the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Recharge::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\models\search\RechargeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common', 'Recharge');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="recharge-index">

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

	<p>
		<?php 
echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => '充值']), ['create'], ['class' => 'btn btn-success btn-flat']);
?>
	</p>

	<?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'user_id', 'value' => function ($model) {
    return $model->user->username;
}], ['attribute' => 'game_id', 'value' => function ($model) {
    return $model->game->name;
}, 'filter' => ArrayHelper::map(\common\models\Game::find()->statusInUse()->all(), 'id', 'name')], ['attribute' => 'server_id', 'value' => function ($model) {
    return $model->server->server_name;
}, 'filter' => ArrayHelper::map(\common\models\GameServer::find()->statusInUse()->all(), 'id', 'server_name')], 'amount', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => \common\models\Recharge::getStatus()], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Beispiel #4
0
?>

			<?php 
echo $form->field($model, 'user_id')->textInput(['value' => Yii::$app->user->identity->username, 'readonly' => 'readonly']);
?>

			<?php 
echo $form->field($model, 'game_id')->dropDownList(ArrayHelper::map(\common\models\Game::find()->statusInUse()->all(), 'id', 'name'), ['prompt' => '']);
?>

			<?php 
echo $form->field($model, 'server_id')->dropDownList(ArrayHelper::map(\common\models\GameServer::find()->statusInUse()->all(), 'id', 'server_name'), ['prompt' => '']);
?>

			<?php 
echo $form->field($model, 'pay_mode')->dropDownList(Recharge::getPayMode(), ['prompt' => '']);
?>

			<?php 
echo $form->field($model, 'amount')->textInput(['maxlength' => true]);
?>

			<div class="form-group text-center">
				<?php 
echo Html::submitButton('确认提交', ['class' => 'btn btn-success']);
?>
				<?php 
echo Html::submitButton('取消', ['class' => 'btn btn-success']);
?>
			</div>