修改文章默认排序按时间

This commit is contained in:
augushong
2024-07-10 11:32:42 +08:00
parent 1d421af217
commit 2ed3daae8d

View File

@@ -50,15 +50,15 @@ class Index extends Common
$categorys_where = PostCategory::whereIn('category_id', $categorys);
$model_post = Post::hasWhere('categorys', $categorys_where)->where('status', 1)->order('id desc');
$model_post = Post::hasWhere('categorys', $categorys_where)->where('status', 1)->order('publish_time desc');
} else {
$model_sub_category = Category::find($sub_category_id);
$page_title .= "-{$model_sub_category->title}";
$model_post = Post::hasWhere('categorys', ['category_id' => $sub_category_id])->where('status', 1)->order('id desc');
$model_post = Post::hasWhere('categorys', ['category_id' => $sub_category_id])->where('status', 1)->order('publish_time desc');
}
} else {
$model_post = Post::where('status', 1)->order('id desc');
$model_post = Post::where('status', 1)->order('publish_time desc');
}
$model_post->where('type', 3);