Browse Source

Merge branch 'feature/smart_report_cancel_0220'

hsun 1 year ago
parent
commit
3caceb09b2
1 changed files with 7 additions and 3 deletions
  1. 7 3
      controllers/smart_report/smart_report.go

+ 7 - 3
controllers/smart_report/smart_report.go

@@ -470,8 +470,10 @@ func (this *SmartReportController) Publish() {
 	item.State = state
 	item.ModifyTime = time.Now().Local()
 	if state == smart_report.SmartReportStatePublished {
-		cols = append(cols, "PublishTime")
+		// 主动发布会清除掉预发布设置, 发布时间则取当前时间
+		cols = append(cols, "PublishTime", "PrePublishTime")
 		item.PublishTime = time.Now().Local()
+		item.PrePublishTime = time.Time{}
 
 		// 写入队列
 		var queue smart_report.Report2ImgQueueReq
@@ -480,11 +482,13 @@ 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", "PublishTime", "PrePublishTime")
 		item.DetailImgUrl = ""
 		item.DetailPdfUrl = ""
+		item.PublishTime = time.Time{}
+		item.PrePublishTime = time.Time{}
 	}
 	if e = item.Update(cols); e != nil {
 		br.Msg = "操作失败"