|
@@ -47,7 +47,7 @@ func (this *ReportController) AddChapter() {
|
|
|
}
|
|
|
|
|
|
// 获取报告详情
|
|
|
- reportInfo, err := models.GetReportById(req.ReportId)
|
|
|
+ reportInfo, err := models.GetReportByReportId(req.ReportId)
|
|
|
if err != nil {
|
|
|
br.Msg = "报告信息有误"
|
|
|
br.ErrMsg = "报告信息有误, Err: " + err.Error()
|
|
@@ -59,34 +59,34 @@ func (this *ReportController) AddChapter() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- newContent := req.Content
|
|
|
- // 更新章节及指标
|
|
|
- contentSub := ""
|
|
|
- if req.Content != "" {
|
|
|
- e := utils.ContentXssCheck(req.Content)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "存在非法标签"
|
|
|
- br.ErrMsg = "存在非法标签, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- contentClean, e := services.FilterReportContentBr(req.Content)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "内容去除前后空格失败"
|
|
|
- br.ErrMsg = "内容去除前后空格失败, Err: " + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- req.Content = contentClean
|
|
|
-
|
|
|
- contentSub, err = services.GetReportContentSub(req.Content)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "内容分段解析失败"
|
|
|
- br.ErrMsg = "编辑报告章节-解析 ContentSub 失败, Err: " + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- if req.Content == "" {
|
|
|
- req.Content = newContent
|
|
|
- }
|
|
|
+ //newContent := req.Content
|
|
|
+ //// 更新章节及指标
|
|
|
+ //contentSub := ""
|
|
|
+ //if req.Content != "" {
|
|
|
+ // e := utils.ContentXssCheck(req.Content)
|
|
|
+ // if e != nil {
|
|
|
+ // br.Msg = "存在非法标签"
|
|
|
+ // br.ErrMsg = "存在非法标签, Err: " + e.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // contentClean, e := services.FilterReportContentBr(req.Content)
|
|
|
+ // if e != nil {
|
|
|
+ // br.Msg = "内容去除前后空格失败"
|
|
|
+ // br.ErrMsg = "内容去除前后空格失败, Err: " + e.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // req.Content = contentClean
|
|
|
+ //
|
|
|
+ // contentSub, err = services.GetReportContentSub(req.Content)
|
|
|
+ // if err != nil {
|
|
|
+ // br.Msg = "内容分段解析失败"
|
|
|
+ // br.ErrMsg = "编辑报告章节-解析 ContentSub 失败, Err: " + err.Error()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //if req.Content == "" {
|
|
|
+ // req.Content = newContent
|
|
|
+ //}
|
|
|
|
|
|
reportChapterInfo := new(models.ReportChapter)
|
|
|
reportChapterInfo.ReportId = reportInfo.Id
|
|
@@ -95,11 +95,12 @@ func (this *ReportController) AddChapter() {
|
|
|
|
|
|
reportChapterInfo.Title = req.Title
|
|
|
reportChapterInfo.AddType = 1
|
|
|
- reportChapterInfo.Author = req.Author
|
|
|
- reportChapterInfo.Content = html.EscapeString(req.Content)
|
|
|
- reportChapterInfo.ContentSub = html.EscapeString(contentSub)
|
|
|
+ //reportChapterInfo.Author = req.Author
|
|
|
+ //reportChapterInfo.Content = html.EscapeString(req.Content)
|
|
|
+ //reportChapterInfo.ContentSub = html.EscapeString(contentSub)
|
|
|
reportChapterInfo.IsEdit = 1
|
|
|
- reportChapterInfo.CreateTime = req.CreateTime
|
|
|
+ //reportChapterInfo.CreateTime = req.CreateTime
|
|
|
+ reportChapterInfo.CreateTime = reportInfo.CreateTime
|
|
|
reportChapterInfo.VideoKind = 1
|
|
|
|
|
|
reportChapterInfo.ClassifyIdSecond = reportInfo.ClassifyIdSecond
|
|
@@ -109,23 +110,21 @@ func (this *ReportController) AddChapter() {
|
|
|
reportChapterInfo.LastModifyAdminId = sysUser.AdminId
|
|
|
reportChapterInfo.LastModifyAdminName = sysUser.RealName
|
|
|
reportChapterInfo.ContentModifyTime = time.Now()
|
|
|
- reportChapterInfo.ContentStruct = html.EscapeString(req.ContentStruct)
|
|
|
- reportChapterInfo.CanvasColor = req.CanvasColor
|
|
|
- reportChapterInfo.HeadResourceId = req.HeadResourceId
|
|
|
- reportChapterInfo.EndResourceId = req.EndResourceId
|
|
|
+ //reportChapterInfo.ContentStruct = html.EscapeString(req.ContentStruct)
|
|
|
+ //reportChapterInfo.CanvasColor = req.CanvasColor
|
|
|
+ //reportChapterInfo.HeadResourceId = req.HeadResourceId
|
|
|
+ //reportChapterInfo.EndResourceId = req.EndResourceId
|
|
|
|
|
|
- err = reportChapterInfo.Add()
|
|
|
+ err, errMsg := services.AddChapterBaseInfoAndPermission(reportInfo, reportChapterInfo, req.PermissionIdList, req.AdminIdList)
|
|
|
if err != nil {
|
|
|
- br.Msg = "新增失败"
|
|
|
- br.ErrMsg = "报告章节内容保存失败, Err: " + err.Error()
|
|
|
+ br.Msg = "保存失败"
|
|
|
+ if errMsg != "" {
|
|
|
+ br.Msg = errMsg
|
|
|
+ }
|
|
|
+ br.ErrMsg = "保存失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- // 备份关键数据
|
|
|
- chapters := make([]*models.ReportChapter, 0)
|
|
|
- chapters = append(chapters, reportChapterInfo)
|
|
|
- go services.SaveReportLogs(nil, chapters, sysUser.AdminId, sysUser.RealName)
|
|
|
-
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "保存成功"
|