hsun 1 год назад
Родитель
Сommit
a8b34e36df
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      controllers/smart_report/smart_report.go

+ 4 - 3
controllers/smart_report/smart_report.go

@@ -92,6 +92,7 @@ func (this *SmartReportController) Add() {
 	item.AdminRealName = sysUser.RealName
 	item.LastModifyAdminId = sysUser.AdminId
 	item.LastModifyAdminName = sysUser.AdminName
+	item.State = smart_report.SmartReportStateWaitPublish
 	item.CreateTime = time.Now().Local()
 	item.ModifyTime = time.Now().Local()
 	// 继承报告
@@ -395,7 +396,7 @@ func (this *SmartReportController) Publish() {
 		br.ErrMsg = "报告ID为空"
 		return
 	}
-	if req.PublishState != 1 && req.PublishState != 2 {
+	if req.PublishState != smart_report.SmartReportStateWaitPublish && req.PublishState != smart_report.SmartReportStatePublished {
 		br.Msg = "参数有误"
 		return
 	}
@@ -415,7 +416,7 @@ func (this *SmartReportController) Publish() {
 	cols := []string{"State", "ModifyTime"}
 	item.State = req.PublishState
 	item.ModifyTime = time.Now().Local()
-	if req.PublishState == 2 {
+	if req.PublishState == smart_report.SmartReportStatePublished {
 		cols = append(cols, "PublishTime")
 		item.PublishTime = time.Now().Local()
 
@@ -426,7 +427,7 @@ func (this *SmartReportController) Publish() {
 		_ = utils.Rc.LPush(utils.CACHE_CREATE_REPORT_IMGPDF_QUEUE, queue)
 	}
 	// 取消发布时同时清除掉Img和PDF的文件地址
-	if req.PublishState == 1 {
+	if req.PublishState == smart_report.SmartReportStateWaitPublish {
 		cols = append(cols, "DetailImgUrl", "DetailPdfUrl")
 		item.DetailImgUrl = ""
 		item.DetailPdfUrl = ""