feat: 完成 #38 营销图CRUD接口下载校验与测试

This commit is contained in:
root
2026-03-09 19:17:01 +08:00
parent e14255cf64
commit efff6eb7d4
4 changed files with 156 additions and 4 deletions
@@ -70,10 +70,10 @@ func (r *TemplateRepository) FindByID(id uint) (*model.MarketingTemplate, error)
}
type TemplateListParams struct {
CategoryID uint
CategoryID uint
OnlyEnabled bool
Page int
PageSize int
Page int
PageSize int
}
func (r *TemplateRepository) FindList(params TemplateListParams) ([]model.MarketingTemplate, int64, error) {
@@ -116,5 +116,8 @@ func (r *TemplateRepository) IncrementDownloadCount(id uint) error {
if tx.Error != nil {
return fmt.Errorf("increment download count: %w", tx.Error)
}
if tx.RowsAffected == 0 {
return ErrTemplateNotFound
}
return nil
}