fix(autogen/status): показываем topic_count_free/total из blog_topics
getAutogenStatus теперь считает: - topic_count_free: свободных тем для генерации - topic_count: всего тем в банке - drafts_today: черновиков созданных за 24ч - cat_icon, cat_color: из таблицы categories Убрана ссылка на несуществующую content_queue (queue_count).
This commit is contained in:
+11
-4
@@ -210,12 +210,19 @@ async function runAutogen({ forceCategory = null } = {}) {
|
|||||||
*/
|
*/
|
||||||
async function getAutogenStatus() {
|
async function getAutogenStatus() {
|
||||||
const { rows: settings } = await query(
|
const { rows: settings } = await query(
|
||||||
`SELECT s.*, c.name as cat_name,
|
`SELECT s.*, c.name as cat_name, c.icon as cat_icon, c.color as cat_color,
|
||||||
(SELECT COUNT(*) FROM content_queue q WHERE q.category=s.category AND q.status='pending') as queue_count,
|
(SELECT COUNT(*) FROM articles a
|
||||||
(SELECT COUNT(*) FROM articles a WHERE a.category=s.category AND a.status='published') as article_count
|
WHERE a.category=s.category AND a.status='published') AS article_count,
|
||||||
|
(SELECT COUNT(*) FROM blog_topics bt
|
||||||
|
WHERE bt.category=s.category AND bt.is_used=false) AS topic_count_free,
|
||||||
|
(SELECT COUNT(*) FROM blog_topics bt
|
||||||
|
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
|
||||||
FROM autogen_settings s
|
FROM autogen_settings s
|
||||||
LEFT JOIN categories c ON c.slug=s.category
|
LEFT JOIN categories c ON c.slug=s.category
|
||||||
ORDER BY s.category`
|
ORDER BY s.run_hour, s.category`
|
||||||
);
|
);
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user