/** * Updates an existing GameServer model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $games = Game::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('update', ['model' => $model, 'games' => $games]); } }
public function actionView($slug) { $this->layout = 'singlepage'; $game = Game::findOne(['slug' => $slug]); if (!$game) { throw new NotFoundHttpException('您请求的页面不存在!'); } //myVarDump($game); return $this->render('view', ['model' => $game]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Game::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'category_id' => $this->category_id, 'coin_rate' => $this->coin_rate, 'q' => $this->q, 'attr' => $this->attr, 'is_recommend' => $this->is_recommend, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'api_key', $this->api_key])->andFilterWhere(['like', 'factory', $this->factory])->andFilterWhere(['like', 'cname', $this->cname])->andFilterWhere(['like', 'thumbnail_base_url', $this->thumbnail_base_url])->andFilterWhere(['like', 'thumbnail_path', $this->thumbnail_path])->andFilterWhere(['like', 'coin', $this->coin])->andFilterWhere(['like', 'game_web_url', $this->game_web_url])->andFilterWhere(['like', 'game_bbs_url', $this->game_bbs_url])->andFilterWhere(['like', 'api_secret', $this->api_secret])->andFilterWhere(['like', 'api_server', $this->api_server])->andFilterWhere(['like', 'api_play', $this->api_play])->andFilterWhere(['like', 'api_pay', $this->api_pay])->andFilterWhere(['like', 'api_check', $this->api_check])->andFilterWhere(['like', 'api_order', $this->api_order])->andFilterWhere(['like', 'slug', $this->slug]); return $dataProvider; }
<div class="shop-product-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'relation_game')->dropDownList(\yii\helpers\ArrayHelper::map(\common\models\Game::find()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'category_id')->dropDownList(\yii\helpers\ArrayHelper::map($categories, 'id', 'title'), ['prompt' => '']); ?> <?php echo $form->field($model, 'price')->textInput(['maxlength' => true]); ?> <?php
/** * Finds the Game model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Game the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Game::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
use yii\helpers\ArrayHelper; use yii\grid\GridView; use common\models\IndexSlide; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\IndexSlideSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Index Slide'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="index-slide-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Index Slide')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'game_id', 'value' => function ($model) { return $model->game->name; }, 'filter' => ArrayHelper::map(\common\models\Game::find()->statusInUse()->all(), 'id', 'name')], 'name', 'sort', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => function ($model) { return Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path, 'w' => '600'], true), ['class' => 'img-responsive']); }], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => IndexSlide::getStatus()], ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]); ?> </div>
public static function getActiveGamesByCategorySlug($slug) { $gameCat = GameCategory::find()->where(['slug' => $slug])->one(); if ($gameCat != null) { return Game::find()->where(['status' => Game::STATUS_IN_USE, 'category_id' => $gameCat->id])->all(); } return null; }
/** * @return \yii\db\ActiveQuery */ public function getGame() { return $this->hasOne(Game::className(), ['id' => 'game_id']); }
/** * @return \yii\db\ActiveQuery */ public function getGames() { return $this->hasMany(Game::className(), ['category_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getGame() { if ($this->relation_game_id != null) { return $this->hasOne(Game::className(), ['id' => 'relation_game_id']); } return new Game(); }
/** * Created by PhpStorm. * User: buuug7 * Date: 2016/1/15 * Time: 15:31 * Desc: */ use yii\helpers\Url; use yii\bootstrap\Html; use yii\helpers\ArrayHelper; use common\models\Recharge; use kartik\checkbox\CheckboxX; $this->title = "充值"; $gameList1 = [0 => '请选择游戏...']; $gameList2 = ArrayHelper::map(\common\models\Game::find()->statusInUse()->all(), 'id', 'name'); $gameList = ArrayHelper::merge($gameList1, $gameList2); //(new \common\models\BeeClound(\common\models\BeeClound::CHANNEL_ALI_WEB,'ceshi ',1,[]))->bill(); ?> <?php $this->beginBlock('breadcrumbs'); ?> <div class="breadcrumbs"> <div class="container"> <h1 class="pull-left">充值中心</h1> <ul class="pull-right breadcrumb"> <li><a href="<?php echo Url::to('/site/index'); ?> ">首页</a></li>
use common\models\Game; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\GameSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Games'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="game-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Game')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'category_id', 'value' => function ($model) { return $model->category ? $model->category->title : null; }, 'filter' => ArrayHelper::map(\common\models\GameCategory::find()->all(), 'id', 'title')], 'name', 'short', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => function ($model) { return Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path, 'w' => 150], true), ['class' => 'img-responsive']); }], ['attribute' => 'attr', 'value' => function ($model) { return ArrayHelper::getValue(Game::getAttr(), $model->attr); }, 'filter' => Game::getAttr()], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => [Yii::t('common', 'Not Used'), Yii::t('common', 'In Use')]], ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'is_recommend', 'enum' => [Yii::t('common', 'Not'), Yii::t('common', 'Yes')]], 'sort', ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]); ?> </div>
public function getRelationGame() { return $this->hasOne(Game::className(), ['id' => 'relation_game']); }
use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\grid\GridView; use common\models\GameServer; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\GameServerSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Game Server'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="game-server-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Game Server')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'server_id', 'server_name', ['attribute' => 'game_id', 'value' => function ($model) { return $model->game->name; }, 'filter' => ArrayHelper::map(\common\models\Game::find()->all(), 'id', 'name')], 'start_time:datetime', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => [Yii::t('common', 'Not Used'), Yii::t('common', 'In Use')]], ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]); ?> </div>
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\DetailView; use common\models\Game; /* @var $this yii\web\View */ /* @var $model common\models\Game */ $this->title = $model->name; $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Games'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="game-view"> <p> <?php echo Html::a(Yii::t('backend', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']); ?> <?php echo Html::a(Yii::t('backend', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('backend', 'Are you sure you want to delete this item?'), 'method' => 'post']]); ?> </p> <?php echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'category_id', 'value' => \common\models\GameCategory::find()->where(['id' => $model->category_id])->one()['title']], 'name', 'description:ntext', 'short', 'api_key', 'factory', 'cname', ['attribute' => 'thumbnail', 'format' => 'html', 'value' => Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->thumbnail_path], true), ['class' => 'img-responsive'])], ['attribute' => 'bg_image', 'format' => 'html', 'value' => Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $model->bg_image_path], true), ['class' => 'img-responsive'])], 'coin', 'coin_rate', 'game_web_url:url', 'game_bbs_url:url', 'api_secret', 'api_server', 'api_play', 'api_pay', 'api_check', 'api_order', 'q', ['attribute' => 'attr', 'value' => ArrayHelper::getValue(Game::getAttr(), $model->attr)], ['attribute' => 'is_recommend', 'value' => \common\models\Game::IS_RECOMMEND_YES == $model->is_recommend ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], 'slug', 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => \common\models\Game::STATUS_IN_USE == $model->status ? Yii::t('common', 'In Use') : Yii::t('common', 'Not Used')], 'sort']]); ?> </div>
?> <?php echo $form->field($model, 'api_check'); ?> <?php echo $form->field($model, 'api_order'); ?> <?php echo $form->field($model, 'q'); ?> <?php echo $form->field($model, 'attr')->dropDownList(Game::getAttr()); ?> <?php echo $form->field($model, 'status')->radioList(Game::getStatus()); ?> <?php echo $form->field($model, 'is_recommend')->checkbox(); ?> <?php echo $form->field($model, 'sort'); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
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>
<div class="row"> <div class="col-md-12"> <div class="headline"><h3 class="heading-sm">确认充值信息</h3></div> <?php echo DetailView::widget(['model' => $model, 'attributes' => ['user_id', ['attribute' => 'game_id', 'value' => \common\models\Game::findOne($model->game_id)['name']], ['attribute' => 'server_id', 'value' => \common\models\GameServer::findOne($model->server_id)['server_name']], 'pay_mode', ['attribute' => 'amount', 'value' => $model->amount . '元'], ['attribute' => '获得元宝数量', 'value' => $model->amount * 10 . '元宝']]]); ?> <?php $form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL]); ?> <?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">
/** * find games by rencent_games field * @return \yii\db\ActiveQuery */ public function getRecentGames() { return $this->hasOne(Game::className(), ['id' => 'recent_games']); }
?> <?php echo $form->field($model, 'reason')->dropDownList(KefuAccountRepair::getReason()); ?> <?php echo $form->field($model, 'register_time')->widget(\trntv\yii\datetime\DateTimeWidget::className(), ['phpDatetimeFormat' => 'yyyy-MM-dd', 'clientOptions' => ['locale' => 'zh-CN']]); ?> <?php echo $form->field($model, 'register_place')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'recent_games')->dropDownList(ArrayHelper::map(\common\models\Game::find()->all(), 'id', 'name'), ['prompt' => '']); ?> <?php echo $form->field($model, 'question_desc')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'bind_email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'security_question_one')->dropDownList(ArrayHelper::map(\common\models\SecurityQuestions::find()->all(), 'id', 'question'), ['prompt' => '']); ?> <?php