作者 唐旭辉

文件上传修改

@@ -33,7 +33,7 @@ ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" @@ -33,7 +33,7 @@ ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b"
33 ucenter_secret = "cykbjnfqgctn" 33 ucenter_secret = "cykbjnfqgctn"
34 34
35 # 上传文件保存路径 35 # 上传文件保存路径
36 -file_save_path = "/var/www/oppmg/file" 36 +file_save_path = "/var/www/oppmg/file/opportunity"
37 file_host = "http://mmm-oppmg-dev.fjmaimaimai.com" 37 file_host = "http://mmm-oppmg-dev.fjmaimaimai.com"
38 file_host_path = "/file/opp" 38 file_host_path = "/file/opp"
39 39
@@ -58,7 +58,7 @@ func saveFile(fileData *multipart.FileHeader, fileType string) (hostpath string, @@ -58,7 +58,7 @@ func saveFile(fileData *multipart.FileHeader, fileType string) (hostpath string,
58 } 58 }
59 subfix := path.Ext(fileData.Filename) 59 subfix := path.Ext(fileData.Filename)
60 mfileName := fmt.Sprint(utils.GenerateIDBySonyflake()) 60 mfileName := fmt.Sprint(utils.GenerateIDBySonyflake())
61 - mfileName = fmt.Sprintf("%d_%s%s", time.Now().Unix(), mfileName, subfix) 61 + mfileName = fmt.Sprintf("%d_%s.%s", time.Now().Unix(), mfileName, subfix)
62 log.Debug("文件保存地址%s", filepath.Join(savepath, mfileName)) 62 log.Debug("文件保存地址%s", filepath.Join(savepath, mfileName))
63 dst, err := os.Create(filepath.Join(savepath, mfileName)) 63 dst, err := os.Create(filepath.Join(savepath, mfileName))
64 defer dst.Close() 64 defer dst.Close()