diff --git a/internal/config/config.go b/internal/config/config.go index ae8c399..6303f1a 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -11,6 +11,7 @@ type Config struct { AccessSecret string AccessExpire int64 } + CosHost string CdnHost string CIHost string CosApi struct { diff --git a/internal/logic/util/PhotoCheck.go b/internal/logic/util/PhotoCheck.go index 5ae890b..3491421 100644 --- a/internal/logic/util/PhotoCheck.go +++ b/internal/logic/util/PhotoCheck.go @@ -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 } diff --git a/internal/svc/service_context.go b/internal/svc/service_context.go index 23a17b5..2851a69 100644 --- a/internal/svc/service_context.go +++ b/internal/svc/service_context.go @@ -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,