mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-29 13:51:37 +08:00
57 lines
1.6 KiB
PHP
57 lines
1.6 KiB
PHP
<?php
|
|
|
|
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(),
|
|
];
|
|
}
|
|
|
|
}
|