|
@@ -324,6 +324,200 @@ func (this *ReportController) EditDayWeekChapter() {
|
|
|
br.Msg = "保存成功"
|
|
|
}
|
|
|
|
|
|
+// DelChapter
|
|
|
+// @Title 编辑晨周报章节内容
|
|
|
+// @Description 编辑晨周报章节内容
|
|
|
+// @Param request body models.EditReportChapterReq true "type json string"
|
|
|
+// @Success 200 Ret=200 保存成功
|
|
|
+// @router /chapter/del [post]
|
|
|
+//func (this *ReportController) DelChapter() {
|
|
|
+// br := new(models.BaseResponse).Init()
|
|
|
+// defer func() {
|
|
|
+// this.Data["json"] = br
|
|
|
+// this.ServeJSON()
|
|
|
+// }()
|
|
|
+//
|
|
|
+// sysUser := this.SysUser
|
|
|
+// if sysUser == nil {
|
|
|
+// br.Msg = "请登录"
|
|
|
+// br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+// br.Ret = 408
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// var req models.DelReportChapterReq
|
|
|
+// err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "参数解析异常!"
|
|
|
+// br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// reportChapterId := req.ReportChapterId
|
|
|
+// if reportChapterId <= 0 {
|
|
|
+// br.Msg = "报告章节ID有误"
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if req.Content == "" {
|
|
|
+// br.Msg = "请输入内容"
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 获取章节详情
|
|
|
+// reportChapterInfo, err := models.GetReportChapterInfoById(reportChapterId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "报告章节信息有误"
|
|
|
+// br.ErrMsg = "报告章节信息有误, Err: " + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 获取报告详情
|
|
|
+// reportInfo, err := models.GetReportByReportId(reportChapterInfo.ReportId)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "报告信息有误"
|
|
|
+// br.ErrMsg = "报告信息有误, Err: " + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 操作权限校验
|
|
|
+// {
|
|
|
+// // 如果不是创建人,那么就要去查看是否授权
|
|
|
+// if reportInfo.AdminId != sysUser.AdminId {
|
|
|
+// // 授权用户权限校验
|
|
|
+// chapterGrantObj := report.ReportChapterGrant{}
|
|
|
+// _, tmpErr := chapterGrantObj.GetGrantByIdAndAdmin(reportChapterInfo.ReportChapterId, sysUser.AdminId)
|
|
|
+// if tmpErr != nil {
|
|
|
+// if tmpErr.Error() == utils.ErrNoRow() {
|
|
|
+// br.Msg = "没有权限"
|
|
|
+// br.ErrMsg = "没有权限"
|
|
|
+// br.IsSendEmail = false
|
|
|
+// return
|
|
|
+// }
|
|
|
+// br.Msg = "获取章节id授权用户失败"
|
|
|
+// br.ErrMsg = "获取章节id授权用户失败, Err: " + tmpErr.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 标记更新中
|
|
|
+// {
|
|
|
+// markStatus, err := services.UpdateReportEditMark(reportChapterInfo.ReportId, reportChapterInfo.ReportChapterId, sysUser.AdminId, 1, sysUser.RealName, this.Lang)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if markStatus.Status == 1 {
|
|
|
+// br.Msg = markStatus.Msg
|
|
|
+// br.IsSendEmail = false
|
|
|
+// return
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if reportInfo.State == 2 {
|
|
|
+// br.Msg = "该报告已发布,不允许编辑"
|
|
|
+// br.ErrMsg = "该报告已发布,不允许编辑"
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// reqTickerList := req.TickerList
|
|
|
+// // 更新章节及指标
|
|
|
+// 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
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// reportChapterInfo.Title = req.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.VideoUrl = req.VideoUrl
|
|
|
+// reportChapterInfo.VideoName = req.VideoName
|
|
|
+// reportChapterInfo.VideoPlaySeconds = req.VideoPlaySeconds
|
|
|
+// reportChapterInfo.VideoSize = req.VideoSize
|
|
|
+// reportChapterInfo.VideoKind = 1
|
|
|
+//
|
|
|
+// 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
|
|
|
+//
|
|
|
+// updateCols := make([]string, 0)
|
|
|
+// updateCols = append(updateCols, "Title", "AddType", "Author", "Content", "ContentSub", "IsEdit", "CreateTime")
|
|
|
+// if req.VideoUrl != "" {
|
|
|
+// updateCols = append(updateCols, "VideoUrl", "VideoName", "VideoSize", "VideoPlaySeconds", "VideoKind")
|
|
|
+// }
|
|
|
+//
|
|
|
+// updateCols = append(updateCols, "LastModifyAdminId", "LastModifyAdminName", "ContentModifyTime", "ContentStruct", "CanvasColor", "HeadResourceId", "EndResourceId")
|
|
|
+//
|
|
|
+// // 章节报告更新指标
|
|
|
+// tickerList := make([]*models.ReportChapterTicker, 0)
|
|
|
+// if len(reqTickerList) > 0 {
|
|
|
+// nowTime := time.Now()
|
|
|
+// for i := 0; i < len(reqTickerList); i++ {
|
|
|
+// tickerList = append(tickerList, &models.ReportChapterTicker{
|
|
|
+// ReportChapterId: reportChapterInfo.ReportChapterId,
|
|
|
+// Sort: reqTickerList[i].Sort,
|
|
|
+// Ticker: reqTickerList[i].Ticker,
|
|
|
+// CreateTime: nowTime,
|
|
|
+// UpdateTime: nowTime,
|
|
|
+// })
|
|
|
+// }
|
|
|
+// }
|
|
|
+// err = models.UpdateChapterAndTicker(reportChapterInfo, updateCols, tickerList)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = "保存失败"
|
|
|
+// br.ErrMsg = "报告章节内容保存失败, Err: " + err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 标记更新中
|
|
|
+// {
|
|
|
+// markStatus, err := services.UpdateReportEditMark(reportChapterInfo.ReportId, reportChapterInfo.ReportChapterId, sysUser.AdminId, 1, sysUser.RealName, this.Lang)
|
|
|
+// if err != nil {
|
|
|
+// br.Msg = err.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if markStatus.Status == 1 {
|
|
|
+// br.Msg = markStatus.Msg
|
|
|
+// 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 = "保存成功"
|
|
|
+//}
|
|
|
+
|
|
|
// EditChapterBaseInfoAndPermission
|
|
|
// @Title 修改报告章节的基础信息、授权用户权限、品种权限
|
|
|
// @Description 修改报告章节的基础信息、授权用户权限、品种权限
|
|
@@ -773,6 +967,35 @@ func (this *ReportController) EditChapterTrendTag() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 获取报告详情
|
|
|
+ reportInfo, err := models.GetReportByReportId(chapterInfo.ReportId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "报告信息有误"
|
|
|
+ br.ErrMsg = "报告信息有误, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 操作权限校验
|
|
|
+ {
|
|
|
+ // 如果不是创建人,那么就要去查看是否授权
|
|
|
+ if reportInfo.AdminId != sysUser.AdminId {
|
|
|
+ // 授权用户权限校验
|
|
|
+ chapterGrantObj := report.ReportChapterGrant{}
|
|
|
+ _, tmpErr := chapterGrantObj.GetGrantByIdAndAdmin(chapterInfo.ReportChapterId, sysUser.AdminId)
|
|
|
+ if tmpErr != nil {
|
|
|
+ if tmpErr.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "没有权限"
|
|
|
+ br.ErrMsg = "没有权限"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取章节id授权用户失败"
|
|
|
+ br.ErrMsg = "获取章节id授权用户失败, Err: " + tmpErr.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 更新章节标签
|
|
|
chapterInfo.Trend = req.Trend
|
|
|
updateCols := make([]string, 0)
|