From 3e6189ceb7f79eb141436cf166b70e43ea040d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Thu, 27 Oct 2022 13:47:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/migrations/20221013045830_install_wechat_data.php | 7 ++++--- database/migrations/20221013045839_install_user_data.php | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/database/migrations/20221013045830_install_wechat_data.php b/database/migrations/20221013045830_install_wechat_data.php index 9df69b623..8246dea18 100644 --- a/database/migrations/20221013045830_install_wechat_data.php +++ b/database/migrations/20221013045830_install_wechat_data.php @@ -26,10 +26,11 @@ class InstallWechatData extends Migrator */ private function createMenu() { + // 检查菜单数据 $map = ['node' => 'wechat/config/options']; - if (SystemMenu::mk()->where($map)->count() > 0) { - return; - } + if (SystemMenu::mk()->where($map)->count() > 0) return; + + // 写入微信菜单 ToolsExtend::write2menu([ [ 'name' => '微信管理', diff --git a/database/migrations/20221013045839_install_user_data.php b/database/migrations/20221013045839_install_user_data.php index 802844863..f8d2817ae 100644 --- a/database/migrations/20221013045839_install_user_data.php +++ b/database/migrations/20221013045839_install_user_data.php @@ -9,9 +9,14 @@ use think\migration\Migrator; */ class InstallUserData extends Migrator { + /** + * @return void + * @throws \think\db\exception\DbException + */ public function change() { - $this->createMenu() && $this->createRegion(); + $this->createMenu(); + $this->createRegion(); } /**