完成评论

This commit is contained in:
augushong
2021-01-03 21:52:54 +08:00
parent bcc07c301e
commit 3b5a56aef5
18 changed files with 815 additions and 383 deletions

View File

@@ -6,6 +6,7 @@ namespace app\index\controller;
use app\model\Post as ModelPost;
use think\facade\View;
use think\model\Relation;
use think\Request;
class Post extends Common
@@ -51,7 +52,11 @@ class Post extends Common
{
//
$model_post = ModelPost::where('uid',$uid)->find();
$model_post = ModelPost::with([
'comments' => function (Relation $query) {
$query->order('id asc');
}
])->where('uid', $uid)->find();
$model_post->hits = $model_post->hits + 1;