|
@@ -205,6 +205,8 @@ func (this *SpeechRecognitionController) Convert() {
|
|
|
t.SysUserName = sysUser.RealName
|
|
|
t.State = speech_recognition.SpeechRecognitionStateWait
|
|
|
t.Sort = sortMax
|
|
|
+ t.FileSecond = v.FileSecond
|
|
|
+ t.FileSize = v.FileSize
|
|
|
t.CreateTime = nowTime
|
|
|
t.ModifyTime = nowTime
|
|
|
// CreateMulti拿不到主键, 此处用循环新增获取
|
|
@@ -712,8 +714,9 @@ func (this *SpeechRecognitionController) List() {
|
|
|
params.FileName = strings.TrimSpace(params.FileName)
|
|
|
|
|
|
dataResp := new(speech_recognition.SpeechRecognitionListResp)
|
|
|
- cond := ``
|
|
|
+ cond := fmt.Sprintf(` AND %s = ?`, speech_recognition.SpeechRecognitionCols.State)
|
|
|
pars := make([]interface{}, 0)
|
|
|
+ pars = append(pars, speech_recognition.SpeechRecognitionStateSuccess)
|
|
|
|
|
|
// 筛选项
|
|
|
{
|
|
@@ -1083,3 +1086,60 @@ func (this *SpeechRecognitionController) Export() {
|
|
|
downloadName := fmt.Sprintf("%s%s", speechItem.FileName, suffix)
|
|
|
this.Ctx.Output.Download(downloadPath, downloadName)
|
|
|
}
|
|
|
+
|
|
|
+// CheckFileName
|
|
|
+// @Title 文件重名校验
|
|
|
+// @Description 文件重名校验
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionConvertCheckNameReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /convert/check_name [post]
|
|
|
+func (this *SpeechRecognitionController) CheckFileName() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ 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 speech_recognition.SpeechRecognitionConvertCheckNameReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ req.FileName = strings.TrimSpace(req.FileName)
|
|
|
+ if req.FileName == "" {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数有误, FileName: %s", req.FileName)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var checkResult bool
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ cond := fmt.Sprintf(` AND %s = ?`, speech_recognition.SpeechRecognitionCols.FileName)
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ pars = append(pars, req.FileName)
|
|
|
+ exists, e := speechOb.GetItemByCondition(cond, pars, "")
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "获取同名转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if exists != nil && exists.SpeechRecognitionId > 0 {
|
|
|
+ checkResult = true
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = checkResult
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|