add timed
This commit is contained in:
@@ -268,8 +268,7 @@ func (r *GormArticleRepository) ListArticles(ctx context.Context, query *repoQue
|
||||
var articles []entities.Article
|
||||
var total int64
|
||||
|
||||
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}).
|
||||
Select("id, title, summary, cover_image, category_id, status, is_featured, published_at, created_at, updated_at, scheduled_at")
|
||||
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{})
|
||||
|
||||
// 用户端不显示归档文章
|
||||
dbQuery = dbQuery.Where("status != ?", entities.ArticleStatusArchived)
|
||||
@@ -357,8 +356,7 @@ func (r *GormArticleRepository) ListArticlesForAdmin(ctx context.Context, query
|
||||
var articles []entities.Article
|
||||
var total int64
|
||||
|
||||
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{}).
|
||||
Select("id, title, summary, cover_image, category_id, status, is_featured, published_at, view_count, created_at, updated_at, scheduled_at")
|
||||
dbQuery := r.db.WithContext(ctx).Model(&entities.Article{})
|
||||
|
||||
// 应用筛选条件
|
||||
if query.Status != "" {
|
||||
|
||||
@@ -142,8 +142,8 @@ func (r *GormTagRepository) AddTagToArticle(ctx context.Context, articleID strin
|
||||
|
||||
// 创建关联
|
||||
err = r.db.WithContext(ctx).Exec(`
|
||||
INSERT INTO article_tag_relations (id, article_id, tag_id, created_at)
|
||||
VALUES (UUID(), ?, ?, NOW())
|
||||
INSERT INTO article_tag_relations (article_id, tag_id)
|
||||
VALUES (?, ?)
|
||||
`, articleID, tagID).Error
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user