feat: 完成 #38 营销图CRUD接口下载校验与测试
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user