USE youlai_admin;

-- 会员认证菜单初始化
-- 说明：
-- 1. 在系统管理下新增“业务配置”统一入口，当前承载会员认证策略与会员登录注册配置。
-- 2. 在会员中心下新增“认证审核”页面，用于后台审核会员认证申请。

-- 系统管理 > 业务配置
INSERT INTO `sys_menu`
(`id`, `parent_id`, `tree_path`, `name`, `type`, `route_name`, `route_path`, `component`, `perm`,
 `always_show`, `keep_alive`, `visible`, `sort`, `icon`, `redirect`, `create_time`, `update_time`, `params`)
VALUES
(271, 1, '0,1', '业务配置', 'M', 'BizConfigCenter', 'biz-config', 'system/biz-config/index', NULL,
 0, 1, 1, 8, 'setting', NULL, NOW(), NOW(), NULL),
(2711, 271, '0,1,271', '会员认证策略查看', 'B', NULL, '', NULL, 'member:verify:policy:view',
 NULL, NULL, 1, 1, '', NULL, NOW(), NOW(), NULL),
(2712, 271, '0,1,271', '会员认证策略修改', 'B', NULL, '', NULL, 'member:verify:policy:update',
 NULL, NULL, 1, 2, '', NULL, NOW(), NOW(), NULL),
(2713, 271, '0,1,271', '会员登录注册配置查看', 'B', NULL, '', NULL, 'member:auth:config:view',
 NULL, NULL, 1, 3, '', NULL, NOW(), NOW(), NULL),
(2714, 271, '0,1,271', '会员登录注册配置修改', 'B', NULL, '', NULL, 'member:auth:config:update',
 NULL, NULL, 1, 4, '', NULL, NOW(), NOW(), NULL)
ON DUPLICATE KEY UPDATE
`name` = VALUES(`name`),
`route_name` = VALUES(`route_name`),
`route_path` = VALUES(`route_path`),
`component` = VALUES(`component`),
`perm` = VALUES(`perm`),
`keep_alive` = VALUES(`keep_alive`),
`visible` = VALUES(`visible`),
`sort` = VALUES(`sort`),
`icon` = VALUES(`icon`),
`update_time` = NOW();

-- 会员中心 > 认证审核
INSERT INTO `sys_menu`
(`id`, `parent_id`, `tree_path`, `name`, `type`, `route_name`, `route_path`, `component`, `perm`,
 `always_show`, `keep_alive`, `visible`, `sort`, `icon`, `redirect`, `create_time`, `update_time`, `params`)
VALUES
(1320, 1300, '0,1300', '认证审核', 'M', 'MemberVerifyAudit', 'verify', 'member/verify/index', NULL,
 0, 1, 1, 2, 'checked', NULL, NOW(), NOW(), NULL),
(13201, 1320, '0,1300,1320', '认证记录查询', 'B', NULL, '', NULL, 'member:verify:record:list',
 NULL, NULL, 1, 1, '', NULL, NOW(), NOW(), NULL),
(13202, 1320, '0,1300,1320', '认证审核处理', 'B', NULL, '', NULL, 'member:verify:record:audit',
 NULL, NULL, 1, 2, '', NULL, NOW(), NOW(), NULL)
ON DUPLICATE KEY UPDATE
`name` = VALUES(`name`),
`route_name` = VALUES(`route_name`),
`route_path` = VALUES(`route_path`),
`component` = VALUES(`component`),
`perm` = VALUES(`perm`),
`keep_alive` = VALUES(`keep_alive`),
`visible` = VALUES(`visible`),
`sort` = VALUES(`sort`),
`icon` = VALUES(`icon`),
`update_time` = NOW();

-- 系统管理员授权
INSERT IGNORE INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES
(2, 271), (2, 2711), (2, 2712), (2, 2713), (2, 2714),
(2, 1320), (2, 13201), (2, 13202);
