修复统计缓存bug

This commit is contained in:
2023-06-28 14:34:58 +08:00
parent 6b5068ffd9
commit 9b29c5c67a

View File

@@ -54,8 +54,8 @@ class Common extends BaseController
$total_hits = Post::cache(60)->sum('hits'); $total_hits = Post::cache(60)->sum('hits');
View::assign('total_hits', $total_hits); View::assign('total_hits', $total_hits);
$total_week_hits = PostVisit::cache(60)->where('create_time', '>', time() - 86400 * 7)->count(); $total_week_hits = PostVisit::cache(60)->where('create_time', '>', strtotime(date('Y-m-d 00:00:00')) - 86400 * 7)->count();
$total_day_hits = PostVisit::cache(60)->where('create_time', '>', time() - 86400)->count(); $total_day_hits = PostVisit::cache(60)->where('create_time', '>', strtotime(date('Y-m-d 00:00:00')))->count();
View::assign('total_week_hits', $total_week_hits); View::assign('total_week_hits', $total_week_hits);
View::assign('total_day_hits', $total_day_hits); View::assign('total_day_hits', $total_day_hits);