Browse Source
Merge pull request #610 from songzhibin97/gva_gormv2_dev
feat:回滚文件迁移到垃圾桶,并非直接删除
main
奇淼(piexlmax
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
12 additions and
3 deletions
-
server/go.mod
-
server/service/system/sys_autocode_history.go
|
|
@ -10,7 +10,6 @@ require ( |
|
|
|
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect |
|
|
|
github.com/casbin/casbin/v2 v2.11.0 |
|
|
|
github.com/casbin/gorm-adapter/v3 v3.0.2 |
|
|
|
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect |
|
|
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible |
|
|
|
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect |
|
|
|
github.com/fsnotify/fsnotify v1.4.9 |
|
|
@ -37,7 +36,6 @@ require ( |
|
|
|
github.com/pkg/errors v0.9.1 // indirect |
|
|
|
github.com/qiniu/api.v7/v7 v7.4.1 |
|
|
|
github.com/robfig/cron/v3 v3.0.1 |
|
|
|
github.com/russross/blackfriday/v2 v2.1.0 // indirect |
|
|
|
github.com/satori/go.uuid v1.2.0 |
|
|
|
github.com/shirou/gopsutil v3.21.1+incompatible |
|
|
|
github.com/spf13/afero v1.2.2 // indirect |
|
|
|
|
|
@ -1,11 +1,14 @@ |
|
|
|
package system |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"gin-vue-admin/global" |
|
|
|
"gin-vue-admin/model/common/request" |
|
|
|
"gin-vue-admin/model/system" |
|
|
|
"gin-vue-admin/utils" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
|
|
|
|
"go.uber.org/zap" |
|
|
|
) |
|
|
@ -55,8 +58,16 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(id uint) error { |
|
|
|
} |
|
|
|
} |
|
|
|
// 删除文件
|
|
|
|
|
|
|
|
for _, path := range strings.Split(md.AutoCodePath, ";") { |
|
|
|
_ = utils.DeLFile(path) |
|
|
|
// 迁移
|
|
|
|
nPath := filepath.Join(global.GVA_CONFIG.AutoCode.Root, |
|
|
|
"rm_file", time.Now().Format("20060102"), filepath.Base(filepath.Dir(filepath.Dir(path))), filepath.Base(filepath.Dir(path)), filepath.Base(path)) |
|
|
|
err = utils.FileMove(path, nPath) |
|
|
|
if err != nil { |
|
|
|
fmt.Println(">>>>>>>>>>>>>>>>>>>", err) |
|
|
|
} |
|
|
|
//_ = utils.DeLFile(path)
|
|
|
|
} |
|
|
|
// 清除注入
|
|
|
|
for _, v := range strings.Split(md.InjectionMeta, ";") { |
|
|
|