浏览代码

Merge branch 'feature/smart_report_cancel_0220' into debug

hsun 1 年之前
父节点
当前提交
d24c3551fe
共有 2 个文件被更改,包括 6 次插入6 次删除
  1. 3 2
      controllers/smart_report/smart_report.go
  2. 3 4
      services/minio.go

+ 3 - 2
controllers/smart_report/smart_report.go

@@ -480,11 +480,12 @@ func (this *SmartReportController) Publish() {
 		_ = utils.Rc.LPush(utils.CACHE_CREATE_REPORT_IMGPDF_QUEUE, queue)
 	}
 
-	// 取消发布时同时清除掉Img和PDF的文件地址
+	// 取消发布时同时清除掉Img和PDF的文件地址, 以及预发布设置
 	if state == smart_report.SmartReportStateWaitPublish {
-		cols = append(cols, "DetailImgUrl", "DetailPdfUrl")
+		cols = append(cols, "DetailImgUrl", "DetailPdfUrl", "PrePublishTime")
 		item.DetailImgUrl = ""
 		item.DetailPdfUrl = ""
+		item.PrePublishTime = time.Time{}
 	}
 	if e = item.Update(cols); e != nil {
 		br.Msg = "操作失败"

+ 3 - 4
services/minio.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"errors"
 	"eta/eta_api/utils"
+	"fmt"
 	"github.com/minio/minio-go/v7"
 	"github.com/minio/minio-go/v7/pkg/credentials"
 	"log"
@@ -425,10 +426,8 @@ func (m *MinioOss) UploadFile(fileName, filePath, savePath string) (string, erro
 	}
 	bucketName := utils.MinIoBucketname
 	exists, errBucketExists := minioClient.BucketExists(ctx, bucketName)
-	if errBucketExists == nil && exists {
-		log.Printf("We already own %s\n", bucketName)
-	} else {
-		log.Fatalln(err)
+	if errBucketExists != nil || !exists {
+		err = fmt.Errorf("BucketExists: %v; err: %v", exists, errBucketExists)
 		return "2", err
 	}