From 24d4c928c83eb50eb2fe531806a60fe54b3e94ec Mon Sep 17 00:00:00 2001 From: umono Date: Mon, 19 Dec 2022 19:07:42 +0800 Subject: [PATCH] fix some --- composer.json | 3 +- src/config/common.php | 7 +- .../m180601_035116_create_admin_table.php | 12 +- .../api/controllers/TestController.php | 2 + .../backend/api/helpers/MenuDataHelper.php | 65 + .../backend/api/models/admin/Admin.php | 11 +- .../backend/api/models/admin/LoginForm.php | 5 +- stats.html | 4044 ----------------- .../Admin/admin/components/changePassword.vue | 5 +- ui/src/views/Admin/login/Index.vue | 2 - 10 files changed, 94 insertions(+), 4062 deletions(-) create mode 100644 src/modules/backend/api/helpers/MenuDataHelper.php delete mode 100644 stats.html diff --git a/composer.json b/composer.json index 4c4a3b2..1839329 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "license": "MIT", "autoload": { "psr-4": { - "app\\": "src" + "app\\": "src", + "umono\\multiple\\": "extend/yii2-multiple/src" } }, "authors": [ diff --git a/src/config/common.php b/src/config/common.php index 98fd93f..e8834ff 100644 --- a/src/config/common.php +++ b/src/config/common.php @@ -20,9 +20,10 @@ 'bootstrap' => \app\modules\ModulesConfig::bootstrap(), 'aliases' => [ - '@base' => dirname(__DIR__) . '/../', - '@app' => dirname(__DIR__) . '/', - '@app/web' => __DIR__ . '/../../public', + '@base' => dirname(__DIR__) . '/../', + '@app' => dirname(__DIR__) . '/', + '@app/web' => __DIR__ . '/../../public', + '@app/migrations' => __DIR__ . '/../database/migrations', ], "modules" => \app\modules\ModulesConfig::modules(), diff --git a/src/database/migrations/m180601_035116_create_admin_table.php b/src/database/migrations/m180601_035116_create_admin_table.php index 1d12811..efe0fcc 100644 --- a/src/database/migrations/m180601_035116_create_admin_table.php +++ b/src/database/migrations/m180601_035116_create_admin_table.php @@ -1,5 +1,6 @@ $this->string()->defaultValue('')->comment('头像'), 'adminGroupId' => $this->integer()->defaultValue(0)->comment('管理组ID'), 'status' => $this->integer()->notNull()->defaultValue(10)->comment('状态'), - 'created_at' => $this->dateTime()->notNull(), 'created_id' => $this->integer()->notNull()->defaultValue(0)->comment('创建用户'), - 'updated_at' => $this->dateTime()->notNull(), + 'created_at' => $this->dateTime()->notNull()->comment('创建时间'), + 'updated_at' => $this->dateTime()->notNull()->comment('更新时间'), 'updated_id' => $this->integer()->notNull()->defaultValue(0)->comment('修改用户'), 'is_del' => $this->boolean()->defaultValue(false)->comment('是否删除'), 'is_hidden' => $this->boolean()->defaultValue(false)->comment('是否隐藏'), @@ -121,6 +122,13 @@ date('Y-m-d H:i:s'), ], ]); + + // 导入菜单数据 + $this->batchInsert( + $this->adminMenuTableName, + MenuDataHelper::getColumnArr(), + MenuDataHelper::backAll() + ); } /** diff --git a/src/modules/backend/api/controllers/TestController.php b/src/modules/backend/api/controllers/TestController.php index ec0131a..b64e778 100644 --- a/src/modules/backend/api/controllers/TestController.php +++ b/src/modules/backend/api/controllers/TestController.php @@ -3,10 +3,12 @@ namespace app\modules\backend\api\controllers; use app\modules\backend\api\Controller; + use \umono\multiple\helpers\DeleteHelper; class TestController extends Controller { public function actionIndex() { + return DeleteHelper::$bind; } } \ No newline at end of file diff --git a/src/modules/backend/api/helpers/MenuDataHelper.php b/src/modules/backend/api/helpers/MenuDataHelper.php new file mode 100644 index 0000000..0e9ce87 --- /dev/null +++ b/src/modules/backend/api/helpers/MenuDataHelper.php @@ -0,0 +1,65 @@ + $param['id'] ?? -1]); - - if (empty($model)) { - $model->password = $param['password']; - $model->setPassword(); - $model->save(); + if (!empty($model)) { + if (!empty($param['password'])){ + $model->password = $param['password']; + $model->passwordConfirm = true; + $model->save(); + } unset($model); } diff --git a/src/modules/backend/api/models/admin/LoginForm.php b/src/modules/backend/api/models/admin/LoginForm.php index 21cf91a..ef86137 100644 --- a/src/modules/backend/api/models/admin/LoginForm.php +++ b/src/modules/backend/api/models/admin/LoginForm.php @@ -152,12 +152,11 @@ $captchaArr = $this->getCaptchaArr($retryKey); if ($this->captchaCode && !empty($captchaArr['code'] ?? '')) { - if (mb_strtoupper($this->captchaCode) != mb_strtoupper($captchaArr['code'])) { - $this->errMsg = '验证码无效:('; + $this->msgErr('验证码无效:('); } }else{ - $this->errMsg = '请输入验证码:('; + $this->msgErr('请输入验证码:('); } $captcha = new CaptchaBuilder; $captcha->build(); diff --git a/stats.html b/stats.html deleted file mode 100644 index c338cb0..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - diff --git a/ui/src/views/Admin/admin/components/changePassword.vue b/ui/src/views/Admin/admin/components/changePassword.vue index 0e5497c..fabb240 100644 --- a/ui/src/views/Admin/admin/components/changePassword.vue +++ b/ui/src/views/Admin/admin/components/changePassword.vue @@ -38,8 +38,9 @@ export default defineComponent({ methods: { async show(val: any) { this.isShow = true; - this.model = val; - // do something... + this.model.id = val.id; + this.model.username = val.username; + this.model.password = null; }, async submitFunc() { this.loading = true; diff --git a/ui/src/views/Admin/login/Index.vue b/ui/src/views/Admin/login/Index.vue index 6af0d24..d44ddab 100644 --- a/ui/src/views/Admin/login/Index.vue +++ b/ui/src/views/Admin/login/Index.vue @@ -103,8 +103,6 @@ export default defineComponent({ window.$message.error(data.errMsg); this.captchaImg = data.captchaImg; this.captchaCode = ''; - - console.log("????",this.loginForm); } } this.loading = false;