diff --git a/app/index/controller/Post.php b/app/index/controller/Post.php index 7344eac..c2b1551 100644 --- a/app/index/controller/Post.php +++ b/app/index/controller/Post.php @@ -46,7 +46,6 @@ class Post extends Common $model_post->save(); - $list_last_visit = PostVisit::where('post_id', $model_post->id) ->order('id desc') ->group('ip,uid') @@ -55,7 +54,7 @@ class Post extends Common ->select(); View::assign('post', $model_post); View::assign('list_last_visit', $list_last_visit); - + $model_visit = $this->recordVisit($model_post->id); View::assign('model_visit', $model_visit); @@ -95,4 +94,12 @@ class Post extends Common return $model_visit; } + public function markVisit($visit_id) + { + $model_visit = PostVisit::find($visit_id); + $model_visit->is_js_run = 1; + $model_visit->save(); + + return json_message(); + } } diff --git a/view/index/index/visit.html b/view/index/index/visit.html index c8da372..fb96ec0 100644 --- a/view/index/index/visit.html +++ b/view/index/index/visit.html @@ -21,6 +21,11 @@