Skip to content

Commit ce37b82

Browse files
committed
处理多余的判断
1 parent ffdd9c5 commit ce37b82

1 file changed

Lines changed: 0 additions & 18 deletions

File tree

internal/service/script_svc/script.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,24 +1007,6 @@ func (s *scriptSvc) Delete(ctx context.Context, script *script_entity.Script, re
10071007
return nil, err
10081008
}
10091009
script.Status = consts.DELETE
1010-
// 判断是否有正式版本
1011-
oldCode, err := script_repo.ScriptCode().FindLatest(ctx, script.ID, 0, false)
1012-
if err != nil {
1013-
return nil, err
1014-
}
1015-
if oldCode == nil {
1016-
return nil, i18n.NewError(ctx, code.ScriptDeleteReleaseNotLatest)
1017-
}
1018-
if oldCode.ID == req.ID {
1019-
// 最新版本和要删除的版本相同, 再判断一下是否有下一个版本
1020-
oldCode, err = script_repo.ScriptCode().FindLatest(ctx, script.ID, 1, false)
1021-
if err != nil {
1022-
return nil, err
1023-
}
1024-
if oldCode == nil {
1025-
return nil, i18n.NewError(ctx, code.ScriptDeleteReleaseNotLatest)
1026-
}
1027-
}
10281010
if err := script_repo.Script().Update(ctx, script); err != nil {
10291011
return nil, err
10301012
}

0 commit comments

Comments
 (0)