feat(autogen): next_topic в статусе — следующая тема для каждой категории
This commit is contained in:
+10
-1
@@ -238,7 +238,16 @@ async function getAutogenStatus() {
|
||||
WHERE bt.category=s.category) AS topic_count,
|
||||
(SELECT COUNT(*) FROM articles a
|
||||
WHERE a.category=s.category AND a.status='draft'
|
||||
AND a.created_at >= NOW() - INTERVAL '24 hours') AS drafts_today
|
||||
AND a.created_at >= NOW() - INTERVAL '24 hours') AS drafts_today,
|
||||
-- следующая тема которую возьмёт генерация
|
||||
(SELECT bt.topic FROM blog_topics bt
|
||||
WHERE bt.category=s.category AND bt.is_used=false
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM articles a
|
||||
WHERE a.source_topic=bt.topic AND a.category=s.category
|
||||
)
|
||||
ORDER BY bt.priority DESC, bt.created_at ASC
|
||||
LIMIT 1) AS next_topic
|
||||
FROM autogen_settings s
|
||||
LEFT JOIN categories c ON c.slug=s.category
|
||||
ORDER BY s.run_hour, s.category`
|
||||
|
||||
Reference in New Issue
Block a user