1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-07-07 09:21:12 +08:00
course-tencent-cloud/app/Caches/ConsultCounter.php
2020-07-12 19:40:31 +08:00

36 lines
583 B
PHP

<?php
namespace App\Caches;
use App\Repos\Consult as ConsultRepo;
class ConsultCounter extends Counter
{
protected $lifetime = 1 * 86400;
public function getLifetime()
{
return $this->lifetime;
}
public function getKey($id = null)
{
return "consult_counter:{$id}";
}
public function getContent($id = null)
{
$consultRepo = new ConsultRepo();
$consult = $consultRepo->findById($id);
if (!$consult) return null;
return [
'like_count' => $consult->like_count,
];
}
}