Skip to content

Commit

Permalink
fix downlod api
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Dec 12, 2019
1 parent 3aa894b commit deb614f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions routers/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func DownloadStructFile(c *gin.Context) {
return
}

if downLoadInfo.StructName == "" {
downLoadInfo.StructName = "new_struct"
}
if downLoadInfo.Content == "" {
services.HandleError(http.StatusBadRequest, c, err)
return
}

var filename = filepath.Join(viper.GetString("genFilePath"), downLoadInfo.StructName) + ".go"
if !utils.CheckFileIsExist(filename) {
file, err := os.Create(filename) //创建文件
Expand Down

0 comments on commit deb614f

Please sign in to comment.