|
@@ -346,31 +346,23 @@ func (this *SpeechRecognitionController) Save() {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- speechItem.FileName = req.FileName
|
|
|
|
- speechItem.ModifyTime = time.Now().Local()
|
|
|
|
- updateCols := []string{speech_recognition.SpeechRecognitionCols.FileName, speech_recognition.SpeechRecognitionCols.ModifyTime}
|
|
|
|
- if e = speechItem.Update(updateCols); e != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "更新转写文件名称失败, Err: " + e.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // 批量修改内容
|
|
|
|
- contentOb := new(speech_recognition.SpeechRecognitionContent)
|
|
|
|
- if e = contentOb.BatchUpdateContents(req.Contents); e != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "批量修改内容失败, Err: " + e.Error()
|
|
|
|
- return
|
|
|
|
|
|
+ // 取前几段作为摘要保存
|
|
|
|
+ var abstractNum int
|
|
|
|
+ var abstract string
|
|
|
|
+ for _, v := range req.Contents {
|
|
|
|
+ if abstractNum < 5 {
|
|
|
|
+ abstractNum += 1
|
|
|
|
+ abstract += v.Content
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ speechItem.FileName = req.FileName
|
|
|
|
+ speechItem.Abstract = abstract
|
|
|
|
+ speechItem.ModifyTime = time.Now().Local()
|
|
|
|
+ speechCols := []string{speech_recognition.SpeechRecognitionCols.FileName, speech_recognition.SpeechRecognitionCols.Abstract, speech_recognition.SpeechRecognitionCols.ModifyTime}
|
|
|
|
|
|
- // 更新标签
|
|
|
|
- mappingOb := new(speech_recognition.SpeechRecognitionTagMapping)
|
|
|
|
- if e = mappingOb.ClearMappingBySpeechId(req.SpeechRecognitionId); e != nil {
|
|
|
|
- br.Msg = "操作失败"
|
|
|
|
- br.ErrMsg = "清除语音识别标签失败, Err: " + e.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ // 标签
|
|
tagMappings := make([]*speech_recognition.SpeechRecognitionTagMapping, 0)
|
|
tagMappings := make([]*speech_recognition.SpeechRecognitionTagMapping, 0)
|
|
for _, v := range req.TagIds {
|
|
for _, v := range req.TagIds {
|
|
tagMappings = append(tagMappings, &speech_recognition.SpeechRecognitionTagMapping{
|
|
tagMappings = append(tagMappings, &speech_recognition.SpeechRecognitionTagMapping{
|
|
@@ -378,9 +370,11 @@ func (this *SpeechRecognitionController) Save() {
|
|
TagId: v,
|
|
TagId: v,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- if e = mappingOb.CreateMulti(tagMappings); e != nil {
|
|
|
|
|
|
+
|
|
|
|
+ // 保存修改
|
|
|
|
+ if e = speechOb.SpeechSave(speechItem, speechCols, req.Contents, tagMappings); e != nil {
|
|
br.Msg = "操作失败"
|
|
br.Msg = "操作失败"
|
|
- br.ErrMsg = "批量新增语音识别标签失败, Err: " + e.Error()
|
|
|
|
|
|
+ br.ErrMsg = "语音识别保存失败, Err: " + e.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|