1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-30 06:11:38 +08:00
course-tencent-cloud/app/Caches/SiteGlobalStat.php
koogua 0336a54911 1.源文件增加版权信息
2.群组状态和课程协同
2021-06-13 15:49:47 +08:00

62 lines
1.7 KiB
PHP

<?php
/**
* @copyright Copyright (c) 2021 深圳市酷瓜软件有限公司
* @license https://opensource.org/licenses/GPL-2.0
* @link https://www.koogua.com
*/
namespace App\Caches;
use App\Repos\Article as ArticleRepo;
use App\Repos\Comment as CommentRepo;
use App\Repos\Consult as ConsultRepo;
use App\Repos\Course as CourseRepo;
use App\Repos\ImGroup as GroupRepo;
use App\Repos\Package as PackageRepo;
use App\Repos\Review as ReviewRepo;
use App\Repos\Topic as TopicRepo;
use App\Repos\User as UserRepo;
class SiteGlobalStat extends Cache
{
protected $lifetime = 15 * 60;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return 'site_global_stat';
}
public function getContent($id = null)
{
$courseRepo = new CourseRepo();
$articleRepo = new ArticleRepo();
$commentRepo = new CommentRepo();
$consultRepo = new ConsultRepo();
$groupRepo = new GroupRepo();
$packageRepo = new PackageRepo();
$reviewRepo = new ReviewRepo();
$topicRepo = new TopicRepo();
$userRepo = new UserRepo();
return [
'course_count' => $courseRepo->countCourses(),
'article_count' => $articleRepo->countArticles(),
'comment_count' => $commentRepo->countComments(),
'consult_count' => $consultRepo->countConsults(),
'group_count' => $groupRepo->countGroups(),
'vip_count' => $userRepo->countVipUsers(),
'package_count' => $packageRepo->countPackages(),
'review_count' => $reviewRepo->countReviews(),
'topic_count' => $topicRepo->countTopics(),
'user_count' => $userRepo->countUsers(),
];
}
}