@@ -24,15 +24,15 @@ |
||
| 24 | 24 | } |
| 25 | 25 | // https://segmentfault.com/q/1010000000672529/a-1020000000679702 |
| 26 | 26 | $this->createTable($this->tableName, [ |
| 27 | - 'id' => $this->char(24)->notNull()->comment('Id'),//通知ID |
|
| 28 | - 'verb' => $this->string(32),//执行了什么操作 |
|
| 29 | - 'template' => $this->string(),//模板 |
|
| 30 | - 'notifiable_id' => $this->unsignedInteger()->notNull()->comment('Entity'),//通知实体ID |
|
| 31 | - 'notifiable_class' => $this->string()->notNull()->comment('Entity'),//通知实体类名 |
|
| 32 | - 'data' => $this->text(),//通知数据 |
|
| 33 | - 'read_at' => $this->unixTimestamp()->comment('Read At'),//阅读时间 |
|
| 34 | - 'created_at' => $this->unixTimestamp()->notNull()->comment('Created At'),//创建时间 |
|
| 35 | - 'updated_at' => $this->integer(10)->unsigned()->notNull()->comment('Updated At'),//更新时间 |
|
| 27 | + 'id' => $this->char(24)->notNull()->comment('Id'), //通知ID |
|
| 28 | + 'verb' => $this->string(32), //执行了什么操作 |
|
| 29 | + 'template' => $this->string(), //模板 |
|
| 30 | + 'notifiable_id' => $this->unsignedInteger()->notNull()->comment('Entity'), //通知实体ID |
|
| 31 | + 'notifiable_class' => $this->string()->notNull()->comment('Entity'), //通知实体类名 |
|
| 32 | + 'data' => $this->text(), //通知数据 |
|
| 33 | + 'read_at' => $this->unixTimestamp()->comment('Read At'), //阅读时间 |
|
| 34 | + 'created_at' => $this->unixTimestamp()->notNull()->comment('Created At'), //创建时间 |
|
| 35 | + 'updated_at' => $this->integer(10)->unsigned()->notNull()->comment('Updated At'), //更新时间 |
|
| 36 | 36 | ], $tableOptions); |
| 37 | 37 | $this->addPrimaryKey('{{%notification_notifiable_pk}}', $this->tableName, 'id'); |
| 38 | 38 | $this->createIndex('notification_notifiable', $this->tableName, ['notifiable_id', 'notifiable_class']); |
@@ -24,15 +24,15 @@ |
||
| 24 | 24 | } |
| 25 | 25 | $this->createTable($this->tableName, [ |
| 26 | 26 | 'id' => $this->primaryKey(), |
| 27 | - 'name' => $this->string(50)->notNull(),//定时任务名称 |
|
| 28 | - 'route' => $this->string(100)->notNull(),//任务路由 |
|
| 29 | - 'crontab_str' => $this->string(50)->notNull(),//crontab格式 |
|
| 30 | - 'switch' => $this->boolean()->notNull()->defaultValue(false),//任务开关 0关闭 1开启 |
|
| 31 | - 'status' => $this->boolean()->defaultValue(false),//任务运行状态 0正常 1任务报错 |
|
| 32 | - 'last_rundate' => $this->dateTime()->null(),//任务上次运行时间 |
|
| 33 | - 'next_rundate' => $this->dateTime()->null(),//任务下次运行时间 |
|
| 34 | - 'execmemory' => $this->decimal(9,2)->defaultValue('0.00'),//任务执行消耗内存(单位/byte) |
|
| 35 | - 'exectime' => $this->decimal(9,2)->defaultValue('0.00'),//任务执行消耗时间 |
|
| 27 | + 'name' => $this->string(50)->notNull(), //定时任务名称 |
|
| 28 | + 'route' => $this->string(100)->notNull(), //任务路由 |
|
| 29 | + 'crontab_str' => $this->string(50)->notNull(), //crontab格式 |
|
| 30 | + 'switch' => $this->boolean()->notNull()->defaultValue(false), //任务开关 0关闭 1开启 |
|
| 31 | + 'status' => $this->boolean()->defaultValue(false), //任务运行状态 0正常 1任务报错 |
|
| 32 | + 'last_rundate' => $this->dateTime()->null(), //任务上次运行时间 |
|
| 33 | + 'next_rundate' => $this->dateTime()->null(), //任务下次运行时间 |
|
| 34 | + 'execmemory' => $this->decimal(9, 2)->defaultValue('0.00'), //任务执行消耗内存(单位/byte) |
|
| 35 | + 'exectime' => $this->decimal(9, 2)->defaultValue('0.00'), //任务执行消耗时间 |
|
| 36 | 36 | ], $tableOptions); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -121,14 +121,14 @@ |
||
| 121 | 121 | Yii::$app->getSession()->setFlash('success', Yii::t('yuncms', 'Delete success.')); |
| 122 | 122 | return $this->redirect(['index']); |
| 123 | 123 | } |
| 124 | - /** |
|
| 125 | - * Batch Delete existing Task model. |
|
| 126 | - * If deletion is successful, the browser will be redirected to the 'index' page. |
|
| 127 | - * @return mixed |
|
| 128 | - * @throws NotFoundHttpException |
|
| 129 | - * @throws \Throwable |
|
| 130 | - * @throws \yii\db\StaleObjectException |
|
| 131 | - */ |
|
| 124 | + /** |
|
| 125 | + * Batch Delete existing Task model. |
|
| 126 | + * If deletion is successful, the browser will be redirected to the 'index' page. |
|
| 127 | + * @return mixed |
|
| 128 | + * @throws NotFoundHttpException |
|
| 129 | + * @throws \Throwable |
|
| 130 | + * @throws \yii\db\StaleObjectException |
|
| 131 | + */ |
|
| 132 | 132 | public function actionBatchDelete() |
| 133 | 133 | { |
| 134 | 134 | if (($ids = Yii::$app->request->post('ids', null)) != null) { |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | if (($model = Task::findOne($id)) !== null) { |
| 156 | 156 | return $model; |
| 157 | 157 | } else { |
| 158 | - throw new NotFoundHttpException (Yii::t('yii', 'The requested page does not exist.')); |
|
| 158 | + throw new NotFoundHttpException(Yii::t('yii', 'The requested page does not exist.')); |
|
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | /* @var yuncms\models\Task $model */ |
| 8 | 8 | /* @var ActiveForm $form */ |
| 9 | 9 | ?> |
| 10 | -<?php $form = ActiveForm::begin(['layout' => 'horizontal', 'enableAjaxValidation' => true, 'enableClientValidation' => false,]); ?> |
|
| 10 | +<?php $form = ActiveForm::begin(['layout' => 'horizontal', 'enableAjaxValidation' => true, 'enableClientValidation' => false, ]); ?> |
|
| 11 | 11 | |
| 12 | 12 | <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> |
| 13 | 13 | <div class="hr-line-dashed"></div> |
@@ -70,14 +70,14 @@ |
||
| 70 | 70 | 'crontab_str', |
| 71 | 71 | [ |
| 72 | 72 | 'attribute' => 'switch', |
| 73 | - 'value' => function ($model) { |
|
| 73 | + 'value' => function($model) { |
|
| 74 | 74 | return $model->switch == Task::SWITCH_ACTIVE ? Yii::t('yuncms', 'Active') : Yii::t('yuncms', 'Disable'); |
| 75 | 75 | }, |
| 76 | 76 | 'label' => Yii::t('yuncms', 'Task Switch'), |
| 77 | 77 | ], |
| 78 | 78 | [ |
| 79 | 79 | 'attribute' => 'status', |
| 80 | - 'value' => function ($model) { |
|
| 80 | + 'value' => function($model) { |
|
| 81 | 81 | return $model->status == Task::STATUS_NORMAL ? Yii::t('yuncms', 'Normal') : Yii::t('yuncms', 'Saved'); |
| 82 | 82 | }, |
| 83 | 83 | 'label' => Yii::t('yuncms', 'Task Status'), |
@@ -44,10 +44,10 @@ |
||
| 44 | 44 | public $grantTypes = [ |
| 45 | 45 | 'authorization_code' => Authorization::class, |
| 46 | 46 | 'refresh_token' => RefreshToken::class, |
| 47 | - 'client_credentials' => ClientCredentials::class,//个人账户密码 |
|
| 48 | - 'password' => UserCredentials::class,//账户密码 |
|
| 49 | - 'wechat' => WeChatCredentials::class,//微信 |
|
| 50 | - 'qrcode' => QRCode::class,//客户端扫码 |
|
| 47 | + 'client_credentials' => ClientCredentials::class, //个人账户密码 |
|
| 48 | + 'password' => UserCredentials::class, //账户密码 |
|
| 49 | + 'wechat' => WeChatCredentials::class, //微信 |
|
| 50 | + 'qrcode' => QRCode::class, //客户端扫码 |
|
| 51 | 51 | // 'urn:ietf:params:oauth:grant-type:jwt-bearer' => 'yuncms\oauth2\grant\types\JwtBearer',//JWT 客户端签名 |
| 52 | 52 | ]; |
| 53 | 53 | |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | 'month' => static::parseTag(self::$tags[3], 1, 12), //月份 |
| 72 | 72 | 'week' => static::parseTag(self::$tags[4], 0, 6), // 星期 |
| 73 | 73 | ]; |
| 74 | - $crons['week'] = array_map(function ($item) { |
|
| 74 | + $crons['week'] = array_map(function($item) { |
|
| 75 | 75 | return static::$weekMap[$item]; |
| 76 | 76 | }, $crons['week']); |
| 77 | 77 | return self::getDateList($crons, $maxSize); |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | 'unconfirmed_email' => $this->string(150)->comment('Unconfirmed Email'), |
| 31 | 31 | 'unconfirmed_mobile' => $this->string(11)->comment('Unconfirmed Mobile'), |
| 32 | 32 | 'registration_ip' => $this->string()->comment('Registration Ip'), |
| 33 | - 'identified' => $this->boolean()->defaultValue(false)->comment('Identified'),//是否经过实名认证 |
|
| 34 | - 'balance' => $this->decimal(12, 2)->defaultValue(0),//可提现余额 |
|
| 35 | - 'transfer_balance' => $this->decimal(12, 2)->defaultValue(0),//未结算余额 |
|
| 33 | + 'identified' => $this->boolean()->defaultValue(false)->comment('Identified'), //是否经过实名认证 |
|
| 34 | + 'balance' => $this->decimal(12, 2)->defaultValue(0), //可提现余额 |
|
| 35 | + 'transfer_balance' => $this->decimal(12, 2)->defaultValue(0), //未结算余额 |
|
| 36 | 36 | 'flags' => $this->integer()->defaultValue(0)->comment('Flags'), |
| 37 | 37 | 'email_confirmed_at' => $this->unixTimestamp()->comment('Email Confirmed At'), |
| 38 | 38 | 'mobile_confirmed_at' => $this->unixTimestamp()->comment('Mobile Confirmed At'), |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | const AFTER_REGISTER = 'afterRegister'; |
| 59 | 59 | |
| 60 | 60 | //场景定义 |
| 61 | - const SCENARIO_CREATE = 'create';//后台或控制台创建用户 |
|
| 62 | - const SCENARIO_UPDATE = 'update';//后台或控制台修改用户 |
|
| 63 | - const SCENARIO_REGISTER = 'basic_create';//邮箱注册 |
|
| 64 | - const SCENARIO_EMAIL_REGISTER = 'email_create';//邮箱注册 |
|
| 65 | - const SCENARIO_MOBILE_REGISTER = 'mobile_create';//手机号注册 |
|
| 66 | - const SCENARIO_SETTINGS = 'settings';//更新 |
|
| 67 | - const SCENARIO_CONNECT = 'connect';//账户链接或自动注册新用户 |
|
| 61 | + const SCENARIO_CREATE = 'create'; //后台或控制台创建用户 |
|
| 62 | + const SCENARIO_UPDATE = 'update'; //后台或控制台修改用户 |
|
| 63 | + const SCENARIO_REGISTER = 'basic_create'; //邮箱注册 |
|
| 64 | + const SCENARIO_EMAIL_REGISTER = 'email_create'; //邮箱注册 |
|
| 65 | + const SCENARIO_MOBILE_REGISTER = 'mobile_create'; //手机号注册 |
|
| 66 | + const SCENARIO_SETTINGS = 'settings'; //更新 |
|
| 67 | + const SCENARIO_CONNECT = 'connect'; //账户链接或自动注册新用户 |
|
| 68 | 68 | const SCENARIO_PASSWORD = 'password'; |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | static::SCENARIO_EMAIL_REGISTER => ['nickname', 'email', 'password'], |
| 106 | 106 | static::SCENARIO_MOBILE_REGISTER => ['mobile', 'password'], |
| 107 | 107 | static::SCENARIO_SETTINGS => ['username', 'email', 'password'], |
| 108 | - static::SCENARIO_CONNECT => ['nickname', 'email', 'password'],//链接账户密码可以为空邮箱可以为空 |
|
| 109 | - static::SCENARIO_PASSWORD => ['password'],//只修改密码 |
|
| 108 | + static::SCENARIO_CONNECT => ['nickname', 'email', 'password'], //链接账户密码可以为空邮箱可以为空 |
|
| 109 | + static::SCENARIO_PASSWORD => ['password'], //只修改密码 |
|
| 110 | 110 | ]); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | if ($this->balance < 0) {//计算后如果余额小于0,那么结果不合法。 |
| 319 | 319 | return false; |
| 320 | 320 | } |
| 321 | - $transaction = static::getDb()->beginTransaction();//开始事务 |
|
| 321 | + $transaction = static::getDb()->beginTransaction(); //开始事务 |
|
| 322 | 322 | try { |
| 323 | 323 | if ($this->save()) { |
| 324 | 324 | $transaction->commit(); |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | if ($this->transfer_balance < 0) {//计算后如果余额小于0,那么结果不合法。 |
| 361 | 361 | return false; |
| 362 | 362 | } |
| 363 | - $transaction = static::getDb()->beginTransaction();//开始事务 |
|
| 363 | + $transaction = static::getDb()->beginTransaction(); //开始事务 |
|
| 364 | 364 | try { |
| 365 | 365 | if ($this->save()) { |
| 366 | 366 | $transaction->commit(); |