|
@@ -10,7 +10,6 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/kgiannakakis/mp3duration/src/mp3duration"
|
|
|
"html"
|
|
|
- "io/ioutil"
|
|
|
"os"
|
|
|
"path"
|
|
|
"strconv"
|
|
@@ -200,6 +199,11 @@ func (this *ReportController) EditChapterBaseInfoAndPermission() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 报告的最后编辑人
|
|
|
+ reportInfo.LastModifyAdminId = sysUser.AdminId
|
|
|
+ reportInfo.LastModifyAdminName = sysUser.RealName
|
|
|
+ reportInfo.ModifyTime = time.Now()
|
|
|
+
|
|
|
err, errMsg := services.EditChapterBaseInfoAndPermission(reportInfo, reportChapterInfo, req.Title, req.PermissionIdList, req.AdminIdList)
|
|
|
if err != nil {
|
|
|
br.Msg = "保存失败"
|
|
@@ -309,6 +313,10 @@ func (this *ReportController) EditDayWeekChapter() {
|
|
|
br.ErrMsg = "该报告已发布,不允许编辑"
|
|
|
return
|
|
|
}
|
|
|
+ // 报告的最后编辑人
|
|
|
+ reportInfo.LastModifyAdminId = sysUser.AdminId
|
|
|
+ reportInfo.LastModifyAdminName = sysUser.RealName
|
|
|
+ reportInfo.ModifyTime = time.Now()
|
|
|
|
|
|
reqTickerList := req.TickerList
|
|
|
// 更新章节及指标
|
|
@@ -368,7 +376,7 @@ func (this *ReportController) EditDayWeekChapter() {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
- err = models.UpdateChapterAndTicker(reportChapterInfo, updateCols, tickerList)
|
|
|
+ err = models.UpdateChapterAndTicker(reportInfo, reportChapterInfo, updateCols, tickerList)
|
|
|
if err != nil {
|
|
|
br.Msg = "保存失败"
|
|
|
br.ErrMsg = "报告章节内容保存失败, Err: " + err.Error()
|
|
@@ -1070,9 +1078,9 @@ func (this *ReportController) VoiceUpload() {
|
|
|
}
|
|
|
randStr := utils.GetRandStringNoSpecialChar(28)
|
|
|
fileName := randStr + ext
|
|
|
- fpath := uploadDir + "/" + fileName
|
|
|
+ fPath := uploadDir + "/" + fileName
|
|
|
defer f.Close() //关闭上传文件
|
|
|
- err = this.SaveToFile("file", fpath)
|
|
|
+ err = this.SaveToFile("file", fPath)
|
|
|
if err != nil {
|
|
|
br.Msg = "文件上传失败"
|
|
|
br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
@@ -1082,14 +1090,14 @@ func (this *ReportController) VoiceUpload() {
|
|
|
resourceUrl := ``
|
|
|
//上传到阿里云 和 minio
|
|
|
//if utils.ObjectStorageClient == "minio" {
|
|
|
- // resourceUrl, err = services.UploadAudioToMinIo(fileName, fpath)
|
|
|
+ // resourceUrl, err = services.UploadAudioToMinIo(fileName, fPath)
|
|
|
// if err != nil {
|
|
|
// br.Msg = "文件上传失败"
|
|
|
// br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
|
// return
|
|
|
// }
|
|
|
//} else {
|
|
|
- // resourceUrl, err = services.UploadAudioAliyun(fileName, fpath)
|
|
|
+ // resourceUrl, err = services.UploadAudioAliyun(fileName, fPath)
|
|
|
// if err != nil {
|
|
|
// br.Msg = "文件上传失败"
|
|
|
// br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
@@ -1102,7 +1110,7 @@ func (this *ReportController) VoiceUpload() {
|
|
|
br.ErrMsg = "初始化OSS服务失败"
|
|
|
return
|
|
|
}
|
|
|
- resourceUrl, err = ossClient.UploadFile(fileName, fpath, "")
|
|
|
+ resourceUrl, err = ossClient.UploadFile(fileName, fPath, "")
|
|
|
if err != nil {
|
|
|
br.Msg = "文件上传失败"
|
|
|
br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
@@ -1110,7 +1118,7 @@ func (this *ReportController) VoiceUpload() {
|
|
|
}
|
|
|
|
|
|
defer func() {
|
|
|
- os.Remove(fpath)
|
|
|
+ os.Remove(fPath)
|
|
|
}()
|
|
|
item := new(models.Resource)
|
|
|
item.ResourceUrl = resourceUrl
|
|
@@ -1124,9 +1132,9 @@ func (this *ReportController) VoiceUpload() {
|
|
|
}
|
|
|
|
|
|
var playSeconds float64
|
|
|
- playSeconds, err = mp3duration.Calculate(fpath)
|
|
|
+ playSeconds, err = mp3duration.Calculate(fPath)
|
|
|
if playSeconds <= 0 {
|
|
|
- playSeconds, err = utils.GetVideoPlaySeconds(fpath)
|
|
|
+ playSeconds, err = utils.GetVideoPlaySeconds(fPath)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取音频时间失败"
|
|
|
br.ErrMsg = "获取音频时间失败,Err:" + err.Error()
|
|
@@ -1134,7 +1142,7 @@ func (this *ReportController) VoiceUpload() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fileBody, err := ioutil.ReadFile(fpath)
|
|
|
+ fileBody, err := os.ReadFile(fPath)
|
|
|
videoSize := len(fileBody)
|
|
|
sizeFloat := (float64(videoSize) / float64(1024)) / float64(1024)
|
|
|
sizeStr := utils.SubFloatToFloatStr(sizeFloat, 2)
|
|
@@ -1274,6 +1282,17 @@ func (this *ReportController) PublishDayWeekReportChapter() {
|
|
|
publishTime = time.Now()
|
|
|
}
|
|
|
|
|
|
+ // 更新报告的最后编辑人
|
|
|
+ reportInfo.LastModifyAdminId = sysUser.AdminId
|
|
|
+ reportInfo.LastModifyAdminName = sysUser.RealName
|
|
|
+ reportInfo.ModifyTime = time.Now()
|
|
|
+ err = reportInfo.UpdateReport([]string{"LastModifyAdminId", "LastModifyAdminName", "ModifyTime"})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "发布失败"
|
|
|
+ br.ErrMsg = "报告最后编辑人保存失败, Err: " + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// 更新章节信息
|
|
|
chapterInfo.IsEdit = 1
|
|
|
chapterInfo.PublishState = 2
|