feat(ECR-024): OpsCMS Banner 只读并 Closed

运营横幅目录(ops_banners + admin /cms),锁定 024–040 全队列。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-08 03:05:55 +08:00
co-authored by Cursor
parent ac1aec857d
commit 32ac559385
30 changed files with 808 additions and 3 deletions
+34
View File
@@ -0,0 +1,34 @@
package admin
import (
"context"
"errors"
"github.com/google/uuid"
"github.com/jackc/pgx/v5"
"github.com/yuxingu/digital-psychology/apps/api/internal/repository"
)
var ErrBannerNotFound = errString("banner not found")
// ListBanners returns OpsCMS Banner catalog.
func (s *Service) ListBanners(ctx context.Context) ([]repository.BannerRow, error) {
items, err := s.Repo.ListBanners(ctx)
if err != nil {
return nil, err
}
if items == nil {
items = []repository.BannerRow{}
}
return items, nil
}
// GetBanner loads one banner.
func (s *Service) GetBanner(ctx context.Context, id uuid.UUID) (*repository.BannerRow, error) {
row, err := s.Repo.GetBanner(ctx, id)
if errors.Is(err, pgx.ErrNoRows) {
return nil, ErrBannerNotFound
}
return row, err
}