Completed
Push — master ( 44cd18...b3317a )
by Xu
539:41 queued 499:39
created
src/user/Bootstrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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]);
Please login to merge, or discard this patch.
src/gii/generators/model/model.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
 use Yii;
22 22
 use <?= $generator->baseClass?>;
23 23
 use yii\db\Connection;
24
-<?php if(isset($labels['slug']) || isset($labels['uuid'])): ?>
24
+<?php if (isset($labels['slug']) || isset($labels['uuid'])): ?>
25 25
 use yii\helpers\Inflector;
26 26
 <?php endif; ?>
27 27
 
28 28
 use yii\caching\DbDependency;
29 29
 use yii\caching\ChainedDependency;
30
-<?php if(isset($labels['created_at'])): ?>
30
+<?php if (isset($labels['created_at'])): ?>
31 31
 use yii\behaviors\TimestampBehavior;
32 32
 <?php endif; ?>
33
-<?php if(isset($labels['user_id'])): ?>
33
+<?php if (isset($labels['user_id'])): ?>
34 34
 use yii\behaviors\BlameableBehavior;
35 35
 <?php endif; ?>
36
-<?php if(isset($labels['slug']) || isset($labels['uuid'])): ?>
36
+<?php if (isset($labels['slug']) || isset($labels['uuid'])): ?>
37 37
 use yii\behaviors\AttributeBehavior;
38 38
 <?php endif; ?>
39 39
 use yuncms\helpers\DateHelper;
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 <?php endif; ?>
54 54
  *
55 55
  * @property-read boolean $isAuthor 是否是作者
56
-<?php if(isset($labels['status'])): ?>
56
+<?php if (isset($labels['status'])): ?>
57 57
  * @property-read boolean $isDraft 是否草稿
58 58
  * @property-read boolean $isPublished 是否发布
59 59
 <?php endif; ?>
60 60
  */
61
-class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') ?><?php if(isset($labels['status'])): ?> implements ScanInterface<?php endif; ?>
61
+class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') ?><?php if (isset($labels['status'])): ?> implements ScanInterface<?php endif; ?>
62 62
 {
63 63
 
64 64
     //场景定义
65 65
     const SCENARIO_CREATE = 'create';//创建
66 66
     const SCENARIO_UPDATE = 'update';//更新
67
-<?php if(isset($labels['status'])): ?>
67
+<?php if (isset($labels['status'])): ?>
68 68
     //状态定义
69 69
     const STATUS_DRAFT = 0b0;//草稿
70 70
     const STATUS_REVIEW = 0b1;//待审核
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $behaviors['timestamp'] = [
98 98
             'class' => TimestampBehavior::className()
99 99
         ];
100
-<?php elseif(isset($labels['created_at'])): ?>
100
+<?php elseif (isset($labels['created_at'])): ?>
101 101
         $behaviors['timestamp'] = [
102 102
             'class' => TimestampBehavior::className(),
103 103
             'attributes' => [
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
             ],
106 106
         ];
107 107
 <?php endif; ?>
108
-<?php if(isset($labels['user_id'])): ?>
108
+<?php if (isset($labels['user_id'])): ?>
109 109
         $behaviors['user'] = [
110 110
             'class' => BlameableBehavior::className(),
111 111
             'attributes' => [
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             ],
114 114
         ];
115 115
 <?php endif; ?>
116
-<?php if(isset($labels['slug'])): ?>
116
+<?php if (isset($labels['slug'])): ?>
117 117
         $behaviors['slug'] = [
118 118
             'class' => AttributeBehavior::className(),
119 119
             'attributes' => [
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
             }
125 125
         ];
126 126
 <?php endif; ?>
127
-<?php if(isset($labels['uuid'])): ?>
127
+<?php if (isset($labels['uuid'])): ?>
128 128
         $behaviors['uuid'] = [
129 129
             'class' => AttributeBehavior::className(),
130 130
             'attributes' => [
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function rules()
168 168
     {
169
-        return [<?= "\n            " . implode(",\n            ", $rules) . ",\n        " ?>    <?php if(isset($labels['status'])): ?>// status rule
169
+        return [<?= "\n            " . implode(",\n            ", $rules) . ",\n        " ?>    <?php if (isset($labels['status'])): ?>// status rule
170 170
             ['status', 'default', 'value' => self::STATUS_REVIEW],
171 171
             ['status', 'in', 'range' => [self::STATUS_DRAFT, self::STATUS_REVIEW, self::STATUS_REJECTED, self::STATUS_PUBLISHED]],<?php endif; ?>
172 172
         ];
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     {
216 216
         return $this->user_id == Yii::$app->user->id;
217 217
     }
218
-<?php if(isset($labels['status'])): ?>
218
+<?php if (isset($labels['status'])): ?>
219 219
     /**
220 220
      * 是否草稿状态
221 221
      * @return bool
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
         ]));
397 397
         return $total;
398 398
     }
399
-<?php if(isset($labels['created_at'])): ?>
399
+<?php if (isset($labels['created_at'])): ?>
400 400
 
401 401
     /**
402 402
      * 获取模型今日新增总数
Please login to merge, or discard this patch.
src/gii/generators/model/query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
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
      * 热门模型
Please login to merge, or discard this patch.
src/gii/generators/crud/controller.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
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
 use yii\data\ActiveDataProvider;
41 41
 <?php endif; ?>
42 42
 use <?= ltrim($generator->baseControllerClass, '\\') ?>;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             'searchModel' => $searchModel,
78 78
             'dataProvider' => $dataProvider,
79 79
         ]);
80
-<?php else: ?>
80
+<?php else : ?>
81 81
         $dataProvider = new ActiveDataProvider([
82 82
             'query' => <?= $modelClass ?>::find(),
83 83
         ]);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return ActiveForm::validate($model);
115 115
         }
116 116
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
117
-            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Create success.');?>);
117
+            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Create success.'); ?>);
118 118
             return $this->redirect(['view', <?= $urlParams ?>]);
119 119
         } else {
120 120
             return $this->render('create', [
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
             return ActiveForm::validate($model);
138 138
         }
139 139
         if ($model->load(Yii::$app->request->post()) && $model->save()) {
140
-            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Update success.');?>);
140
+            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Update success.'); ?>);
141 141
             return $this->redirect(['view', <?= $urlParams ?>]);
142 142
         } else {
143 143
             return $this->render('update', [
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     public function actionDelete(<?= $actionParams ?>)
156 156
     {
157 157
         $this->findModel(<?= $actionParams ?>)->delete();
158
-        Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete success.');?>);
158
+        Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete success.'); ?>);
159 159
         return $this->redirect(['index']);
160 160
     }
161 161
      /**
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                 $model = $this->findModel($id);
171 171
                 $model->delete();
172 172
             }
173
-            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete success.');?>);
173
+            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete success.'); ?>);
174 174
         } else {
175
-            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete failed.');?>);
175
+            Yii::$app->getSession()->setFlash('success', <?= $generator->generateString('Delete failed.'); ?>);
176 176
         }
177 177
         return $this->redirect(['index']);
178 178
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,9 +36,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/gii/generators/crud/views/_search.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 }
37 37
 ?>
38 38
     <div class="form-group">
39
-        <?= "<?= " ?>Html::submitButton(<?= $generator->generateString('Search');?>, ['class' => 'btn btn-primary']) ?>
40
-        <?= "<?= " ?>Html::resetButton(<?= $generator->generateString('Reset');?>, ['class' => 'btn btn-default']) ?>
39
+        <?= "<?= " ?>Html::submitButton(<?= $generator->generateString('Search'); ?>, ['class' => 'btn btn-primary']) ?>
40
+        <?= "<?= " ?>Html::resetButton(<?= $generator->generateString('Reset'); ?>, ['class' => 'btn btn-default']) ?>
41 41
     </div>
42 42
 
43 43
     <?= "<?php " ?>ActiveForm::end(); ?>
Please login to merge, or discard this patch.
src/gii/generators/crud/views/_form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 
34 34
 <div class="form-group">
35 35
     <div class="col-sm-4 col-sm-offset-2">
36
-        <?= "<?= " ?>Html::submitButton($model->isNewRecord ? <?= $generator->generateString('Create');?> : <?= $generator->generateString('Update');?>, ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
36
+        <?= "<?= " ?>Html::submitButton($model->isNewRecord ? <?= $generator->generateString('Create'); ?> : <?= $generator->generateString('Update'); ?>, ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
37 37
     </div>
38 38
 </div>
39 39
 
Please login to merge, or discard this patch.
src/gii/generators/crud/views/index.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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([
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 ?>
103 103
                     [
104 104
                         'class' => 'yii\grid\ActionColumn',
105
-                        'header' => <?= $generator->generateString('Operation');?>,
105
+                        'header' => <?= $generator->generateString('Operation'); ?>,
106 106
                         'template' => '{view} {update} {delete}',
107 107
                         //'buttons' => [
108 108
                         //    'update' => function ($url, $model, $key) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,7 +113,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
src/gii/generators/crud/views/update.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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');
Please login to merge, or discard this patch.
src/payment/migrations/m180315_104011_create_trade_charges_table.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -22,29 +22,29 @@
 block discarded – undo
22 22
 
23 23
         $this->createTable($this->tableName, [
24 24
             'id' => $this->bigPrimaryKey(),
25
-            'paid' => $this->boolean()->defaultValue(false),//boolean 是否已付款
26
-            'refunded' => $this->boolean()->defaultValue(false),//boolean 是否存在退款信息
27
-            'reversed' => $this->boolean()->defaultValue(false),//boolean 订单是否撤销
28
-            'channel' => $this->string(50)->notNull(),//付款渠道
29
-            'order_no' => $this->string()->notNull(),//商户订单号,适配每个渠道对此参数的要求,必须在商户的系统内唯一
30
-            'client_ip' => $this->ipAddress()->notNull(),//发起支付请求客户端的 IP 地址
31
-            'amount' => $this->unsignedInteger()->notNull(),//订单总金额(必须大于 0),单位为对应币种的最小货币单位,人民币为分
32
-            'amount_settle' => $this->unsignedInteger()->notNull(),//清算金额,单位为对应币种的最小货币单位,人民币为分。
33
-            'currency' => $this->string(3)->notNull(),//3 位 ISO 货币代码,人民币为  cny 。
34
-            'subject' => $this->string(32)->notNull(),//商品标题,该参数最长为 32 个 Unicode 字符
35
-            'body' => $this->string(128)->notNull(),//商品描述信息,该参数最长为 128 个 Unicode 字符
25
+            'paid' => $this->boolean()->defaultValue(false), //boolean 是否已付款
26
+            'refunded' => $this->boolean()->defaultValue(false), //boolean 是否存在退款信息
27
+            'reversed' => $this->boolean()->defaultValue(false), //boolean 订单是否撤销
28
+            'channel' => $this->string(50)->notNull(), //付款渠道
29
+            'order_no' => $this->string()->notNull(), //商户订单号,适配每个渠道对此参数的要求,必须在商户的系统内唯一
30
+            'client_ip' => $this->ipAddress()->notNull(), //发起支付请求客户端的 IP 地址
31
+            'amount' => $this->unsignedInteger()->notNull(), //订单总金额(必须大于 0),单位为对应币种的最小货币单位,人民币为分
32
+            'amount_settle' => $this->unsignedInteger()->notNull(), //清算金额,单位为对应币种的最小货币单位,人民币为分。
33
+            'currency' => $this->string(3)->notNull(), //3 位 ISO 货币代码,人民币为  cny 。
34
+            'subject' => $this->string(32)->notNull(), //商品标题,该参数最长为 32 个 Unicode 字符
35
+            'body' => $this->string(128)->notNull(), //商品描述信息,该参数最长为 128 个 Unicode 字符
36 36
             //'extra',
37
-            'time_paid' => $this->unixTimestamp(),//订单支付完成时的 Unix 时间戳。(银联支付成功时间为接收异步通知的时间)
38
-            'time_expire' => $this->unixTimestamp(),//订单失效时间
39
-            'time_settle' => $this->unixTimestamp(),//订单清算时间,用 Unix 时间戳表示。(暂不生效)
40
-            'transaction_no' => $this->string(64),//支付渠道返回的交易流水号。
37
+            'time_paid' => $this->unixTimestamp(), //订单支付完成时的 Unix 时间戳。(银联支付成功时间为接收异步通知的时间)
38
+            'time_expire' => $this->unixTimestamp(), //订单失效时间
39
+            'time_settle' => $this->unixTimestamp(), //订单清算时间,用 Unix 时间戳表示。(暂不生效)
40
+            'transaction_no' => $this->string(64), //支付渠道返回的交易流水号。
41 41
             //'refunds',//退款详情列表
42
-            'amount_refunded' => $this->unsignedInteger()->notNull(),//已退款总金额,单位为对应币种的最小货币单位,例如:人民币为分。
43
-            'failure_code' => $this->string(),//订单的错误码
44
-            'failure_msg' => $this->string(),//订单的错误消息的描述。
42
+            'amount_refunded' => $this->unsignedInteger()->notNull(), //已退款总金额,单位为对应币种的最小货币单位,例如:人民币为分。
43
+            'failure_code' => $this->string(), //订单的错误码
44
+            'failure_msg' => $this->string(), //订单的错误消息的描述。
45 45
             'metadata',
46 46
             //'credential',
47
-            'description' => $this->string(255),//订单附加说明,最多 255 个 Unicode 字符。
47
+            'description' => $this->string(255), //订单附加说明,最多 255 个 Unicode 字符。
48 48
             'created_at' => $this->unixTimestamp(),
49 49
         ], $tableOptions);
50 50
     }
Please login to merge, or discard this patch.