From a01236be5dd7da86dd26f5dddca5d6440658304a Mon Sep 17 00:00:00 2001 From: SliverHorn Date: Sat, 7 Nov 2020 18:24:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/service/sys_auto_code.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go index 62fe21e8..12ba2d98 100644 --- a/server/service/sys_auto_code.go +++ b/server/service/sys_auto_code.go @@ -1,6 +1,7 @@ package service import ( + "errors" "fmt" "gin-vue-admin/global" "gin-vue-admin/model" @@ -101,13 +102,12 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) { addAutoMoveFile(&dataList[index]) } for _, value := range dataList { // 移动文件 - err := utils.FileMove(value.autoCodePath, value.autoMoveFilePath) - if err != nil { + if err := utils.FileMove(value.autoCodePath, value.autoMoveFilePath); err != nil { fmt.Println(err) return err } } - return + return errors.New("创建代码成功并移动文件成功") } else { // 打包 if err := utils.ZipFiles("./ginvueadmin.zip", fileList, ".", "."); err != nil { return err @@ -174,7 +174,7 @@ func addAutoMoveFile(data *tplData) { } else if strings.Contains(data.autoCodePath, "form") { formList := strings.Split(data.autoCodePath, "/") data.autoMoveFilePath = filepath.Join("../", "web", "view", formList[len(formList)-3], strings.Split(formList[len(formList)-1], ".")[0]+"From.vue") - } else if strings.Contains(data.autoCodePath, "form") { + } else if strings.Contains(data.autoCodePath, "table") { vueList := strings.Split(data.autoCodePath, "/") data.autoMoveFilePath = filepath.Join("../", "web", "view", vueList[len(vueList)-3], vueList[len(vueList)-1]) }