mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-10 02:30:03 +08:00
54 lines
838 B
PHP
54 lines
838 B
PHP
<?php
|
|
|
|
namespace App\Caches;
|
|
|
|
use App\Repos\Nav as NavRepo;
|
|
|
|
class Nav extends Cache
|
|
{
|
|
|
|
protected $lifetime = 365 * 86400;
|
|
|
|
public function getTopNav()
|
|
{
|
|
$items = $this->get();
|
|
|
|
if (!$items) return;
|
|
|
|
$result = new \stdClass();
|
|
|
|
foreach ($items as $item) {
|
|
if ($item->position == 'top') {
|
|
$result->{$item->item_key} = $item->item_value;
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function getBottomNav()
|
|
{
|
|
|
|
}
|
|
|
|
protected function getLifetime()
|
|
{
|
|
return $this->lifetime;
|
|
}
|
|
|
|
protected function getKey($params = null)
|
|
{
|
|
return 'nav';
|
|
}
|
|
|
|
protected function getContent($params = null)
|
|
{
|
|
$navRepo = new NavRepo();
|
|
|
|
$items = $navRepo->findAll();
|
|
|
|
return $items;
|
|
}
|
|
|
|
}
|