|
@@ -9,6 +9,7 @@ import (
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
"strconv"
|
|
|
+ "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -20,7 +21,7 @@ type SpeechRecognitionCommonController struct {
|
|
|
controllers.BaseCommonController
|
|
|
}
|
|
|
|
|
|
-// RecTaskCallback
|
|
|
+// TODO:RecTaskCallback
|
|
|
// @Title 语音识别回调
|
|
|
// @Description 语音识别回调
|
|
|
// @Param request body services.TencentRecTaskCallback true "type json string"
|
|
@@ -71,17 +72,139 @@ func (this *SpeechRecognitionCommonController) RecTaskCallback() {
|
|
|
}
|
|
|
utils.FileLog.Info("RecTaskCallback, 3")
|
|
|
|
|
|
+ // TODO:更新语音识别状态及内容
|
|
|
+
|
|
|
br.Code = 0
|
|
|
br.Message = "success"
|
|
|
}
|
|
|
|
|
|
-// Save
|
|
|
-// @Title 保存
|
|
|
-// @Description 保存
|
|
|
+// Convert
|
|
|
+// @Title 语音转换
|
|
|
+// @Description 语音转换
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionConvertReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /convert [post]
|
|
|
+func (this *SpeechRecognitionController) Convert() {
|
|
|
+ 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.SpeechRecognitionConvertReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.MenuId <= 0 {
|
|
|
+ br.Msg = "请选择目录"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(req.Files) == 0 {
|
|
|
+ br.Msg = "请上传转写文件"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, r := range req.Files {
|
|
|
+ if r.FileName == "" && r.ResourceUrl == "" {
|
|
|
+ br.Msg = "转写文件有误,请检查"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ speeches := make([]*speech_recognition.SpeechRecognition, 0)
|
|
|
+ nowTime := time.Now().Local()
|
|
|
+ for _, v := range req.Files {
|
|
|
+ t := new(speech_recognition.SpeechRecognition)
|
|
|
+ t.FileName = v.FileName
|
|
|
+ t.ResourceUrl = v.ResourceUrl
|
|
|
+ t.MenuId = req.MenuId
|
|
|
+ // TODO:所属目录位置
|
|
|
+ t.SysUserId = sysUser.AdminId
|
|
|
+ t.SysUserName = sysUser.RealName
|
|
|
+ t.State = speech_recognition.SpeechRecognitionStateWait
|
|
|
+ t.CreateTime = nowTime
|
|
|
+ t.ModifyTime = nowTime
|
|
|
+ speeches = append(speeches, t)
|
|
|
+ }
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ if e := speechOb.CreateMulti(speeches); e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "批量新增转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量转写语音
|
|
|
+ go func() {
|
|
|
+ services.BatchConvertSpeech(speeches)
|
|
|
+ }()
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// ConvertList
|
|
|
+// @Title 转换列表
|
|
|
+// @Description 转换列表
|
|
|
+// @Success 200 {object} speech_recognition.SpeechRecognitionItem
|
|
|
+// @router /convert_list [get]
|
|
|
+func (this *SpeechRecognitionController) ConvertList() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ // 仅取待转换和转换失败的
|
|
|
+ states := []int{speech_recognition.SpeechRecognitionStateWait, speech_recognition.SpeechRecognitionStateFail}
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ cond := fmt.Sprintf(` %s = ? AND %s IN (%s)`, speech_recognition.SpeechRecognitionCols.SysUserId, speech_recognition.SpeechRecognitionCols.State, utils.GetOrmInReplace(len(states)))
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ pars = append(pars, sysUser.AdminId, states)
|
|
|
+ list, e := speechOb.GetItemsByCondition(cond, pars, []string{}, "")
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取转写文件列表失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp := make([]*speech_recognition.SpeechRecognitionItem, 0)
|
|
|
+ for _, v := range list {
|
|
|
+ resp = append(resp, speech_recognition.FormatSpeechRecognition2Item(v))
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|
|
|
+
|
|
|
+// TODO:Save
|
|
|
+// @Title 保存内容
|
|
|
+// @Description 保存内容
|
|
|
// @Param request body speech_recognition.SpeechRecognitionSaveReq true "type json string"
|
|
|
// @Success 200 string "操作成功"
|
|
|
// @router /save [post]
|
|
|
-func (this *SpeechRecognitionCommonController) Save() {
|
|
|
+func (this *SpeechRecognitionController) Save() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
if br.ErrMsg == "" {
|
|
@@ -128,3 +251,432 @@ func (this *SpeechRecognitionCommonController) Save() {
|
|
|
br.Success = true
|
|
|
br.Msg = "操作成功"
|
|
|
}
|
|
|
+
|
|
|
+// RemoveFile
|
|
|
+// @Title (软)删除文件
|
|
|
+// @Description (软)删除文件
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionRemoveFileReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /remove_file [post]
|
|
|
+func (this *SpeechRecognitionController) RemoveFile() {
|
|
|
+ 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.SpeechRecognitionRemoveFileReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.SpeechRecognitionId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数有误, SpeechRecognitionId: %d", req.SpeechRecognitionId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ speechItem, e := speechOb.GetItemById(req.SpeechRecognitionId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "转写文件不存在,请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "获取转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ speechItem.FileState = speech_recognition.SpeechRecognitionFileRemoveFlag
|
|
|
+ speechItem.ModifyTime = time.Now().Local()
|
|
|
+ updateCols := []string{speech_recognition.SpeechRecognitionCols.FileState, speech_recognition.SpeechRecognitionCols.ModifyTime}
|
|
|
+ if e = speechItem.Update(updateCols); e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "软删除转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// Rename
|
|
|
+// @Title 重命名
|
|
|
+// @Description 重命名
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionRenameReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /rename [post]
|
|
|
+func (this *SpeechRecognitionController) Rename() {
|
|
|
+ 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.SpeechRecognitionRenameReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.SpeechRecognitionId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数有误, SpeechRecognitionId: %d", req.SpeechRecognitionId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ req.FileName = strings.TrimSpace(req.FileName)
|
|
|
+ if req.FileName == "" {
|
|
|
+ br.Msg = "请输入文件名称"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ speechItem, e := speechOb.GetItemById(req.SpeechRecognitionId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "转写文件不存在,请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "获取转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 重名校验
|
|
|
+ {
|
|
|
+ cond := fmt.Sprintf(` %s = ? AND %s <> ?`, speech_recognition.SpeechRecognitionCols.FileName, speech_recognition.SpeechRecognitionCols.SpeechRecognitionId)
|
|
|
+ pars := make([]interface{}, 0)
|
|
|
+ pars = append(pars, req.FileName, req.SpeechRecognitionId)
|
|
|
+ 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 {
|
|
|
+ br.Msg = "分类名称已存在,请重新输入"
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// Remove
|
|
|
+// @Title 删除
|
|
|
+// @Description 删除
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionRemoveReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /remove [post]
|
|
|
+func (this *SpeechRecognitionController) Remove() {
|
|
|
+ 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.SpeechRecognitionRemoveReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.SpeechRecognitionId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数有误, SpeechRecognitionId: %d", req.SpeechRecognitionId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ speechItem, e := speechOb.GetItemById(req.SpeechRecognitionId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "获取转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if e = speechItem.Del(); e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "删除转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清除标签关联
|
|
|
+ go func() {
|
|
|
+ mappingOb := new(speech_recognition.SpeechRecognitionTagMapping)
|
|
|
+ _ = mappingOb.ClearMappingBySpeechId(req.SpeechRecognitionId)
|
|
|
+ }()
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// SaveTag
|
|
|
+// @Title 保存标签
|
|
|
+// @Description 保存标签
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionSaveTagReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /save_tag [post]
|
|
|
+func (this *SpeechRecognitionController) SaveTag() {
|
|
|
+ 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.SpeechRecognitionSaveTagReq
|
|
|
+ if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.SpeechRecognitionId <= 0 {
|
|
|
+ br.Msg = "参数有误"
|
|
|
+ br.ErrMsg = fmt.Sprintf("参数有误, SpeechRecognitionId: %d", req.SpeechRecognitionId)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ speechOb := new(speech_recognition.SpeechRecognition)
|
|
|
+ _, e := speechOb.GetItemById(req.SpeechRecognitionId)
|
|
|
+ if e != nil {
|
|
|
+ if e.Error() == utils.ErrNoRow() {
|
|
|
+ br.Msg = "转写文件不存在,请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "获取转写文件失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清除原标签
|
|
|
+ mappingOb := new(speech_recognition.SpeechRecognitionTagMapping)
|
|
|
+ if e = mappingOb.ClearMappingBySpeechId(req.SpeechRecognitionId); e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "清除转写文件标签失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 保存新标签
|
|
|
+ if len(req.TagIds) > 0 {
|
|
|
+ mappings := make([]*speech_recognition.SpeechRecognitionTagMapping, 0)
|
|
|
+ for _, v := range req.TagIds {
|
|
|
+ if v <= 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ mappings = append(mappings, &speech_recognition.SpeechRecognitionTagMapping{
|
|
|
+ TagId: v,
|
|
|
+ SpeechRecognitionId: req.SpeechRecognitionId,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if e = mappingOb.CreateMulti(mappings); e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = "批量新增转写文件标签失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// TODO:List
|
|
|
+// @Title 语音识别列表
|
|
|
+// @Description 语音识别列表
|
|
|
+// @Param ParentId query int false "父级ID"
|
|
|
+// @Success 200 {object} speech_recognition.SpeechRecognitionMenuNodeItem
|
|
|
+// @router /list [get]
|
|
|
+func (this *SpeechRecognitionController) List() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO:标签列表
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|
|
|
+
|
|
|
+// TODO:Detail
|
|
|
+// @Title 语音识别详情
|
|
|
+// @Description 语音识别详情
|
|
|
+// @Param SpeechRecognitionId query int true "语音识别ID"
|
|
|
+// @Success 200 {object} speech_recognition.SpeechRecognitionMenuNodeItem
|
|
|
+// @router /detail [get]
|
|
|
+func (this *SpeechRecognitionController) Detail() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO:标签详情
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|
|
|
+
|
|
|
+// TODO:Move
|
|
|
+// @Title 移动语音识别/目录
|
|
|
+// @Description 移动标签/目录
|
|
|
+// @Param request body speech_recognition.SpeechRecognitionTagRemoveReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /move [post]
|
|
|
+func (this *SpeechRecognitionController) Move() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO:移动语音识别/目录
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+//// TestConvert
|
|
|
+//// @Title 转写测试
|
|
|
+//// @Description 转写测试
|
|
|
+//// @Param request body speech_recognition.SpeechRecognitionSaveReq true "type json string"
|
|
|
+//// @Success 200 string "操作成功"
|
|
|
+//// @router /test_convert [post]
|
|
|
+//func (this *SpeechRecognitionCommonController) TestConvert() {
|
|
|
+// 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.SpeechRecognitionSaveReq
|
|
|
+// if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
|
|
|
+// br.Msg = "参数有误"
|
|
|
+// br.ErrMsg = "参数解析失败, Err: " + e.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// conf, e := models.GetBusinessConf()
|
|
|
+// if e != nil {
|
|
|
+// br.Msg = "操作失败"
|
|
|
+// br.ErrMsg = "获取配置失败, Err: " + e.Error()
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// var taskReq services.TencentRecTaskReq
|
|
|
+// taskReq.FileUrl = req.FileName
|
|
|
+// taskReq.SecretId = conf[models.BusinessConfTencentApiSecretId]
|
|
|
+// taskReq.SecretKey = conf[models.BusinessConfTencentApiSecretKey]
|
|
|
+// taskReq.CallbackUrl = conf[models.BusinessConfTencentApiRecTaskCallbackUrl]
|
|
|
+// taskId, e := services.TencentCreateRecTask(taskReq)
|
|
|
+// if e != nil {
|
|
|
+// br.Msg = "操作失败"
|
|
|
+// br.ErrMsg = fmt.Sprintf("TencentCreateRecTask err: %s", e.Error())
|
|
|
+// return
|
|
|
+// }
|
|
|
+//
|
|
|
+// br.Data = taskId
|
|
|
+// br.Ret = 200
|
|
|
+// br.Success = true
|
|
|
+// br.Msg = "操作成功"
|
|
|
+//}
|