22 lines
464 B
PHP
22 lines
464 B
PHP
<?php
|
|
namespace app\widget;
|
|
|
|
|
|
use app\model\Category;
|
|
use think\facade\{Db,View, Cache};
|
|
|
|
class Menu
|
|
{
|
|
public function index($categoryId)
|
|
{
|
|
$menus = Cache::get('rules');
|
|
if(empty($menus)){
|
|
$menus = Category::getListForFrontMenu();
|
|
}
|
|
$data = [
|
|
'categoryId' => $categoryId,
|
|
'menus' => $menus,
|
|
];
|
|
return View::assign($data)->fetch('public/menu');
|
|
}
|
|
} |