- Introduced a new page for managing user-specific articles, allowing users to view and edit their submissions. - Implemented article audit status handling, including visual indicators for pending, approved, and rejected articles. - Enhanced the article detail view with audit feedback and editing capabilities for articles in pending or rejected states. - Updated the UI to dynamically reflect ownership and article status, improving user experience and clarity. This update aims to streamline article management for users and provide better feedback on article submission statuses.
29 lines
1.8 KiB
SQL
29 lines
1.8 KiB
SQL
-- 超级个体文章表(与 soul-api/internal/model/super_article.go、ensureSuperArticlesTableRaw 一致)
|
||
-- 缺表时报:Error 1146 (42S02): Table 'xxx.super_articles' doesn't exist(如 souldev、soul_miniprogram)
|
||
-- 在目标库执行:mysql -u... -p souldev < create_super_articles.sql
|
||
-- 或使用 Navicat 选中对应库后运行本脚本。
|
||
-- 若 soul-api 已含 ensureSuperArticlesTableRaw:重启 API(SKIP_AUTO_MIGRATE=1 也会自动建表)即可。
|
||
-- 审核:audit_status pending=待审 approved=已通过 rejected=已驳回;旧库补列见 database.ensureSuperArticleAuditColumns
|
||
|
||
CREATE TABLE IF NOT EXISTS `super_articles` (
|
||
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
|
||
`user_id` varchar(50) NOT NULL COMMENT '作者 users.id',
|
||
`title` varchar(200) NOT NULL DEFAULT '',
|
||
`content` longtext COMMENT '正文',
|
||
`images` longtext COMMENT '配图 URL JSON 数组,最多 9 张',
|
||
`audit_status` varchar(32) NOT NULL DEFAULT 'pending' COMMENT 'pending/approved/rejected',
|
||
`reject_reason` longtext COMMENT '驳回原因',
|
||
`created_at` datetime(3) DEFAULT NULL,
|
||
`updated_at` datetime(3) DEFAULT NULL,
|
||
PRIMARY KEY (`id`),
|
||
KEY `idx_super_articles_user_time` (`user_id`,`created_at`),
|
||
KEY `idx_super_articles_audit_status` (`audit_status`)
|
||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||
COMMENT='超级个体发文(小程序 /s/:id H5)';
|
||
|
||
-- 已有表缺列时执行:
|
||
-- ALTER TABLE super_articles ADD COLUMN images LONGTEXT NULL COMMENT '配图 URL JSON 数组,最多 9 张';
|
||
-- ALTER TABLE super_articles ADD COLUMN audit_status VARCHAR(32) NOT NULL DEFAULT 'approved' COMMENT 'pending/approved/rejected';
|
||
-- ALTER TABLE super_articles ADD COLUMN reject_reason LONGTEXT NULL COMMENT '驳回原因';
|
||
-- UPDATE super_articles SET audit_status='approved' WHERE audit_status IS NULL OR TRIM(audit_status)='';
|