Skip to content

Commit

Permalink
fix: 在配置中增加CosHost,修复删除时的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Cbgogogog committed Jul 16, 2023
1 parent bbd36d5 commit bbaedac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Config struct {
AccessSecret string
AccessExpire int64
}
CosHost string
CdnHost string
CIHost string
CosApi struct {
Expand Down
5 changes: 4 additions & 1 deletion internal/logic/util/PhotoCheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ func PhotoCheck(ctx context.Context, svc *svc.ServiceContext, urls []string) (er
host := "https://" + svc.Config.CdnHost
for _, url := range urls {
name := url[len(host)+1:]
svc.CiClient.Object.Delete(ctx, name)
_, err = svc.CiClient.Object.Delete(ctx, name)
if err != nil {
return err
}
}
return errorx.ErrPhotoNotSec
}
Expand Down
2 changes: 1 addition & 1 deletion internal/svc/service_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ServiceContext struct {
}

func NewServiceContext(c config.Config) *ServiceContext {
bu, _ := url.Parse("https://" + c.CdnHost)
bu, _ := url.Parse("https://" + c.CosHost)
cu, _ := url.Parse("https://" + c.CIHost)
b := &cos.BaseURL{
BucketURL: bu,
Expand Down

0 comments on commit bbaedac

Please sign in to comment.