ソースを参照

Merge branch 'fix/report_chapter' into debug

Roc 3 週間 前
コミット
7ac53f016a
1 ファイル変更12 行追加3 行削除
  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")