deletelogic.go 892 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "context"
  4. "app.yhyue.com/moapp/jybase/common"
  5. "bp.jydev.jianyu360.cn/BaseService/fileCenter/entity"
  6. "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/fileCenter/rpc/pb"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type DeleteLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLogic {
  16. return &DeleteLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 文件删除
  23. func (l *DeleteLogic) Delete(in *pb.DeleteFileReq) (*pb.FileResp, error) {
  24. // todo: add your logic here and delete this line
  25. resp := &pb.FileResp{
  26. Status: 0,
  27. }
  28. b, err := entity.OssDelObject(in.Name, common.InterfaceToStr(in.OssBucketName))
  29. if err == nil && b {
  30. resp.Status = 1
  31. }
  32. return resp, nil
  33. }