初始化项目

This commit is contained in:
2025-12-10 15:41:52 +08:00
parent 339dd97f66
commit 232009bbc2
25 changed files with 419 additions and 467 deletions

View File

@@ -25,14 +25,14 @@ func (s *adSourceService) GetSourcesByProvider(ctx context.Context, provider str
}
// CreateAdSource 创建广告源
func (s *adSourceService) CreateAdSource(ctx context.Context, req *dto.CreateAdSourceReq) (id int64, err error) {
func (s *adSourceService) CreateAdSource(ctx context.Context, req *dto.CreateAdSourceReq) (id string, err error) {
// 检查广告源名称是否已存在
existingSource, err := dao.AdSource.GetByName(ctx, req.Name)
if err != nil {
return 0, err
return "", err
}
if existingSource != nil {
return 0, gerror.New("广告源名称已存在")
return "", gerror.New("广告源名称已存在")
}
adSource := &entity.AdSource{
@@ -49,7 +49,7 @@ func (s *adSourceService) CreateAdSource(ctx context.Context, req *dto.CreateAdS
}
// UpdateAdSource 更新广告源
func (s *adSourceService) UpdateAdSource(ctx context.Context, id int64, req *dto.UpdateAdSourceReq) (affected int64, err error) {
func (s *adSourceService) UpdateAdSource(ctx context.Context, id string, req *dto.UpdateAdSourceReq) (affected int64, err error) {
// 检查广告源是否存在
existingSource, err := dao.AdSource.GetByID(ctx, id)
@@ -84,7 +84,7 @@ func (s *adSourceService) UpdateAdSource(ctx context.Context, id int64, req *dto
}
// DeleteAdSource 删除广告源
func (s *adSourceService) DeleteAdSource(ctx context.Context, id int64) (affected int64, err error) {
func (s *adSourceService) DeleteAdSource(ctx context.Context, id string) (affected int64, err error) {
// 检查广告源是否存在
existingSource, err := dao.AdSource.GetByID(ctx, id)
if err != nil {
@@ -98,6 +98,6 @@ func (s *adSourceService) DeleteAdSource(ctx context.Context, id int64) (affecte
}
// GetAdSourceByID 根据ID获取广告源
func (s *adSourceService) GetAdSourceByID(ctx context.Context, id int64) (adSource *entity.AdSource, err error) {
func (s *adSourceService) GetAdSourceByID(ctx context.Context, id string) (adSource *entity.AdSource, err error) {
return dao.AdSource.GetByID(ctx, id)
}