ref: v3变更,,同步v2.2508.4
This commit is contained in:
@@ -87,7 +87,7 @@ func (r NeSoftware) Update(neSoftware model.NeSoftware) int64 {
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r NeSoftware) DeleteByIds(ids []int64) (int64, error) {
|
||||
func (r NeSoftware) DeleteByIds(ids []int64, delFile bool) (int64, error) {
|
||||
// 检查是否存在
|
||||
rows := r.neSoftwareRepository.SelectByIds(ids)
|
||||
if len(rows) <= 0 {
|
||||
@@ -95,14 +95,16 @@ func (r NeSoftware) DeleteByIds(ids []int64) (int64, error) {
|
||||
}
|
||||
|
||||
if len(rows) == len(ids) {
|
||||
// 遍历软件包列表进行文件删除
|
||||
for _, row := range rows {
|
||||
// 检查文件是否存在
|
||||
filePath := file.ParseUploadFileAbsPath(row.Path)
|
||||
if _, err := os.Stat(filePath); err != nil {
|
||||
continue
|
||||
if delFile {
|
||||
// 遍历软件包列表进行文件删除
|
||||
for _, row := range rows {
|
||||
// 检查文件是否存在
|
||||
filePath := file.ParseUploadFileAbsPath(row.Path)
|
||||
if _, err := os.Stat(filePath); err != nil {
|
||||
continue
|
||||
}
|
||||
os.Remove(filePath)
|
||||
}
|
||||
os.Remove(filePath)
|
||||
}
|
||||
rows := r.neSoftwareRepository.DeleteByIds(ids)
|
||||
return rows, nil
|
||||
|
||||
Reference in New Issue
Block a user