mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
60 lines
2.1 KiB
PHP
60 lines
2.1 KiB
PHP
<?php
|
|
|
|
use think\admin\extend\ToolsExtend;
|
|
use think\admin\model\SystemMenu;
|
|
use think\migration\Migrator;
|
|
|
|
/**
|
|
* 微信初始化
|
|
*/
|
|
class InstallWechatData extends Migrator
|
|
{
|
|
/**
|
|
* 初始化数据
|
|
* @return void
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
public function change()
|
|
{
|
|
$this->createMenu();
|
|
}
|
|
|
|
/**
|
|
* 初始化菜单
|
|
* @return void
|
|
* @throws \think\db\exception\DbException
|
|
*/
|
|
private function createMenu()
|
|
{
|
|
// 检查菜单数据
|
|
$map = ['node' => 'wechat/config/options'];
|
|
if (SystemMenu::mk()->where($map)->count() > 0) return;
|
|
|
|
// 写入微信菜单
|
|
ToolsExtend::write2menu([
|
|
[
|
|
'name' => '微信管理',
|
|
'subs' => [
|
|
[
|
|
'name' => '微信管理',
|
|
'subs' => [
|
|
['name' => '微信接口配置', 'icon' => 'layui-icon layui-icon-set', 'node' => 'wechat/config/options'],
|
|
['name' => '微信支付配置', 'icon' => 'layui-icon layui-icon-rmb', 'node' => 'wechat/config/payment'],
|
|
],
|
|
],
|
|
[
|
|
'name' => '微信定制',
|
|
'subs' => [
|
|
['name' => '微信粉丝管理', 'icon' => 'layui-icon layui-icon-username', 'node' => 'wechat/fans/index'],
|
|
['name' => '微信图文管理', 'icon' => 'layui-icon layui-icon-template-1', 'node' => 'wechat/news/index'],
|
|
['name' => '微信菜单配置', 'icon' => 'layui-icon layui-icon-cellphone', 'node' => 'wechat/menu/index'],
|
|
['name' => '回复规则管理', 'icon' => 'layui-icon layui-icon-engine', 'node' => 'wechat/keys/index'],
|
|
['name' => '关注自动回复', 'icon' => 'layui-icon layui-icon-release', 'node' => 'wechat/auto/index'],
|
|
],
|
|
],
|
|
],
|
|
],
|
|
]);
|
|
}
|
|
}
|