We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4126454 commit 1a90f3cCopy full SHA for 1a90f3c
1 file changed
src/Http/Controllers/Api/BlogController.php
@@ -287,6 +287,7 @@ public function recommendArticles(Request $request)
287
$articles = Cache::remember(self::CACHE_KEY_ARTICLE_RECOMMEND, $expiresAt, function () use ($validated, $fields) {
288
return BlogArticle::query()
289
->where('status', 1) // 只推荐已发布文章
290
+ ->where('category_id', '>', 0) // 只推荐有分类的文章
291
->when($validated['seo_url_key'] ?? false, function ($q) use ($validated) {
292
$q->where('seo_url_key', '!=', $validated['seo_url_key']); // 排除当前文章
293
})->when($validated['type'] === 'popular', function ($q) {
0 commit comments