zwxi 10 months ago
parent
commit
1c499e25a6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      controller/public.go

+ 4 - 1
controller/public.go

@@ -686,7 +686,10 @@ func BannerDowload(c *gin.Context) {
 		randStr := utils.GetRandStringNoSpecialChar(28)
 		randStr := utils.GetRandStringNoSpecialChar(28)
 		jpegPath := `./static/` + randStr + ".jpeg"
 		jpegPath := `./static/` + randStr + ".jpeg"
 		err := services.ReportToJpeg(req.BannerUrl, jpegPath)
 		err := services.ReportToJpeg(req.BannerUrl, jpegPath)
-
+		if err != nil {
+			response.FailData("图片转jpeg失败", "图片转jpeg失败,Err:"+err.Error(), c)
+			return
+		}
 		dateDir := time.Now().Format("20060102")
 		dateDir := time.Now().Format("20060102")
 		uploadDir := global.CONFIG.Serve.StaticDir + "hongze/" + dateDir
 		uploadDir := global.CONFIG.Serve.StaticDir + "hongze/" + dateDir
 		err = os.MkdirAll(uploadDir, 0766)
 		err = os.MkdirAll(uploadDir, 0766)