39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
|
<?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']));
|
||
|
}
|
||
|
}
|