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.
65 lines
1.7 KiB
65 lines
1.7 KiB
package echomeet
|
|
|
|
import (
|
|
"yunyan/comm"
|
|
"yunyan/pb"
|
|
"yunyan/utils"
|
|
"time"
|
|
)
|
|
|
|
// @Summary 新增会议记录
|
|
// @Description 新增一条会议记录,支持携带已有转写内容
|
|
// @Tags Echomeet
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Security BearerAuth
|
|
// @Param user body pb.EchomeetAddRecordReq true "请求数据"
|
|
// @Success 200 {object} comm.HttpResult{data=pb.EchomeetAddRecordResp} "响应数据"
|
|
// @Router /api/home/echomeet_addrecord [post]
|
|
func (this *apiComp) AddRecord(session comm.IUserSession, req *pb.EchomeetAddRecordReq) (resp *pb.EchomeetAddRecordResp, errdata *pb.ErrorData) {
|
|
var (
|
|
model *pb.DBEchoMeetRecord
|
|
err error
|
|
)
|
|
// 注释图片列表与 original 同套编码:DB 用 string 列存 JSON 数组,空列表则留空串。
|
|
imageurls := ""
|
|
if len(req.Imageurls) > 0 {
|
|
imageurls = utils.ToString(req.Imageurls)
|
|
}
|
|
model = &pb.DBEchoMeetRecord{
|
|
Uid: session.GetUserId(),
|
|
Creationtime: time.Now().Unix(),
|
|
Title: req.Title,
|
|
Filepath: req.Filepath,
|
|
Seconds: req.Seconds,
|
|
Size: req.Size,
|
|
Rtype: req.Rtype,
|
|
Remark: req.Remark,
|
|
Imageurls: imageurls,
|
|
State: pb.DBEchoMeetRecordState_Unknow,
|
|
}
|
|
if err = this.module.model.addrecord(model); err != nil {
|
|
errdata = &pb.ErrorData{
|
|
Code: pb.ErrorCode_DBError,
|
|
Message: err.Error(),
|
|
}
|
|
return
|
|
}
|
|
|
|
if req.Original != nil { //转写已存在
|
|
for _, v := range req.Original {
|
|
v.Meetingid = model.Id
|
|
}
|
|
model.Original = utils.ToString(req.Original)
|
|
model.Translate = model.Original
|
|
if err = this.module.model.saverecord(model); err != nil {
|
|
return
|
|
}
|
|
|
|
}
|
|
|
|
resp = &pb.EchomeetAddRecordResp{
|
|
Record: model,
|
|
}
|
|
return
|
|
}
|
|
|