Ver código fonte

fix:手机端修改报告章节,导致音频无法上传的bug修复

Roc 3 semanas atrás
pai
commit
4c7c747375
1 arquivos alterados com 12 adições e 3 exclusões
  1. 12 3
      controllers/report_chapter.go

+ 12 - 3
controllers/report_chapter.go

@@ -378,6 +378,9 @@ func (this *ReportController) EditDayWeekChapter() {
 		br.IsSendEmail = false
 		return
 	}
+
+	updateCols := make([]string, 0)
+
 	// 报告的最后编辑人
 	reportInfo.LastModifyAdminId = sysUser.AdminId
 	reportInfo.LastModifyAdminName = sysUser.RealName
@@ -411,21 +414,27 @@ func (this *ReportController) EditDayWeekChapter() {
 
 	if req.Title != `` {
 		reportChapterInfo.Title = req.Title
+		updateCols = append(updateCols, "Title")
 	}
 	//reportChapterInfo.AddType = req.AddType
 	reportChapterInfo.Author = req.Author
 	reportChapterInfo.Content = html.EscapeString(req.Content)
 	reportChapterInfo.ContentSub = html.EscapeString(contentSub)
 	reportChapterInfo.IsEdit = 1
-	reportChapterInfo.CreateTime = req.CreateTime
+	reportChapterInfo.ModifyTime = time.Now()
+
+	// 担心外部没有传入时间,如果没有传入,那么就不修改
+	if req.CreateTime != `` {
+		reportChapterInfo.CreateTime = req.CreateTime
+		updateCols = append(updateCols, "CreateTime")
+	}
 
 	reportChapterInfo.LastModifyAdminId = sysUser.AdminId
 	reportChapterInfo.LastModifyAdminName = sysUser.RealName
 	reportChapterInfo.ContentModifyTime = time.Now()
 	reportChapterInfo.ContentStruct = html.EscapeString(req.ContentStruct)
 
-	updateCols := make([]string, 0)
-	updateCols = append(updateCols, "Title", "AddType", "Author", "Content", "ContentSub", "IsEdit", "CreateTime")
+	updateCols = append(updateCols, "Author", "Content", "ContentSub", "IsEdit", "ModifyTime")
 
 	updateCols = append(updateCols, "LastModifyAdminId", "LastModifyAdminName", "ContentModifyTime", "ContentStruct")