@@ -30,7 +30,7 @@ |
||
| 30 | 30 | 'location' => $this->string()->comment('Location'), |
| 31 | 31 | 'address' => $this->string()->comment('Address'), |
| 32 | 32 | 'website' => $this->string()->comment('Website'), |
| 33 | - 'timezone' => $this->string(100)->comment('Timezone'),//默认格林威治时间 |
|
| 33 | + 'timezone' => $this->string(100)->comment('Timezone'), //默认格林威治时间 |
|
| 34 | 34 | 'birthday' => $this->string(15)->comment('Birthday'), |
| 35 | 35 | 'current' => $this->smallInteger(1)->comment('Current'), |
| 36 | 36 | 'qq' => $this->string(11)->comment('QQ'), |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | /** @var ActiveRecord $class */ |
| 44 | 44 | $class = $this->modelClass; |
| 45 | - $class::create($this->attributes,$this->runValidation); |
|
| 45 | + $class::create($this->attributes, $this->runValidation); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | if ($app->hasModule('user') && ($module = $app->getModule('user')) instanceof Module) { |
| 31 | 31 | //监听用户活动时间 |
| 32 | 32 | /** @var \yii\web\UserEvent $event */ |
| 33 | - $app->on(Application::EVENT_AFTER_REQUEST, function ($event) use ($app) { |
|
| 33 | + $app->on(Application::EVENT_AFTER_REQUEST, function($event) use ($app) { |
|
| 34 | 34 | if (!$app->user->isGuest && Yii::$app->has('queue')) { |
| 35 | 35 | $user = UserExtra::findOne(['user_id' => $app->user->id]); |
| 36 | 36 | $user->updateAttributesAsync(['last_visit' => time()]); |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | //监听用户登录事件 |
| 41 | 41 | /** @var \yii\web\UserEvent $event */ |
| 42 | - $app->user->on(User::EVENT_AFTER_LOGIN, function ($event) use ($app) { |
|
| 42 | + $app->user->on(User::EVENT_AFTER_LOGIN, function($event) use ($app) { |
|
| 43 | 43 | //记录最后登录时间记录最后登录IP记录登录次数 |
| 44 | 44 | $user = UserExtra::findOne(['user_id' => $app->user->id]); |
| 45 | 45 | $user->updateAttributesAsync(['login_at' => time(), 'login_ip' => Yii::$app->request->userIP]); |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | return parent::one($db); |
| 60 | 60 | } |
| 61 | -<?php if(isset($labels['created_at'])): ?> |
|
| 61 | +<?php if (isset($labels['created_at'])): ?> |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * 热门模型 |
@@ -36,9 +36,12 @@ discard block |
||
| 36 | 36 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 37 | 37 | <?php if (!empty($generator->searchModelClass)): ?> |
| 38 | 38 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 39 | -<?php else: ?> |
|
| 39 | +<?php else { |
|
| 40 | + : ?> |
|
| 40 | 41 | use yii\data\ActiveDataProvider; |
| 41 | -<?php endif; ?> |
|
| 42 | +<?php endif; |
|
| 43 | +} |
|
| 44 | +?> |
|
| 42 | 45 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
| 43 | 46 | use yuncms\web\Response; |
| 44 | 47 | |
@@ -77,7 +80,8 @@ discard block |
||
| 77 | 80 | 'searchModel' => $searchModel, |
| 78 | 81 | 'dataProvider' => $dataProvider, |
| 79 | 82 | ]); |
| 80 | -<?php else: ?> |
|
| 83 | +<?php else { |
|
| 84 | + : ?> |
|
| 81 | 85 | $dataProvider = new ActiveDataProvider([ |
| 82 | 86 | 'query' => <?= $modelClass ?>::find(), |
| 83 | 87 | ]); |
@@ -85,7 +89,9 @@ discard block |
||
| 85 | 89 | return $this->render('index', [ |
| 86 | 90 | 'dataProvider' => $dataProvider, |
| 87 | 91 | ]); |
| 88 | -<?php endif; ?> |
|
| 92 | +<?php endif; |
|
| 93 | +} |
|
| 94 | +?> |
|
| 89 | 95 | } |
| 90 | 96 | |
| 91 | 97 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | use <?= ltrim($generator->modelClass, '\\') ?>; |
| 34 | 34 | <?php if (!empty($generator->searchModelClass)): ?> |
| 35 | 35 | use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; |
| 36 | -<?php else: ?> |
|
| 36 | +<?php else : ?> |
|
| 37 | 37 | use yii\data\ActiveDataProvider; |
| 38 | 38 | <?php endif; ?> |
| 39 | 39 | use <?= ltrim($generator->baseControllerClass, '\\') ?>; |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'searchModel' => $searchModel, |
| 75 | 75 | 'dataProvider' => $dataProvider, |
| 76 | 76 | ]); |
| 77 | -<?php else: ?> |
|
| 77 | +<?php else : ?> |
|
| 78 | 78 | $dataProvider = new ActiveDataProvider([ |
| 79 | 79 | 'query' => <?= $modelClass ?>::find(), |
| 80 | 80 | ]); |
@@ -113,7 +113,8 @@ discard block |
||
| 113 | 113 | ], |
| 114 | 114 | ]); ?> |
| 115 | 115 | <?= "<?php " ?>Box::end(); ?> |
| 116 | - <?php else: ?> |
|
| 116 | + <?php else { |
|
| 117 | + : ?> |
|
| 117 | 118 | <?= "<?= " ?>ListView::widget([ |
| 118 | 119 | 'dataProvider' => $dataProvider, |
| 119 | 120 | 'layout' => "{items}\n{summary}\n{pager}", |
@@ -122,7 +123,9 @@ discard block |
||
| 122 | 123 | return Html::a(Html::encode($model-><?= $nameAttribute ?>), ['view', <?= $urlParams ?>]); |
| 123 | 124 | }, |
| 124 | 125 | ]) ?> |
| 125 | - <?php endif; ?><?= $generator->enablePjax ? '<?php Pjax::end(); ?>' : '' ?> |
|
| 126 | + <?php endif; |
|
| 127 | +} |
|
| 128 | +?><?= $generator->enablePjax ? '<?php Pjax::end(); ?>' : '' ?> |
|
| 126 | 129 | |
| 127 | 130 | </div> |
| 128 | 131 | </div> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | ], |
| 58 | 58 | [ |
| 59 | 59 | 'options' => ['id' => 'batch_deletion', 'class'=>'btn btn-sm btn-danger'], |
| 60 | - 'label' => <?= $generator->generateString('Batch Deletion');?>, |
|
| 60 | + 'label' => <?= $generator->generateString('Batch Deletion'); ?>, |
|
| 61 | 61 | 'url' => 'javascript:void(0);', |
| 62 | 62 | ] |
| 63 | 63 | ]]); ?> |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | <?= "<?= " ?>$this->render('_search', ['model' => $searchModel]); ?> |
| 67 | 67 | </div> |
| 68 | 68 | </div> |
| 69 | -<?php if(!empty($generator->searchModelClass)): ?> |
|
| 69 | +<?php if (!empty($generator->searchModelClass)): ?> |
|
| 70 | 70 | <?= " <?php " . ($generator->indexWidgetType === 'grid' ? "// " : "") ?>echo $this->render('_search', ['model' => $searchModel]); ?> |
| 71 | 71 | <?php endif; ?> |
| 72 | 72 | <?= "<?= " ?>GridView::widget([ |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /* @var $this yii\web\View */ |
| 20 | 20 | /* @var $model <?= ltrim($generator->modelClass, '\\') ?> */ |
| 21 | 21 | |
| 22 | -$this->title = <?= $generator->generateString('Update '.Inflector::camel2words(StringHelper::basename($generator->modelClass)))?> . ': ' . $model-><?= $generator->getNameAttribute() ?>; |
|
| 22 | +$this->title = <?= $generator->generateString('Update ' . Inflector::camel2words(StringHelper::basename($generator->modelClass)))?> . ': ' . $model-><?= $generator->getNameAttribute() ?>; |
|
| 23 | 23 | $this->params['breadcrumbs'][] = ['label' => <?= $generator->generateString('Manage ' . Inflector::camel2words(StringHelper::basename($generator->modelClass))) ?>, 'url' => ['index']]; |
| 24 | 24 | $this->params['breadcrumbs'][] = ['label' => $model-><?= $generator->getNameAttribute() ?>, 'url' => ['view', <?= $urlParams ?>]]; |
| 25 | 25 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | public function actionDelete($id) |
| 84 | 84 | { |
| 85 | 85 | $this->findModel($id)->delete(); |
| 86 | - Yii::$app->getSession()->setFlash('success', Yii::t('yuncms','Delete success.')); |
|
| 86 | + Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Delete success.')); |
|
| 87 | 87 | return $this->redirect(['index']); |
| 88 | 88 | } |
| 89 | 89 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | if (($model = Attachment::findOne($id)) !== null) { |
| 120 | 120 | return $model; |
| 121 | 121 | } else { |
| 122 | - throw new NotFoundHttpException (Yii::t('yuncms', 'The requested page does not exist.')); |
|
| 122 | + throw new NotFoundHttpException(Yii::t('yuncms', 'The requested page does not exist.')); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | { |
| 82 | 82 | if ($this->validate()) { |
| 83 | 83 | $user = $this->getUser(); |
| 84 | - if(AvatarHelper::save($user, $this->getOriginalImage())){ |
|
| 84 | + if (AvatarHelper::save($user, $this->getOriginalImage())) { |
|
| 85 | 85 | return true; |
| 86 | 86 | } else { |
| 87 | 87 | return false; |