service/app/mix/controller/streamerlink_op.go

38 lines
865 B
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package controller
import (
"service/api/consts"
"service/api/errcode"
streamerlinkproto "service/api/proto/streamerlink/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"github.com/gin-gonic/gin"
)
func OpGetStreamerLinkListByMid(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*streamerlinkproto.OpListByMidReq)
//设置默认页长
if req.Limit == 0 {
req.Limit = consts.DefaultPageSize
}
list, ec := service.DefaultService.OpGetStreamerLinkListByMid(ctx, req)
if ec != errcode.ErrCodeStreamerLinkSrvOk {
logger.Error("OpGetStreamerLinkListByMid fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
data := &streamerlinkproto.OpListByMidData{
List: list,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {
data.More = 1
}
ReplyOk(ctx, data)
}