ziwen 1 year ago
parent
commit
07ee7d2723

+ 3 - 1
controllers/data_manage/chart_info.go

@@ -2230,6 +2230,7 @@ func (this *ChartInfoController) ChartInfoBase64Upload() {
 	saveToOssPath += outFileName
 
 	//上传到阿里云 和 minio
+	resourceUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadFileToMinIo("", outFileName, saveToOssPath)
 		if err != nil {
@@ -2237,6 +2238,7 @@ func (this *ChartInfoController) ChartInfoBase64Upload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.MinIoImghost + saveToOssPath
 	} else {
 		err = services.UploadFileToAliyun("", outFileName, saveToOssPath)
 		if err != nil {
@@ -2244,9 +2246,9 @@ func (this *ChartInfoController) ChartInfoBase64Upload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.Imghost + saveToOssPath
 	}
 
-	resourceUrl := utils.Imghost + saveToOssPath
 	resp.ResourceUrl = resourceUrl
 	resp.Source = "convert"
 	//resp.CacheKey = imgDataKey

+ 3 - 1
controllers/data_manage/future_good/future_good_chart_info.go

@@ -2218,6 +2218,7 @@ func (this *FutureGoodChartInfoController) ChartInfoBase64Upload() {
 	saveToOssPath = uploadDir + time.Now().Format("200601/20060102/")
 	saveToOssPath += outFileName
 	//上传到阿里云 和 minio
+	resourceUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadFileToMinIo("", outFileName, saveToOssPath)
 		if err != nil {
@@ -2225,6 +2226,7 @@ func (this *FutureGoodChartInfoController) ChartInfoBase64Upload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.MinIoImghost + saveToOssPath
 	} else {
 		err = services.UploadFileToAliyun("", outFileName, saveToOssPath)
 		if err != nil {
@@ -2232,8 +2234,8 @@ func (this *FutureGoodChartInfoController) ChartInfoBase64Upload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.Imghost + saveToOssPath
 	}
-	resourceUrl := utils.Imghost + saveToOssPath
 	resp.ResourceUrl = resourceUrl
 	resp.Source = "convert"
 	//resp.CacheKey = imgDataKey

+ 4 - 1
controllers/ppt_english.go

@@ -517,6 +517,7 @@ func (this *PptEnglishController) PptUpload() {
 	savePptxToOssPath += pptName + ".pptx"
 
 	//上传到阿里云 和 minio
+	pptxUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadFileToMinIo("", fpath, savePptxToOssPath)
 		if err != nil {
@@ -524,6 +525,7 @@ func (this *PptEnglishController) PptUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		pptxUrl = utils.MinIoImghost + savePptxToOssPath
 	} else {
 		err = services.UploadFileToAliyun("", fpath, savePptxToOssPath)
 		if err != nil {
@@ -531,9 +533,10 @@ func (this *PptEnglishController) PptUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		pptxUrl = utils.Imghost + savePptxToOssPath
 	}
 
-	pptxUrl := utils.Imghost + savePptxToOssPath
+
 
 	defer func() {
 		os.Remove(fpath)

+ 3 - 1
controllers/ppt_v2.go

@@ -518,6 +518,7 @@ func (this *PptV2Controller) PptUpload() {
 	savePptxToOssPath += pptName + ".pptx"
 
 	//上传到阿里云 和 minio
+	pptxUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadFileToMinIo("", fpath, savePptxToOssPath)
 		if err != nil {
@@ -525,6 +526,7 @@ func (this *PptV2Controller) PptUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		pptxUrl = utils.MinIoImghost + savePptxToOssPath
 	} else {
 		err = services.UploadFileToAliyun("", fpath, savePptxToOssPath)
 		if err != nil {
@@ -532,9 +534,9 @@ func (this *PptV2Controller) PptUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		pptxUrl = utils.Imghost + savePptxToOssPath
 	}
 
-	pptxUrl := utils.Imghost + savePptxToOssPath
 
 	defer func() {
 		os.Remove(fpath)

+ 12 - 3
controllers/resource.go

@@ -241,6 +241,7 @@ func (this *ResourceController) VideoUpload() {
 	savePath += fileName
 
 	//上传到阿里云 和 minio
+	resourceUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadVideoToMinIo(fileName, fpath, savePath)
 		if err != nil {
@@ -248,6 +249,7 @@ func (this *ResourceController) VideoUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.MinIoImghost + savePath
 	} else {
 		err = services.UploadVideoAliyun(fileName, fpath, savePath)
 		if err != nil {
@@ -255,10 +257,11 @@ func (this *ResourceController) VideoUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.Imghost + savePath
 	}
 	utils.FileLog.Info("%s:", time.Now().Format(utils.FormatDateTime))
 	utils.FileLog.Info("end update oss ")
-	resourceUrl := utils.Imghost + savePath
+
 
 	item := new(models.Resource)
 	item.ResourceUrl = resourceUrl
@@ -415,6 +418,7 @@ func (this *ResourceController) VoiceUpload() {
 	savePath := utils.Upload_Audio_Dir + time.Now().Format("200601/20060102/")
 	savePath += fileName
 	//上传到阿里云 和 minio
+	resourceUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadVideoToMinIo(fileName, fpath, savePath)
 		if err != nil {
@@ -422,6 +426,7 @@ func (this *ResourceController) VoiceUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.MinIoImghost + savePath
 	} else {
 		err = services.UploadVideoAliyun(fileName, fpath, savePath)
 		if err != nil {
@@ -429,10 +434,11 @@ func (this *ResourceController) VoiceUpload() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.Imghost + savePath
 	}
 	utils.FileLog.Info(fmt.Sprintf("%s:", time.Now().Format(utils.FormatDateTime)))
 	utils.FileLog.Info("end update oss ")
-	resourceUrl := utils.Imghost + savePath
+
 
 	item := new(models.Resource)
 	item.ResourceUrl = resourceUrl
@@ -577,6 +583,7 @@ func (this *ResourceController) UploadImageBase64() {
 	savePath += fileName
 
 	//上传到阿里云 和 minio
+	resourceUrl := ``
 	if utils.ObjectStorageClient == "minio" {
 		err = services.UploadFileToMinIo(fileName, fpath, savePath)
 		if err != nil {
@@ -584,6 +591,7 @@ func (this *ResourceController) UploadImageBase64() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.MinIoImghost + savePath
 	} else {
 		err = services.UploadFileToAliyun(fileName, fpath, savePath)
 		if err != nil {
@@ -591,11 +599,12 @@ func (this *ResourceController) UploadImageBase64() {
 			br.ErrMsg = "文件上传失败,Err:" + err.Error()
 			return
 		}
+		resourceUrl = utils.Imghost + savePath
 	}
 	utils.FileLog.Info("%s:", time.Now().Format(utils.FormatDateTime))
 	utils.FileLog.Info("end update oss ")
 
-	resourceUrl := utils.Imghost + savePath
+
 
 	item := new(models.Resource)
 	item.ResourceUrl = resourceUrl

+ 3 - 1
services/report.go

@@ -644,15 +644,17 @@ func reportBase64ToImg(imageBase64 string) (resourceUrl string, err error) {
 			err = errors.New("文件上传失败" + err.Error())
 			return
 		}
+		resourceUrl = utils.MinIoImghost + savePath
 	} else {
 		err = UploadFileToAliyun(fileName, fpath, savePath)
 		if err != nil {
 			err = errors.New("文件上传失败" + err.Error())
 			return
 		}
+		resourceUrl = utils.Imghost + savePath
 	}
 
-	resourceUrl = utils.Imghost + savePath
+
 
 	item := new(models.Resource)
 	item.ResourceUrl = resourceUrl