public function actionGetServer() { $out = []; if (isset($_POST['depdrop_parents'])) { $parents = $_POST['depdrop_parents']; if ($parents != null) { $cat_id = $parents[0]; $gameServer = GameServer::find()->statusInUse()->andFilterWhere(['game_id' => $cat_id])->all(); foreach ($gameServer as $gs) { $data = null; $data['id'] = $gs->id; $data['name'] = $gs->server_name; array_push($out, $data); } //myVarDump($out); // the getSubCatList function will query the database based on the // cat_id and return an array like below: // [ // ['id'=>'<sub-cat-id-1>', 'name'=>'<sub-cat-name1>'], // ['id'=>'<sub-cat_id_2>', 'name'=>'<sub-cat-name2>'] // ] echo Json::encode(['output' => $out, 'selected' => '']); return; } } echo Json::encode(['output' => '', 'selected' => '']); }
/** * Updates an existing GameGift 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); $servers = GameServer::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, 'servers' => $servers]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = GameServer::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'server_id' => $this->server_id, 'game_id' => $this->game_id, 'start_time' => $this->start_time, 'is_new' => $this->is_new, 'is_hot' => $this->is_hot, 'is_recommend' => $this->is_recommend, 'is_shutdown' => $this->is_shutdown, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'status' => $this->status]); $query->andFilterWhere(['like', 'server_name', $this->server_name])->andFilterWhere(['like', 'server_key', $this->server_key])->andFilterWhere(['like', 'slug', $this->slug]); return $dataProvider; }
<?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?php if (Yii::$app->user->can('administrator')) { ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Kefu Selfservice')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php } ?> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'sn', ['attribute' => 'game_server', 'value' => function ($model) { return \common\models\GameServer::findOne($model->game_server)['server_name']; }, 'filter' => ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name')], 'game_role', ['attribute' => 'category_id', 'value' => function ($model) { return $model->category ? $model->category->title : null; }, 'filter' => ArrayHelper::map(\common\models\KefuSelfserviceCat::find()->all(), 'id', 'title')], 'created_at:datetime', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => KefuSelfservice::getStatus()], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view} {update} {result} {delete}', 'buttons' => ['result' => function ($url, $model, $key) { if ($model->status == KefuSelfservice::STATUS_YICHULI) { return ""; } return Html::a('<span class="glyphicon glyphicon-check"></span>', ['/kefu-selfservice/result', 'id' => $model->id], ['title' => Yii::t('common', 'check'), 'id' => 'check' . $model->id]); }]]]]); ?> </div>
<div class="headline"><h3>基本申请资料</h3></div> <?php $form = ActiveForm::begin(); ?> <?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'); ?> <?php echo $form->field($model, 'recent_games')->dropDownList(ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name'), ['prompt' => '请选择游戏']); ?> <?php echo $form->field($model, 'question_desc')->textarea(); ?> <div class="form-group"> <?php echo Html::submitButton('下一步', ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> </div> </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>
public static function getStatusInUseGameServer() { return GameServer::find()->where(['status' => GameServer::STATUS_IN_USE])->orderBy('updated_at DESC')->all(); }
echo $form->field($model, 'is_new')->checkbox(); ?> <?php echo $form->field($model, 'is_hot')->checkbox(); ?> <?php echo $form->field($model, 'is_recommend')->checkbox(); ?> <?php echo $form->field($model, 'is_shutdown')->checkbox(); ?> <?php echo $form->field($model, 'status')->dropDownList(GameServer::getStatus()); ?> <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> <?php ActiveForm::end(); ?> </div>
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"> <?php echo Html::submitButton('确认提交', ['class' => 'btn btn-success']); ?> <?php
</div> </div> <div class="row"> <div class="col-md-12"> <div class="tag-box tag-box-v3"> <div class="headline"><h3><?php echo $this->title; ?> </h3></div> <?php $attachmentsImags = ''; foreach ($model->attachments as $ss) { $attachmentsImags .= Html::img(Yii::$app->glide->createSignedUrl(['glide/index', 'path' => $ss['path'], 'w' => 200], true), ['class' => 'img-responsive']); } ?> <?php echo DetailView::widget(['model' => $model, 'attributes' => [['attribute' => 'category_id', 'value' => \common\models\KefuSelfserviceCat::findOne($model->category_id)['title']], 'sn', 'game_role', ['attribute' => 'game_server', 'value' => \common\models\GameServer::findOne($model->game_server)['server_name']], ['attribute' => 'attachments', 'format' => 'html', 'value' => $attachmentsImags], 'content:html', 'created_at:datetime', ['attribute' => 'status', 'value' => ArrayHelper::getValue(KefuSelfservice::getStatus(), $model->status)], ['attribute' => 'result', 'format' => 'html', 'headerOptions' => ['width' => '500px']]]]); ?> </div> </div> </div> </div> <?php $js = <<<JS \$('.jie-guo').addClass('active'); JS; $this->registerJs($js);
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\widgets\DetailView; use common\models\GameServer; /* @var $this yii\web\View */ /* @var $model common\models\GameServer */ $this->title = $model->server_name; $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Game Server'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; ?> <div class="game-server-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' => ['server_id', 'server_name', ['attribute' => 'game_id', 'value' => $model->game->name], 'server_key', 'start_time:datetime', 'slug', ['attribute' => 'is_shutdown', 'value' => GameServer::IS_SHUT_DOWN_YES == $model->is_shutdown ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_recommend', 'value' => GameServer::IS_RECOMMEND_YES == $model->is_recommend ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_hot', 'value' => GameServer::IS_HOT_YES == $model->is_hot ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], ['attribute' => 'is_new', 'value' => GameServer::IS_NEW_YES == $model->is_new ? Yii::t('common', 'Yes') : Yii::t('common', 'Not')], 'created_at:datetime', 'updated_at:datetime', ['attribute' => 'status', 'value' => ArrayHelper::getValue(GameServer::getStatus(), $model->status)]]]); ?> </div>
?> <?php echo $form->errorSummary($model); ?> <?php echo $form->field($model, 'category_id')->dropDownList(ArrayHelper::map($categories, 'id', 'title')); ?> <?php echo $form->field($model, 'game_role')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'game_server')->dropDownList(ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name'), ['prompt' => Yii::t('common', '')]); ?> <?php echo $form->field($model, 'email')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'phone')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'attachments')->widget(\trntv\filekit\widget\Upload::className(), ['url' => ['/file-storage/upload'], 'sortable' => true, 'maxFileSize' => 10000000, 'maxNumberOfFiles' => 5]); ?> <?php
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\UserHistorySearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'User History'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="user-history-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <?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()->all(), 'id', 'name')], ['attribute' => 'server_id', 'value' => function ($model) { return $model->server->server_name; }, 'filter' => ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name')], 'created_at:datetime', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => \common\models\UserHistory::getStatus()], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{view}{delete}']]]); ?> </div>
public function getGameServer() { return $this->hasOne(GameServer::className(), ['id' => 'game_server']); }
use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\grid\GridView; use common\models\GameGift; /* @var $this yii\web\View */ /* @var $searchModel backend\models\search\GameGiftSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = Yii::t('common', 'Game Gift'); $this->params['breadcrumbs'][] = $this->title; ?> <div class="game-gift-index"> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a(Yii::t('backend', 'Create {modelClass}', ['modelClass' => Yii::t('common', 'Game Gift')]), ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'game_server_id', 'value' => function ($model) { return $model->gameServer->server_name; }, 'filter' => ArrayHelper::map(\common\models\GameServer::find()->all(), 'id', 'server_name')], 'lb_gid', 'lb_name', ['class' => \common\grid\EnumColumn::className(), 'attribute' => 'status', 'enum' => GameGift::getStatus()], ['class' => 'yii\\grid\\ActionColumn']], 'layout' => "{items}\n{summary}\n{pager}"]); ?> </div>
<?php /** * Created by PhpStorm. * User: buuug7 * Date: 2016/1/27 * Time: 13:55 * Desc: */ use yii\helpers\Url; $this->title = $model->name; //获得该游戏下的所有服务器 $gameServers = \common\models\GameServer::find()->statusInUse()->where(['game_id' => $model->id])->all(); ?> <div class="content game-view" style="background: url(<?php echo $model->getBgUrl(); ?> ) no-repeat"> <div class="header"><!--头部--> <div class="container"> <div class="row to-top"> <div class="col-md-12"> <div class="nav center"> <a href="#" target="_blank">官网首页</a> <a href="#" target="_blank">新闻资讯</a> <a href="#" target="_blank">视听奖赏</a> <a href="#">游戏下载</a> <a href="#" target="_blank">官方论坛</a> </div> </div>
/** * Finds the GameServer model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return GameServer the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = GameServer::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }