|
@@ -434,78 +434,79 @@ func reportBase64ToImg(imageBase64 string) (resourceUrl string, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// UpdateReportVideo 更新报告及其章节音频
|
|
|
-func UpdateReportVideo(reportId int) (err error) {
|
|
|
- defer func() {
|
|
|
- if err != nil {
|
|
|
- utils.FileLog.Error("UpdateReportVideo, reportId:%s, Err:%s", strconv.Itoa(reportId), err.Error())
|
|
|
- go alarm_msg.SendAlarmMsg("更新报告音频失败, 报告ID: "+strconv.Itoa(reportId)+", Err: "+err.Error(), 3)
|
|
|
- //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "更新报告音频失败, 报告ID: " + reportIdStr + ", Err: "+err.Error(), utils.EmailSendToUsers)
|
|
|
- }
|
|
|
- }()
|
|
|
- if reportId == 0 {
|
|
|
- return
|
|
|
- }
|
|
|
- reportInfo, err := models.GetReportByReportId(reportId)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- if reportInfo.HasChapter == 1 {
|
|
|
- // 更新章节音频
|
|
|
- chapterList, tmpErr := models.GetPublishedChapterListByReportId(reportInfo.Id)
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
- chapterIdArr := make([]int, 0)
|
|
|
- for i := 0; i < len(chapterList); i++ {
|
|
|
- chapterIdArr = append(chapterIdArr, chapterList[i].ReportChapterId)
|
|
|
- }
|
|
|
- //go UpdateChaptersVideo(chapterIds)
|
|
|
- err = UpdateChaptersVideo(chapterIdArr)
|
|
|
- } else {
|
|
|
- // 更新报告音频
|
|
|
- if reportInfo.VideoUrl != "" {
|
|
|
- return
|
|
|
- }
|
|
|
- nowTime := time.Now()
|
|
|
- updateCols := make([]string, 0)
|
|
|
- updateCols = append(updateCols, "VideoUrl", "VideoName", "VideoSize", "VideoPlaySeconds")
|
|
|
- videoUrl, videoName, videoSize, videoPlaySeconds, tmpErr := CreateReportVideo(reportInfo.Title, html.UnescapeString(reportInfo.Content), nowTime.Format(utils.FormatDateTime))
|
|
|
- reportInfo.VideoUrl = videoUrl
|
|
|
- reportInfo.VideoName = videoName
|
|
|
- reportInfo.VideoSize = videoSize
|
|
|
- reportInfo.VideoPlaySeconds = fmt.Sprintf("%.2f", videoPlaySeconds)
|
|
|
- tmpErr = reportInfo.UpdateReport(updateCols)
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-func UpdateEmptyVideoReportVideo() (err error) {
|
|
|
- list, err := models.GetSyncEmptyVideoReport()
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- listLen := len(list)
|
|
|
- if listLen <= 0 {
|
|
|
- fmt.Println("无报告需要更新音频")
|
|
|
- return
|
|
|
- }
|
|
|
- fmt.Println("Start 待更新报告音频数: ", listLen)
|
|
|
- for i := 0; i < listLen; i++ {
|
|
|
- if err = UpdateReportVideo(list[i].Id); err != nil {
|
|
|
- fmt.Printf("更新音频失败")
|
|
|
- fmt.Println(err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- fmt.Println("End 报告音频更新完毕")
|
|
|
- return
|
|
|
-}
|
|
|
+//
|
|
|
+//// UpdateReportVideo 更新报告及其章节音频
|
|
|
+//func UpdateReportVideo(reportId int) (err error) {
|
|
|
+// defer func() {
|
|
|
+// if err != nil {
|
|
|
+// utils.FileLog.Error("UpdateReportVideo, reportId:%s, Err:%s", strconv.Itoa(reportId), err.Error())
|
|
|
+// go alarm_msg.SendAlarmMsg("更新报告音频失败, 报告ID: "+strconv.Itoa(reportId)+", Err: "+err.Error(), 3)
|
|
|
+// //go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "更新报告音频失败, 报告ID: " + reportIdStr + ", Err: "+err.Error(), utils.EmailSendToUsers)
|
|
|
+// }
|
|
|
+// }()
|
|
|
+// if reportId == 0 {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// reportInfo, err := models.GetReportByReportId(reportId)
|
|
|
+// if err != nil {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if reportInfo.HasChapter == 1 {
|
|
|
+// // 更新章节音频
|
|
|
+// chapterList, tmpErr := models.GetPublishedChapterListByReportId(reportInfo.Id)
|
|
|
+// if tmpErr != nil {
|
|
|
+// err = tmpErr
|
|
|
+// return
|
|
|
+// }
|
|
|
+// chapterIdArr := make([]int, 0)
|
|
|
+// for i := 0; i < len(chapterList); i++ {
|
|
|
+// chapterIdArr = append(chapterIdArr, chapterList[i].ReportChapterId)
|
|
|
+// }
|
|
|
+// //go UpdateChaptersVideo(chapterIds)
|
|
|
+// err = UpdateChaptersVideo(chapterIdArr)
|
|
|
+// } else {
|
|
|
+// // 更新报告音频
|
|
|
+// if reportInfo.VideoUrl != "" {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// nowTime := time.Now()
|
|
|
+// updateCols := make([]string, 0)
|
|
|
+// updateCols = append(updateCols, "VideoUrl", "VideoName", "VideoSize", "VideoPlaySeconds")
|
|
|
+// videoUrl, videoName, videoSize, videoPlaySeconds, tmpErr := CreateReportVideo(reportInfo.Title, html.UnescapeString(reportInfo.Content), nowTime.Format(utils.FormatDateTime))
|
|
|
+// reportInfo.VideoUrl = videoUrl
|
|
|
+// reportInfo.VideoName = videoName
|
|
|
+// reportInfo.VideoSize = videoSize
|
|
|
+// reportInfo.VideoPlaySeconds = fmt.Sprintf("%.2f", videoPlaySeconds)
|
|
|
+// tmpErr = reportInfo.UpdateReport(updateCols)
|
|
|
+// if tmpErr != nil {
|
|
|
+// err = tmpErr
|
|
|
+// return
|
|
|
+// }
|
|
|
+// }
|
|
|
+// return
|
|
|
+//}
|
|
|
+//
|
|
|
+//func UpdateEmptyVideoReportVideo() (err error) {
|
|
|
+// list, err := models.GetSyncEmptyVideoReport()
|
|
|
+// if err != nil {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// listLen := len(list)
|
|
|
+// if listLen <= 0 {
|
|
|
+// fmt.Println("无报告需要更新音频")
|
|
|
+// return
|
|
|
+// }
|
|
|
+// fmt.Println("Start 待更新报告音频数: ", listLen)
|
|
|
+// for i := 0; i < listLen; i++ {
|
|
|
+// if err = UpdateReportVideo(list[i].Id); err != nil {
|
|
|
+// fmt.Printf("更新音频失败")
|
|
|
+// fmt.Println(err.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+// }
|
|
|
+// fmt.Println("End 报告音频更新完毕")
|
|
|
+// return
|
|
|
+//}
|
|
|
|
|
|
// checkDayWeekChapterWrite 校验晨周报已写章节与本期应写章节
|
|
|
func checkDayWeekChapterWrite(chapters []*models.ReportChapter, reportType string) (publishReport bool, tips string, publishIdArr, unPublishIdArr []int, err error) {
|