37 lines
910 B
Go
37 lines
910 B
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"sundynix-micro-go/app/file/model"
|
|
"sundynix-micro-go/app/file/rpc/file"
|
|
"sundynix-micro-go/app/file/rpc/internal/svc"
|
|
)
|
|
|
|
type DeleteStorageConfigLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewDeleteStorageConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteStorageConfigLogic {
|
|
return &DeleteStorageConfigLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *DeleteStorageConfigLogic) DeleteStorageConfig(in *file.DeleteFilesReq) (*file.CommonResp, error) {
|
|
if len(in.Ids) == 0 {
|
|
return &file.CommonResp{Code: 400, Msg: "ids不能为空"}, nil
|
|
}
|
|
err := l.svcCtx.DB.Where("id IN ?", in.Ids).Delete(&model.StorageConfig{}).Error
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &file.CommonResp{Code: 0, Msg: "删除成功"}, nil
|
|
}
|