diff --git a/internal/dao/storage/localoss.go b/internal/dao/storage/localoss.go index 81ab2435..6ed4a165 100644 --- a/internal/dao/storage/localoss.go +++ b/internal/dao/storage/localoss.go @@ -72,8 +72,11 @@ func (s *localossServant) DeleteObjcets(objectKeys []string) (err error) { } func (s *localossServant) IsObjectExist(objectKey string) (bool, error) { - // TODO - return false, nil + fi, err := os.Stat(s.savePath + objectKey) + if err != nil { + return false, err + } + return !fi.IsDir(), nil } func (s *localossServant) SignURL(objectKey string, expiredInSec int64) (string, error) { diff --git a/internal/model/post_content.go b/internal/model/post_content.go index d5552e78..3829ca8c 100644 --- a/internal/model/post_content.go +++ b/internal/model/post_content.go @@ -39,6 +39,7 @@ type PostContent struct { Type PostContentT `json:"type"` Sort int64 `json:"sort"` } + type PostContentFormated struct { ID int64 `json:"id"` PostID int64 `json:"post_id"` diff --git a/internal/routers/api/post.go b/internal/routers/api/post.go index 900f04e2..f580428f 100644 --- a/internal/routers/api/post.go +++ b/internal/routers/api/post.go @@ -101,7 +101,7 @@ func DeletePost(c *gin.Context) { err := service.DeletePost(user, param.ID) if err != nil { logrus.Errorf("service.DeletePost err: %v\n", err) - response.ToErrorResponse(errcode.DeletePostFailed) + response.ToErrorResponse(err) return }