You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.5 KiB
43 lines
1.5 KiB
package echomeet
|
|
|
|
import (
|
|
"yunyan/comm"
|
|
"yunyan/pb"
|
|
"time"
|
|
)
|
|
|
|
// @Summary 获取单条会议记录
|
|
// @Description 根据 Id 获取单条会议记录,若处于转写中会触发一次状态轮询
|
|
// @Tags Echomeet
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security BearerAuth
|
|
// @Param user body pb.EchomeetGetRecordReq true "请求数据"
|
|
// @Success 200 {object} comm.HttpResult{data=pb.EchomeetGetRecordResp} "响应数据"
|
|
// @Router /api/home/echomeet_getrecord [post]
|
|
func (this *apiComp) GetRecord(session comm.IUserSession, req *pb.EchomeetGetRecordReq) (resp *pb.EchomeetGetRecordResp, errdata *pb.ErrorData) {
|
|
uid, errdata := requireUID(session)
|
|
if errdata != nil {
|
|
return
|
|
}
|
|
model, err := this.module.model.getrecordforuid(uid, req.Id)
|
|
if err != nil {
|
|
errdata = recordErr(err)
|
|
return
|
|
}
|
|
polled := make(map[uint64]bool)
|
|
if model.State == pb.DBEchoMeetRecordState_Transcribing && model.Taskid != "" {
|
|
now := time.Now().Unix()
|
|
if model.Lastquerytime <= 0 || now-model.Lastquerytime >= TranscribeQueryMinInterval {
|
|
model.Lastquerytime = now
|
|
this.module.model.saverecord(model)
|
|
this.module.tasks.PollTranscribe(model)
|
|
polled[model.Id] = true
|
|
}
|
|
}
|
|
// 与 GetRecords 同一处理:转写刚完成那一轮,State 已推进而 Translate 还没落库,
|
|
// 对外要继续报 Transcribing。理由见 hideHalfDoneTranscribe 的注释。
|
|
hideHalfDoneTranscribe(polled, []*pb.DBEchoMeetRecord{model})
|
|
resp = &pb.EchomeetGetRecordResp{Record: model}
|
|
return
|
|
}
|
|
|