by Robin at 20240411

This commit is contained in:
Leufolium 2024-04-11 16:52:30 +08:00
parent 76f35eaced
commit 0dd9eb1360
2 changed files with 56 additions and 3 deletions

View File

@ -186,3 +186,23 @@ type OpHeadResp struct {
base.BaseResponse
Data *OpHeadData `json:"data"`
}
// op 列表
type OpCountByZidReq struct {
base.BaseRequest
Zid *int64 `json:"zid"` // 空间id
MType *int64 `json:"m_type"` // 媒体类型
CType *int64 `json:"c_type"` // 付费模式
IsIronfanVisible *int64 `json:"is_ironfan_visible"` // 是否铁粉可见
CtUpperBound *int64 `json:"ct_upper_bound"` // 创建时间上界,闭区间
CtLowerBound *int64 `json:"ct_lower_bound"` // 创建时间下界开区间可为0
Status *int64 `json:"status"` // 状态
}
type OpCountByZidData struct {
}
type OpLCountByZidResp struct {
base.BaseResponse
Data *OpListByMidData `json:"data"`
}

View File

@ -4072,9 +4072,11 @@ func (m *Mongo) GetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.Op
orClause = append(orClause, qmgo.M{
"is_headed": consts.IsHeaded_Yes,
})
orClause = append(orClause, qmgo.M{
"ct": ctClause,
})
if len(ctClause) != 0 {
orClause = append(orClause, qmgo.M{
"ct": ctClause,
})
}
query["$or"] = orClause
err := col.Find(ctx, query).Sort("-is_headed", "-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
@ -4119,6 +4121,37 @@ func (m *Mongo) GetZoneMomentListByMid(ctx *gin.Context, req *zonemomentproto.Op
return list, err
}
func (m *Mongo) GetZoneMomentCountByZid(ctx *gin.Context, req *zonemomentproto.OpCountByZidReq) (int64, error) {
col := m.getColZoneMoment()
query := qmgo.M{
"zid": util.DerefInt64(req.Zid),
"del_flag": 0,
}
if req.MType != nil {
query["m_type"] = util.DerefInt64(req.MType)
}
if req.CType != nil {
query["c_type"] = util.DerefInt64(req.CType)
}
if req.IsIronfanVisible != nil {
query["is_ironfan_visible"] = util.DerefInt64(req.IsIronfanVisible)
}
if req.Status != nil {
query["status"] = util.DerefInt64(req.Status)
}
ctClause := qmgo.M{}
if req.CtLowerBound != nil {
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
}
if req.CtUpperBound != nil {
ctClause["$lte"] = util.DerefInt64(req.CtUpperBound)
}
if len(ctClause) != 0 {
query["ct"] = ctClause
}
return col.Find(ctx, query).Count()
}
func (m *Mongo) ThumbsUpZoneMoment(ctx *gin.Context, req *zonemomentproto.OpZoneMomentThumbsUpReq) (err error) {
col := m.getColMoment()
change := qmgo.Change{