feat(dashboard): 从专业财富观角度重构升级后台收益与分成统计仪表盘

这个提交包含在:
chen
2026-09-17 08:22:23 +08:00
父节点 64a9563779
当前提交 b6287bf2e0
共有 40 个文件被更改,包括 5145 次插入 和 1015 次删除

查看文件

@@ -22,6 +22,7 @@ class Shopro extends Addons
// 创建菜单
$menu = self::getMenu();
Menu::create($menu['new']);
self::flattenShoproMenus();
return true;
}
@@ -33,7 +34,10 @@ class Shopro extends Addons
public function uninstall()
{
// 删除菜单
Menu::delete('shopro');
$ids = AuthRule::where('name', 'like', 'shopro%')->column('id');
if ($ids) {
AuthRule::destroy($ids);
}
return true;
}
@@ -44,7 +48,8 @@ class Shopro extends Addons
public function enable()
{
// 启用菜单
Menu::enable('shopro');
AuthRule::where('name', 'like', 'shopro%')->update(['status' => 'normal']);
self::flattenShoproMenus();
return true;
}
@@ -57,6 +62,7 @@ class Shopro extends Addons
// 更新菜单
$menu = self::getMenu();
Menu::upgrade('shopro', $menu['new']);
self::flattenShoproMenus();
return true;
}
@@ -67,7 +73,7 @@ class Shopro extends Addons
public function disable()
{
// 禁用菜单
Menu::disable('shopro');
AuthRule::where('name', 'like', 'shopro%')->update(['status' => 'hidden']);
return true;
}
@@ -133,6 +139,45 @@ class Shopro extends Addons
return ['new' => $newMenu, 'old' => $oldMenu];
}
/**
* 业务菜单提到一级侧栏,shopro 只作插件根节点(不显示)
*/
public static function flattenShoproMenus()
{
$root = AuthRule::getByName('shopro');
if (!$root) {
return;
}
AuthRule::where('id', $root['id'])->update([
'ismenu' => 0,
'title' => 'Shopro',
]);
AuthRule::where('pid', $root['id'])->where('ismenu', 1)->update(['pid' => 0]);
$weighs = [
'shopro/dashboard' => 300,
'shopro/order' => 290,
'shopro/goods' => 280,
'shopro/user/user' => 270,
'shopro/commission' => 260,
'shopro/withdraw' => 250,
'shopro/activity/activity' => 240,
'shopro/decorate' => 230,
'shopro/chat' => 220,
'shopro/wechat' => 210,
'shopro/feedback' => 200,
'shopro/config' => 190,
'shopro/dispatch/dispatch' => 180,
'shopro/notification/config' => 170,
'shopro/data' => 160,
];
foreach ($weighs as $name => $weigh) {
AuthRule::where('name', $name)->update(['weigh' => $weigh]);
}
}
/**