mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
增加访问记录列表
This commit is contained in:
@@ -5,6 +5,7 @@ namespace app\index\controller;
|
||||
use app\model\Category;
|
||||
use app\model\Post;
|
||||
use app\model\PostCategory;
|
||||
use app\model\PostVisit;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Session;
|
||||
use think\facade\View;
|
||||
@@ -98,6 +99,28 @@ class Index extends Common
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function visit()
|
||||
{
|
||||
$post_id = $this->request->param('post_id');
|
||||
|
||||
$model_list_visit = PostVisit::with(['post'])->order('id desc');
|
||||
|
||||
if(!empty($post_id)) {
|
||||
$model_list_visit->where('post_id', $post_id);
|
||||
}
|
||||
|
||||
$list_visit = $model_list_visit->paginate([
|
||||
'url' => 'Index/visit',
|
||||
'list_rows' => 20,
|
||||
'query' => [
|
||||
'post_id' => $post_id,
|
||||
],
|
||||
]);
|
||||
View::assign('list_visit', $list_visit);
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
Session::clear();
|
||||
|
||||
Reference in New Issue
Block a user