feat(ECR-041): OpsCMS Banner 薄写面(Write-Wave 首刀)
Admin POST/PUT + admin.cms.write/审计;C 端 GET /home/banners;首页投影回退静态 homeFeeds;migration 000051;不碰 FeedSlot/支付/UGC。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -31,6 +31,7 @@ type Service struct {
|
||||
Repo *repository.HomeToolsRepo
|
||||
Tips *repository.HomeDailyTipsRepo
|
||||
Profiles *repository.ProfileRepo
|
||||
CMS *repository.AdminRepo
|
||||
LLM *deepseek.Client
|
||||
}
|
||||
|
||||
@@ -39,6 +40,24 @@ func (s *Service) ListPublic(ctx context.Context) ([]repository.HomeTool, error)
|
||||
return s.Repo.ListEnabled(ctx)
|
||||
}
|
||||
|
||||
// ListPublicBanners returns active banners for placement (default home).
|
||||
func (s *Service) ListPublicBanners(ctx context.Context, placement string) ([]repository.BannerRow, error) {
|
||||
if placement == "" {
|
||||
placement = "home"
|
||||
}
|
||||
if s.CMS == nil {
|
||||
return []repository.BannerRow{}, nil
|
||||
}
|
||||
items, err := s.CMS.ListActiveBanners(ctx, placement)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if items == nil {
|
||||
items = []repository.BannerRow{}
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// ListAdmin returns all tools.
|
||||
func (s *Service) ListAdmin(ctx context.Context) ([]repository.HomeTool, error) {
|
||||
return s.Repo.ListAll(ctx)
|
||||
|
||||
Reference in New Issue
Block a user