by Robin at 20240430
This commit is contained in:
parent
e8ddb5bb9e
commit
7f18d00df4
|
@ -140,6 +140,27 @@ type OpListByZidResp struct {
|
||||||
Data *OpListByZidData `json:"data"`
|
Data *OpListByZidData `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// op 列表-user_id直查
|
||||||
|
type OpListByUserIdReq struct {
|
||||||
|
base.BaseRequest
|
||||||
|
UserId int64 `json:"user_id"` //user_id
|
||||||
|
CtUpperBound *int64 `json:"ct_upper_bound"` //创建时间上界,闭区间
|
||||||
|
CtLowerBound *int64 `json:"ct_lower_bound"` //创建时间下界,开区间,可为0
|
||||||
|
Offset int `json:"offset"`
|
||||||
|
Limit int `json:"limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpListByUserIdData struct {
|
||||||
|
ListByUserId []*OpZoneMomentVO `json:"list"`
|
||||||
|
Offset int `json:"offset"`
|
||||||
|
More int `json:"more"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type OpListByUserIdResp struct {
|
||||||
|
base.BaseResponse
|
||||||
|
Data *OpListByUserIdData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
// op 点赞
|
// op 点赞
|
||||||
type OpZoneMomentThumbsUpReq struct {
|
type OpZoneMomentThumbsUpReq struct {
|
||||||
base.BaseRequest
|
base.BaseRequest
|
||||||
|
|
|
@ -500,6 +500,7 @@ func Init(r *gin.Engine) {
|
||||||
opZoneMomentGroup.POST("update", middleware.JSONParamValidator(zonemomentproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZoneMoment)
|
opZoneMomentGroup.POST("update", middleware.JSONParamValidator(zonemomentproto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZoneMoment)
|
||||||
opZoneMomentGroup.POST("delete", middleware.JSONParamValidator(zonemomentproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneMoment)
|
opZoneMomentGroup.POST("delete", middleware.JSONParamValidator(zonemomentproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneMoment)
|
||||||
opZoneMomentGroup.POST("list", middleware.JSONParamValidator(zonemomentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentList)
|
opZoneMomentGroup.POST("list", middleware.JSONParamValidator(zonemomentproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentList)
|
||||||
|
opZoneMomentGroup.POST("list_by_user_id", middleware.JSONParamValidator(zonemomentproto.OpListByUserIdReq{}), middleware.JwtAuthenticator(), OpGetZoneMomentListByUserId)
|
||||||
opZoneMomentGroup.POST("review", middleware.JSONParamValidator(zonemomentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewZoneMoment)
|
opZoneMomentGroup.POST("review", middleware.JSONParamValidator(zonemomentproto.OpReviewReq{}), middleware.JwtAuthenticator(), OpReviewZoneMoment)
|
||||||
opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment)
|
opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment)
|
||||||
|
|
||||||
|
|
|
@ -80,6 +80,38 @@ func OpGetZoneMomentList(ctx *gin.Context) {
|
||||||
ReplyOk(ctx, data)
|
ReplyOk(ctx, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func OpGetZoneMomentListByUserId(ctx *gin.Context) {
|
||||||
|
req := ctx.MustGet("client_req").(*zonemomentproto.OpListByUserIdReq)
|
||||||
|
|
||||||
|
//设置默认页长
|
||||||
|
if req.Limit == 0 {
|
||||||
|
req.Limit = consts.DefaultPageSize
|
||||||
|
}
|
||||||
|
|
||||||
|
list, ec := service.DefaultService.OpGetZoneMomentListByUserId(ctx, req)
|
||||||
|
if ec != errcode.ErrCodeZoneMomentSrvOk {
|
||||||
|
logger.Error("OpGetZoneMomentListByUserId fail, req: %v, ec: %v", util.ToJson(req), ec)
|
||||||
|
ReplyErrCodeMsg(ctx, ec)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//填充媒体切片
|
||||||
|
mediaFillableList := make([]mediafiller.MediaFillable, len(list))
|
||||||
|
for i, media := range list {
|
||||||
|
mediaFillableList[i] = media.MediaComp
|
||||||
|
}
|
||||||
|
mediafiller.FillList(ctx, mediaFillableList)
|
||||||
|
|
||||||
|
data := &zonemomentproto.OpListByUserIdData{
|
||||||
|
ListByUserId: list,
|
||||||
|
Offset: req.Offset + len(list),
|
||||||
|
}
|
||||||
|
if len(list) >= req.Limit {
|
||||||
|
data.More = 1
|
||||||
|
}
|
||||||
|
ReplyOk(ctx, data)
|
||||||
|
}
|
||||||
|
|
||||||
func OpReviewZoneMoment(ctx *gin.Context) {
|
func OpReviewZoneMoment(ctx *gin.Context) {
|
||||||
req := ctx.MustGet("client_req").(*zonemomentproto.OpReviewReq)
|
req := ctx.MustGet("client_req").(*zonemomentproto.OpReviewReq)
|
||||||
ec := service.DefaultService.OpReviewZoneMoment(ctx, req)
|
ec := service.DefaultService.OpReviewZoneMoment(ctx, req)
|
||||||
|
|
|
@ -3368,6 +3368,42 @@ func (s *Service) OpGetZoneMomentList(ctx *gin.Context, req *zonemomentproto.OpL
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) OpGetZoneMomentListByUserId(ctx *gin.Context, req *zonemomentproto.OpListByUserIdReq) (volist []*zonemomentproto.OpZoneMomentVO, ec errcode.ErrCode) {
|
||||||
|
ec = errcode.ErrCodeZoneMomentSrvOk
|
||||||
|
|
||||||
|
account, err := _DefaultAccount.OpListByUserId(ctx, &accountproto.OpListByUserIdReq{
|
||||||
|
UserId: goproto.Int64(req.UserId),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("_DefaultAccount OpListByUserId fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
|
ec = errcode.ErrCodeAccountSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if account == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := _DefaultZoneMoment.OpListByMid(ctx, &zonemomentproto.OpListByMidReq{
|
||||||
|
BaseRequest: req.BaseRequest,
|
||||||
|
CtUpperBound: req.CtUpperBound,
|
||||||
|
CtLowerBound: req.CtLowerBound,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("OpGetZoneMomentListByMid fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
|
ec = errcode.ErrCodeZoneMomentSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充信息
|
||||||
|
volist, err = s.utilFillZoneMomentsWithOpVOInfo(ctx, list)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("utilFillZoneMomentsWithOpVOInfo fail, req: %v, err: %v", util.ToJson(req), err)
|
||||||
|
ec = errcode.ErrCodeZoneMomentSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpReviewReq) (ec errcode.ErrCode) {
|
func (s *Service) OpReviewZoneMoment(ctx *gin.Context, req *zonemomentproto.OpReviewReq) (ec errcode.ErrCode) {
|
||||||
ec = errcode.ErrCodeZoneMomentSrvOk
|
ec = errcode.ErrCodeZoneMomentSrvOk
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue