66 行
5.6 KiB
SQL
66 行
5.6 KiB
SQL
-- 区域代理后台菜单(完整版:看板/设置/代理/等级/订单/佣金)
|
||
-- 请将 fa_ 替换为实际表前缀
|
||
-- 可重复执行:INSERT IGNORE 跳过已存在项
|
||
|
||
SET @now = UNIX_TIMESTAMP();
|
||
|
||
-- 挂到与「分销中心」相同的父级
|
||
SET @parent_id = (SELECT pid FROM `fa_auth_rule` WHERE `name` = 'shopro/commission' LIMIT 1);
|
||
SET @parent_id = IFNULL(@parent_id, (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro' LIMIT 1));
|
||
|
||
INSERT IGNORE INTO `fa_auth_rule` (`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) VALUES
|
||
('file', @parent_id, 'shopro/regional_agent', '区域代理', 'fa fa-map-marker', '', '', '', 1, '', @now, @now, 5, 'normal');
|
||
|
||
SET @ra_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent' LIMIT 1);
|
||
|
||
UPDATE `fa_auth_rule`
|
||
SET `pid` = @parent_id, `ismenu` = 1, `status` = 'normal', `weigh` = 5
|
||
WHERE `name` = 'shopro/regional_agent';
|
||
|
||
-- 一级子菜单
|
||
INSERT IGNORE INTO `fa_auth_rule` (`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) VALUES
|
||
('file', @ra_id, 'shopro/regional_agent/dashboard', '业绩看板', 'fa fa-bar-chart', '', '', '', 1, '', @now, @now, 10, 'normal'),
|
||
('file', @ra_id, 'shopro/regional_agent/config', '代理设置', 'fa fa-cog', '', '', '', 1, '', @now, @now, 9, 'normal'),
|
||
('file', @ra_id, 'shopro/regional_agent/agent', '区域代理', 'fa fa-user', '', '', '', 1, '', @now, @now, 8, 'normal'),
|
||
('file', @ra_id, 'shopro/regional_agent/level', '代理等级', 'fa fa-star', '', '', '', 1, '', @now, @now, 7, 'normal'),
|
||
('file', @ra_id, 'shopro/regional_agent/order', '代理订单', 'fa fa-list-alt', '', '', '', 1, '', @now, @now, 6, 'normal'),
|
||
('file', @ra_id, 'shopro/regional_agent/reward', '佣金明细', 'fa fa-rmb', '', '', '', 1, '', @now, @now, 5, 'normal');
|
||
|
||
SET @dashboard_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/dashboard' LIMIT 1);
|
||
SET @config_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/config' LIMIT 1);
|
||
SET @agent_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/agent' LIMIT 1);
|
||
SET @level_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/level' LIMIT 1);
|
||
SET @order_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/order' LIMIT 1);
|
||
SET @reward_id = (SELECT id FROM `fa_auth_rule` WHERE `name` = 'shopro/regional_agent/reward' LIMIT 1);
|
||
|
||
-- 二级权限节点
|
||
INSERT IGNORE INTO `fa_auth_rule` (`type`,`pid`,`name`,`title`,`icon`,`url`,`condition`,`remark`,`ismenu`,`extend`,`createtime`,`updatetime`,`weigh`,`status`) VALUES
|
||
('file', @dashboard_id, 'shopro/regional_agent/dashboard/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @config_id, 'shopro/regional_agent/config/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @config_id, 'shopro/regional_agent/config/save', '保存', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/add', '添加', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/update', '更新', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/del', '删除', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/audit', '审核', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/edit', '编辑', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @agent_id, 'shopro/regional_agent/agent/options', '选项', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @level_id, 'shopro/regional_agent/level/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @level_id, 'shopro/regional_agent/level/add', '添加', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @level_id, 'shopro/regional_agent/level/edit', '编辑', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @level_id, 'shopro/regional_agent/level/del', '删除', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @order_id, 'shopro/regional_agent/order/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @order_id, 'shopro/regional_agent/order/runCommission', '结算', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @order_id, 'shopro/regional_agent/order/backCommission', '退回', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @order_id, 'shopro/regional_agent/order/export', '导出', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @reward_id, 'shopro/regional_agent/reward/index', '查看', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @reward_id, 'shopro/regional_agent/reward/runCommission', '结算', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @reward_id, 'shopro/regional_agent/reward/backCommission', '退回', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal'),
|
||
('file', @reward_id, 'shopro/regional_agent/reward/export', '导出', 'fa fa-circle-o', '', '', '', 0, '', @now, @now, 0, 'normal');
|
||
|
||
-- 验证
|
||
SELECT id, pid, name, title, ismenu, status
|
||
FROM `fa_auth_rule`
|
||
WHERE `name` LIKE 'shopro/regional_agent%'
|
||
ORDER BY pid, weigh DESC, id;
|