|
1 | 1 | package service |
2 | 2 |
|
3 | 3 | import ( |
4 | | - "errors" |
5 | 4 | "fmt" |
6 | 5 | "gin-vue-admin/global" |
7 | 6 | "gin-vue-admin/model" |
@@ -107,7 +106,7 @@ func CreateTemp(autoCode model.AutoCodeStruct) (err error) { |
107 | 106 | return err |
108 | 107 | } |
109 | 108 | } |
110 | | - return errors.New("创建代码成功并移动文件成功") |
| 109 | + return model.AutoMoveErr |
111 | 110 | } else { // 打包 |
112 | 111 | if err := utils.ZipFiles("./ginvueadmin.zip", fileList, ".", "."); err != nil { |
113 | 112 | return err |
@@ -149,38 +148,6 @@ func GetColumn(tableName string, dbName string) (err error, Columns []request.Co |
149 | 148 | return err, Columns |
150 | 149 | } |
151 | 150 |
|
152 | | -//func addAutoMoveFile(data *tplData) { |
153 | | -// if strings.Contains(data.autoCodePath, "server") { |
154 | | -// if strings.Contains(data.autoCodePath, "router") { |
155 | | -// apiList := strings.Split(data.autoCodePath, "/") |
156 | | -// data.autoMoveFilePath = filepath.Join(apiList[len(apiList)-2], apiList[len(apiList)-1]) |
157 | | -// } else if strings.Contains(data.autoCodePath, "api") { |
158 | | -// apiList := strings.Split(data.autoCodePath, "/") |
159 | | -// data.autoMoveFilePath = filepath.Join(apiList[len(apiList)-2], "v1", apiList[len(apiList)-1]) |
160 | | -// } else if strings.Contains(data.autoCodePath, "service") { |
161 | | -// serviceList := strings.Split(data.autoCodePath, "/") |
162 | | -// data.autoMoveFilePath = filepath.Join(serviceList[len(serviceList)-2], serviceList[len(serviceList)-1]) |
163 | | -// } else if strings.Contains(data.autoCodePath, "model") { |
164 | | -// modelList := strings.Split(data.autoCodePath, "/") |
165 | | -// data.autoMoveFilePath = filepath.Join(modelList[len(modelList)-2], modelList[len(modelList)-1]) |
166 | | -// } else if strings.Contains(data.autoCodePath, "request") { |
167 | | -// requestList := strings.Split(data.autoCodePath, "/") |
168 | | -// data.autoMoveFilePath = filepath.Join("model", requestList[len(requestList)-2], requestList[len(requestList)-1]) |
169 | | -// } |
170 | | -// } else if strings.Contains(data.autoCodePath, "web") { |
171 | | -// if strings.Contains(data.autoCodePath, "js") { |
172 | | -// jsList := strings.Split(data.autoCodePath, "/") |
173 | | -// data.autoMoveFilePath = filepath.Join("../", "web", "src", jsList[len(jsList)-2], jsList[len(jsList)-1]) |
174 | | -// } else if strings.Contains(data.autoCodePath, "form") { |
175 | | -// formList := strings.Split(data.autoCodePath, "/") |
176 | | -// data.autoMoveFilePath = filepath.Join("../", "web", "src", "view", formList[len(formList)-3], strings.Split(formList[len(formList)-1], ".")[0]+"From.vue") |
177 | | -// } else if strings.Contains(data.autoCodePath, "table") { |
178 | | -// vueList := strings.Split(data.autoCodePath, "/") |
179 | | -// data.autoMoveFilePath = filepath.Join("../", "web", "src", "view", vueList[len(vueList)-3], vueList[len(vueList)-1]) |
180 | | -// } |
181 | | -// } |
182 | | -//} |
183 | | - |
184 | 151 | func addAutoMoveFile(data *tplData) { |
185 | 152 | dir := filepath.Base(filepath.Dir(data.autoCodePath)) |
186 | 153 | base := filepath.Base(data.autoCodePath) |
|
0 commit comments