Browse Source

Merge branch 'gva_gormv2_dev' of https://github.com/flipped-aurora/gin-vue-admin into gva_gormv2_dev

main
piexlmax 3 years ago
parent
commit
964dd1f22a
  1. 2
      server/go.mod
  2. 13
      server/service/system/sys_autocode_history.go

2
server/go.mod

@ -10,7 +10,6 @@ require (
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
github.com/casbin/casbin/v2 v2.11.0 github.com/casbin/casbin/v2 v2.11.0
github.com/casbin/gorm-adapter/v3 v3.0.2 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/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
github.com/fsnotify/fsnotify v1.4.9 github.com/fsnotify/fsnotify v1.4.9
@ -37,7 +36,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/qiniu/api.v7/v7 v7.4.1 github.com/qiniu/api.v7/v7 v7.4.1
github.com/robfig/cron/v3 v3.0.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/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v3.21.1+incompatible github.com/shirou/gopsutil v3.21.1+incompatible
github.com/spf13/afero v1.2.2 // indirect github.com/spf13/afero v1.2.2 // indirect

13
server/service/system/sys_autocode_history.go

@ -1,11 +1,14 @@
package system package system
import ( import (
"fmt"
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model/common/request" "gin-vue-admin/model/common/request"
"gin-vue-admin/model/system" "gin-vue-admin/model/system"
"gin-vue-admin/utils" "gin-vue-admin/utils"
"path/filepath"
"strings" "strings"
"time"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -55,8 +58,16 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(id uint) error {
} }
} }
// 删除文件 // 删除文件
for _, path := range strings.Split(md.AutoCodePath, ";") { 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, ";") { for _, v := range strings.Split(md.InjectionMeta, ";") {

Loading…
Cancel
Save