blog/app/controller/MenuController.php

39 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2024-06-08 15:54:41 +08:00
<?php
namespace app\controller;
use app\service\MenuService;
use app\util\Result;
use support\Request;
use DI\Annotation\Inject;
class MenuController
{
/**
* @Inject
* @var Result
*/
private $result;
/**
* @Inject
* @var MenuService
*/
private $menuService;
public function getMenu(Request $request)
{
$info = $this->menuService->getList();
if ($info['result']) return json(retData($this->result::SUCCESS, $info['msg'], $info['data']));
return json(retData($this->result::ERROR, $info['msg']));
}
public function my(Request $request)
{
$info = $this->menuService->getList();
if ($info['result']) return json(retData($this->result::SUCCESS, $info['msg'], $info['data']));
return json(retData($this->result::ERROR, $info['msg']));
}
public function list(Request $request)
{
$info = $this->menuService->getList($request->uid);
if ($info['result']) return json(retData($this->result::SUCCESS, $info['msg'], $info['data']));
return json(retData($this->result::ERROR, $info['msg']));
}
}