Merge branch 'dev_PF' into test

This commit is contained in:
lwl0608 2024-09-14 16:25:32 +08:00
commit 80eabf0a5e
6 changed files with 51 additions and 0 deletions

View File

@ -104,3 +104,9 @@ type OpUpdateVideoCompressReq struct {
}
type OpUpdateVideoCompressData struct{}
type OpUpdateVideoPFReq struct {
Id int64 `json:"id"`
PixelFormat string `json:"pixel_format"`
PixelFormat720 string `json:"pixel_format_720"`
}

View File

@ -539,6 +539,7 @@ func Init(r *gin.Engine) {
opMediaGroup := r.Group("/op/media", PrepareToC())
opMediaGroup.POST("get_videos_by_status", middleware.JSONParamValidator(mediaproto.OpGetVideosByStatusReq{}), OpGetVideosByStatus)
opMediaGroup.POST("update_video_compress", middleware.JSONParamValidator(mediaproto.OpUpdateVideoCompressReq{}), OpUpdateVideoCompress)
opMediaGroup.POST("update_video_pf", middleware.JSONParamValidator(mediaproto.OpUpdateVideoPFReq{}), OpUpdateVideoPF)
// 主播标签
opStreamerTagGroup := r.Group("/op/streamer_tag", PrepareOp())

View File

@ -68,3 +68,14 @@ func OpUpdateVideoCompress(ctx *gin.Context) {
}
ReplyOk(ctx, nil)
}
func OpUpdateVideoPF(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*mediaproto.OpUpdateVideoPFReq)
ec := service.DefaultService.OpUpdateVideoPF(ctx, req)
if ec != errcode.ErrCodeMediaSrvOk {
logger.Error("OpUpdateVideoPF fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
ReplyOk(ctx, nil)
}

View File

@ -1087,6 +1087,24 @@ func (m *Mongo) UpdateVideoCompress(ctx *gin.Context, req *mediaproto.OpUpdateVi
return col.UpdateId(ctx, req.Id, up)
}
func (m *Mongo) UpdateVideoPF(ctx *gin.Context, req *mediaproto.OpUpdateVideoPFReq) error {
col := m.getColVideo()
set := qmgo.M{}
if len(req.PixelFormat) > 0 {
set["pixel_format"] = req.PixelFormat
}
if len(req.PixelFormat720) > 0 {
set["pixel_format_720"] = req.PixelFormat720
}
if len(set) <= 0 {
return nil
}
up := qmgo.M{
"$set": set,
}
return col.UpdateId(ctx, req.Id, up)
}
// 登录表
func (m *Mongo) CreateLogin(ctx *gin.Context, login *dbstruct.Login) error {
col := m.getColLogin()

View File

@ -275,3 +275,7 @@ func (m *Media) OpGetVideosByStatus(ctx *gin.Context, req *mediaproto.OpGetVideo
func (m *Media) OpUpdateVideoCompress(ctx *gin.Context, req *mediaproto.OpUpdateVideoCompressReq) error {
return m.store.UpdateVideoCompress(ctx, req)
}
func (m *Media) OpUpdateVideoPF(ctx *gin.Context, req *mediaproto.OpUpdateVideoPFReq) error {
return m.store.UpdateVideoPF(ctx, req)
}

View File

@ -3006,6 +3006,17 @@ func (s *Service) OpUpdateVideoCompress(ctx *gin.Context, req *mediaproto.OpUpda
return
}
func (s *Service) OpUpdateVideoPF(ctx *gin.Context, req *mediaproto.OpUpdateVideoPFReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeMediaSrvOk
err := _DefaultMedia.OpUpdateVideoPF(ctx, req)
if err != nil {
logger.Error("OpUpdateVideoPF fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeMediaSrvFail
return
}
return
}
func (s *Service) OpGetPlatformListByIds(ctx *gin.Context, ids []int64) (list []*apollostruct.PlatformCfg, ec errcode.ErrCode) {
ec = errcode.ErrCodeOk