mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 02:22:48 +08:00
新增手机端浏览模式
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
namespace base\admin\controller;
|
||||
|
||||
use app\admin\model\SystemAdmin;
|
||||
use app\admin\model\SystemMenu;
|
||||
use app\admin\model\SystemQuick;
|
||||
use app\common\controller\AdminController;
|
||||
use app\common\service\MenuService;
|
||||
|
||||
class IndexBase extends AdminController
|
||||
{
|
||||
@@ -116,4 +118,39 @@ class IndexBase extends AdminController
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function mobile()
|
||||
{
|
||||
$pid = $this->request->param('pid', 0);
|
||||
|
||||
$menuService = new MenuService(session('admin.id'));
|
||||
|
||||
$home_info = $menuService->getHomeInfo();
|
||||
|
||||
$list_menu = SystemMenu::with(['children' => function ($query) {
|
||||
$query->order('sort', 'desc')->order('id', 'asc');
|
||||
}])->where('pid', $pid)->order([
|
||||
'sort' => 'desc',
|
||||
'id' => 'asc',
|
||||
])
|
||||
->where('status', 1)
|
||||
->select();
|
||||
|
||||
$list_menu_pid = SystemMenu::group('pid')->column('pid');
|
||||
|
||||
foreach ($list_menu as $model_menu) {
|
||||
foreach ($model_menu->children as $model_child) {
|
||||
if (in_array($model_child->id, $list_menu_pid)) {
|
||||
$model_child->href = __url('mobile', ['pid' => $model_child->pid]);
|
||||
} else {
|
||||
$model_child->href = __url($model_child->href);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->assign('home_info', $home_info);
|
||||
$this->assign('list_menu', $list_menu);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user