Files
Mycontent/soul-api/internal/model/super_article.go
乘风 99d65dc664 feat: add super article management features and enhance UI
- 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.
2026-05-09 17:49:45 +08:00

35 lines
1.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"strings"
"time"
)
// 超级个体动态审核状态(管理端通过后出现在广场)
const (
SuperArticleAuditPending = "pending"
SuperArticleAuditApproved = "approved"
SuperArticleAuditRejected = "rejected"
)
// SuperArticle 超级个体发布的文章(小程序端)
type SuperArticle struct {
ID uint `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
UserID string `gorm:"column:user_id;size:50;index:idx_super_articles_user_time" json:"userId"`
Title string `gorm:"column:title;size:200" json:"title"`
Content string `gorm:"column:content;type:text" json:"content"`
Images string `gorm:"column:images;type:text" json:"-"` // JSON ["url"...]
AuditStatus string `gorm:"column:audit_status;size:32;index:idx_super_articles_audit_status" json:"auditStatus"`
RejectReason string `gorm:"column:reject_reason;type:text" json:"rejectReason"`
CreatedAt time.Time `gorm:"column:created_at;index:idx_super_articles_user_time" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at" json:"updatedAt"`
}
func (SuperArticle) TableName() string { return "super_articles" }
// SuperArticlePublicApproved 是否对访客可见(广场/嘉宾主页/H5
func SuperArticlePublicApproved(status string) bool {
s := strings.TrimSpace(strings.ToLower(status))
return s == "" || s == SuperArticleAuditApproved
}