mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-07-19 22:52:59 +08:00
* 1:更新ip2region,php-cron-scheduler包 2:替换phpqrcode 3:移除lcobucci/jwt * 后台接入产品动态,相关链接指向官网 * 升级composer依赖包 * v1.2.5阶段新合并 Co-authored-by: winzer <winzer9527@163.com>
70 lines
1.3 KiB
PHP
70 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Admin\Services;
|
|
|
|
use App\Caches\SiteGlobalStat;
|
|
use App\Caches\SiteTodayStat;
|
|
use App\Library\AppInfo;
|
|
use App\Library\Utils\ServerInfo;
|
|
use GuzzleHttp\Client;
|
|
|
|
class Index extends Service
|
|
{
|
|
|
|
public function getTopMenus()
|
|
{
|
|
$authMenu = new AuthMenu();
|
|
|
|
return $authMenu->getTopMenus();
|
|
}
|
|
|
|
public function getLeftMenus()
|
|
{
|
|
$authMenu = new AuthMenu();
|
|
|
|
return $authMenu->getLeftMenus();
|
|
}
|
|
|
|
public function getAppInfo()
|
|
{
|
|
return new AppInfo();
|
|
}
|
|
|
|
public function getServerInfo()
|
|
{
|
|
return [
|
|
'cpu' => ServerInfo::cpu(),
|
|
'memory' => ServerInfo::memory(),
|
|
'disk' => ServerInfo::disk(),
|
|
];
|
|
}
|
|
|
|
public function getGlobalStat()
|
|
{
|
|
$cache = new SiteGlobalStat();
|
|
|
|
return $cache->get();
|
|
}
|
|
|
|
public function getTodayStat()
|
|
{
|
|
$cache = new SiteTodayStat();
|
|
|
|
return $cache->get();
|
|
}
|
|
|
|
public function getReleases()
|
|
{
|
|
$url = 'https://koogua.com/api-releases.json';
|
|
|
|
$client = new Client();
|
|
|
|
$response = $client->get($url, ['timeout' => 3]);
|
|
|
|
$content = json_decode($response->getBody(), true);
|
|
|
|
return $content['releases'] ?? [];
|
|
}
|
|
|
|
}
|