Browse Source

fix:字段移除

Roc 9 months ago
parent
commit
4377774bda
4 changed files with 7 additions and 78 deletions
  1. 5 62
      controllers/report_chapter.go
  2. 2 2
      models/report.go
  3. 0 4
      models/report_chapter.go
  4. 0 10
      services/report_v2.go

+ 5 - 62
controllers/report_chapter.go

@@ -4,7 +4,6 @@ import (
 	"encoding/json"
 	"eta/eta_api/models"
 	"eta/eta_api/models/report"
-	"eta/eta_api/models/smart_report"
 	"eta/eta_api/services"
 	"eta/eta_api/utils"
 	"fmt"
@@ -107,7 +106,7 @@ func (this *ReportController) AddChapter() {
 	reportChapterInfo.IsEdit = 1
 	//reportChapterInfo.CreateTime = req.CreateTime
 	reportChapterInfo.CreateTime = reportInfo.CreateTime
-	reportChapterInfo.VideoKind = 1
+	reportChapterInfo.VideoKind = 2
 
 	reportChapterInfo.ClassifyIdSecond = reportInfo.ClassifyIdSecond
 	reportChapterInfo.ClassifyNameSecond = reportInfo.ClassifyNameSecond
@@ -332,27 +331,16 @@ func (this *ReportController) EditDayWeekChapter() {
 	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")
+	updateCols = append(updateCols, "LastModifyAdminId", "LastModifyAdminName", "ContentModifyTime", "ContentStruct")
 
 	// 章节报告更新指标
 	tickerList := make([]*models.ReportChapterTicker, 0)
@@ -795,28 +783,6 @@ func (this *ReportController) GetDayWeekChapter() {
 		PermissionIdList: chapterPermissionIdList,
 	}
 
-	if chapterInfo.HeadResourceId > 0 {
-		headResource, err := smart_report.GetResourceItemById(chapterInfo.HeadResourceId)
-		if err != nil {
-			br.Msg = "操作失败"
-			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
-			return
-		}
-		resp.HeadImg = headResource.ImgUrl
-		resp.HeadStyle = headResource.Style
-	}
-
-	if chapterInfo.EndResourceId > 0 {
-		endResource, err := smart_report.GetResourceItemById(resp.EndResourceId)
-		if err != nil {
-			br.Msg = "操作失败"
-			br.ErrMsg = "获取资源库版头失败, Err: " + err.Error()
-			return
-		}
-		resp.EndImg = endResource.ImgUrl
-		resp.EndStyle = endResource.Style
-	}
-
 	// 获取当前编辑状态
 	{
 		markStatus, err := services.UpdateReportEditMark(chapterInfo.ReportId, chapterInfo.ReportChapterId, this.SysUser.AdminId, 2, this.SysUser.RealName, this.Lang)
@@ -1038,7 +1004,6 @@ func (this *ReportController) GetSunCode() {
 // @Title 音频上传
 // @Description 音频上传接口
 // @Param   file   query   file  true       "文件"
-// @Param   ReportId   query   int  true       "报告ID"
 // @Param   ReportChapterId   query   int  true       "报告章节ID"
 // @Success Ret=200 上传成功
 // @router /chapter/voice/upload [post]
@@ -1174,7 +1139,7 @@ func (this *ReportController) VoiceUpload() {
 	sizeFloat := (float64(videoSize) / float64(1024)) / float64(1024)
 	sizeStr := utils.SubFloatToFloatStr(sizeFloat, 2)
 
-	if reportChapterId > 0 {
+	{
 		reportChapterCreateTime, err := time.Parse(utils.FormatDateTime, reportChapterInfo.CreateTime)
 		if err != nil {
 			br.Msg = "上传失败"
@@ -1188,10 +1153,11 @@ func (this *ReportController) VoiceUpload() {
 		reportChapterInfo.VideoName = videoName
 		reportChapterInfo.VideoPlaySeconds = fmt.Sprint(playSeconds)
 		reportChapterInfo.VideoSize = sizeStr
+		reportChapterInfo.VideoKind = 1
 		reportChapterInfo.LastModifyAdminId = this.SysUser.AdminId
 		reportChapterInfo.LastModifyAdminName = this.SysUser.RealName
 		reportChapterInfo.ModifyTime = time.Now()
-		err = reportChapterInfo.UpdateChapter([]string{"VideoUrl", "VideoName", "VideoPlaySeconds", "VideoSize", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"})
+		err = reportChapterInfo.UpdateChapter([]string{"VideoUrl", "VideoName", "VideoPlaySeconds", "VideoSize", "VideoKind", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"})
 		if err != nil {
 			br.Msg = "上传失败"
 			br.ErrMsg = "修改报告章节的音频信息失败,Err:" + err.Error()
@@ -1207,29 +1173,6 @@ func (this *ReportController) VoiceUpload() {
 			br.ErrMsg = "修改报告最后更新人信息失败,Err:" + err.Error()
 			return
 		}
-	} else {
-		reportCreateTime, err := time.Parse(utils.FormatDateTime, reportInfo.CreateTime)
-		if err != nil {
-			br.Msg = "上传失败"
-			br.ErrMsg = "上传失败,Err:" + err.Error()
-			return
-		}
-		createTimeStr := reportCreateTime.Format("0102")
-		videoName := reportInfo.Title + "(" + createTimeStr + ")"
-
-		reportInfo.VideoUrl = resourceUrl
-		reportInfo.VideoName = videoName
-		reportInfo.VideoPlaySeconds = fmt.Sprint(playSeconds)
-		reportInfo.VideoSize = sizeStr
-		reportInfo.LastModifyAdminId = this.SysUser.AdminId
-		reportInfo.LastModifyAdminName = this.SysUser.RealName
-		reportInfo.ModifyTime = time.Now()
-		err = reportInfo.UpdateReport([]string{"VideoUrl", "VideoName", "VideoPlaySeconds", "VideoSize", "LastModifyAdminId", "LastModifyAdminName", "ModifyTime"})
-		if err != nil {
-			br.Msg = "上传失败"
-			br.ErrMsg = "修改报告的音频信息失败,Err:" + err.Error()
-			return
-		}
 	}
 
 	resp := new(models.ResourceResp)

+ 2 - 2
models/report.go

@@ -701,7 +701,7 @@ func AddReportSaveLog(reportId, adminId int, content, contentSub, contentStruct,
 
 func MultiAddReportChaptersSaveLog(items []*ReportChapter, adminId int, adminRealName string) (err error) {
 	o := orm.NewOrmUsingDB("rddp")
-	p, err := o.Raw(`INSERT INTO report_save_log(report_id, report_chapter_id, content, content_sub,content_struct,canvas_color,head_resource_id,end_resource_id, admin_id, admin_name) VALUES (?,?,?,?,?,?,?,?,?,?)`).Prepare()
+	p, err := o.Raw(`INSERT INTO report_save_log(report_id, report_chapter_id, content, content_sub,content_struct,admin_id, admin_name) VALUES (?,?,?,?,?,?,?)`).Prepare()
 	if err != nil {
 		return
 	}
@@ -709,7 +709,7 @@ func MultiAddReportChaptersSaveLog(items []*ReportChapter, adminId int, adminRea
 		_ = p.Close()
 	}()
 	for _, v := range items {
-		_, err = p.Exec(v.ReportId, v.ReportChapterId, v.Content, v.ContentSub, v.ContentStruct, v.CanvasColor, v.HeadResourceId, v.EndResourceId, adminId, adminRealName)
+		_, err = p.Exec(v.ReportId, v.ReportChapterId, v.Content, v.ContentSub, v.ContentStruct, adminId, adminRealName)
 		if err != nil {
 			return
 		}

+ 0 - 4
models/report_chapter.go

@@ -44,10 +44,6 @@ type ReportChapter struct {
 	LastModifyAdminId   int       `description:"最后更新人ID"`
 	LastModifyAdminName string    `description:"最后更新人姓名"`
 	ContentModifyTime   time.Time `description:"内容更新时间"`
-	CanvasColor         string    `description:"画布颜色"`
-	HeadResourceId      int       `description:"版头资源ID"`
-	EndResourceId       int       `description:"版尾资源ID"`
-	CollaborateType     int8      `description:"协作方式,1:个人,2:多人协作。默认:1"`
 	ReportLayout        int8      `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
 	ReportCreateTime    time.Time `description:"报告时间创建时间"`
 }

+ 0 - 10
services/report_v2.go

@@ -424,10 +424,6 @@ func getAddChapter(reportInfo *models.Report, minClassifyId, inheritReportId int
 			chapterItem.LastModifyAdminName = reportInfo.LastModifyAdminName
 			chapterItem.ContentModifyTime = time.Now()
 			chapterItem.ContentStruct = v.ContentStruct
-			chapterItem.CanvasColor = v.CanvasColor
-			chapterItem.HeadResourceId = v.HeadResourceId
-			chapterItem.EndResourceId = v.EndResourceId
-			chapterItem.CollaborateType = v.CollaborateType
 			chapterItem.ReportLayout = v.ReportLayout
 			chapterItem.ReportCreateTime = time.Now()
 		} else {
@@ -452,12 +448,6 @@ func getAddChapter(reportInfo *models.Report, minClassifyId, inheritReportId int
 			chapterItem.LastModifyAdminName = reportInfo.LastModifyAdminName
 			chapterItem.ContentModifyTime = time.Now()
 			//chapterItem.ContentStruct = v.ContentStruct
-			//chapterItem.HeadImg = v.HeadImg
-			//chapterItem.EndImg = v.EndImg
-			//chapterItem.CanvasColor = v.CanvasColor
-			//chapterItem.HeadResourceId = v.HeadResourceId
-			//chapterItem.EndResourceId = v.EndResourceId
-			chapterItem.CollaborateType = reportInfo.CollaborateType
 			chapterItem.ReportLayout = reportInfo.ReportLayout
 			chapterItem.ReportCreateTime = time.Now()
 		}