Skip to content

Commit e434064

Browse files
author
v_zhibsong
committed
change filemove
1 parent 35738cf commit e434064

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

server/service/sys_auto_code.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ import (
1212
)
1313

1414
type tplData struct {
15-
template *template.Template
16-
locationPath string
17-
autoCodePath string
18-
autoMoveFilePath string
15+
template *template.Template
16+
locationPath string
17+
autoCodePath string
1918
}
2019

2120
// @title CreateTemp
@@ -99,7 +98,7 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) {
9998
// 判断是否需要自动转移
10099
for _, value := range dataList {
101100
// 转移
102-
err := utils.FileMove(value.locationPath, value.autoCodePath)
101+
err := utils.FileMove(value.autoCodePath, utils.GetAutoPath(value.autoCodePath))
103102
if err != nil {
104103
return err
105104
}

server/utils/file_operations.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ func FileMove(src string, dst string) error {
5959
}
6060
return err
6161
}
62+
63+
// GetAutoPath 根据生成路径生成移动路径
64+
func GetAutoPath(path string) string {
65+
return filepath.Base(filepath.Dir(path))
66+
}

0 commit comments

Comments
 (0)