by Robin at 20240222; fix
This commit is contained in:
parent
59f206a612
commit
967d383b46
|
@ -1186,6 +1186,10 @@ func (m *Mongo) GetMomentListByMid(ctx *gin.Context, req *momentproto.OpListByMi
|
||||||
list := make([]*dbstruct.Moment, 0)
|
list := make([]*dbstruct.Moment, 0)
|
||||||
col := m.getColMoment()
|
col := m.getColMoment()
|
||||||
//ct_lower_bound < ct <= ct_upper_bound
|
//ct_lower_bound < ct <= ct_upper_bound
|
||||||
|
query := qmgo.M{
|
||||||
|
"mid": util.DerefInt64(req.Mid),
|
||||||
|
"del_flag": 0,
|
||||||
|
}
|
||||||
ctClause := qmgo.M{}
|
ctClause := qmgo.M{}
|
||||||
if req.CtLowerBound != nil {
|
if req.CtLowerBound != nil {
|
||||||
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
|
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
|
||||||
|
@ -1193,10 +1197,8 @@ func (m *Mongo) GetMomentListByMid(ctx *gin.Context, req *momentproto.OpListByMi
|
||||||
if req.CtUpperBound != nil {
|
if req.CtUpperBound != nil {
|
||||||
ctClause["$lte"] = util.DerefInt64(req.CtUpperBound)
|
ctClause["$lte"] = util.DerefInt64(req.CtUpperBound)
|
||||||
}
|
}
|
||||||
query := qmgo.M{
|
if len(ctClause) != 0 {
|
||||||
"mid": util.DerefInt64(req.Mid),
|
query["ct"] = ctClause
|
||||||
"ct": ctClause,
|
|
||||||
"del_flag": 0,
|
|
||||||
}
|
}
|
||||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
||||||
if err == qmgo.ErrNoSuchDocuments {
|
if err == qmgo.ErrNoSuchDocuments {
|
||||||
|
@ -1210,6 +1212,12 @@ func (m *Mongo) GetMomentListByMids(ctx *gin.Context, req *momentproto.OpListByM
|
||||||
list := make([]*dbstruct.Moment, 0)
|
list := make([]*dbstruct.Moment, 0)
|
||||||
col := m.getColMoment()
|
col := m.getColMoment()
|
||||||
//ct_lower_bound < ct <= ct_upper_bound
|
//ct_lower_bound < ct <= ct_upper_bound
|
||||||
|
query := qmgo.M{
|
||||||
|
"mid": bson.M{
|
||||||
|
"$in": req.Mids,
|
||||||
|
},
|
||||||
|
"del_flag": 0,
|
||||||
|
}
|
||||||
ctClause := qmgo.M{}
|
ctClause := qmgo.M{}
|
||||||
if req.CtLowerBound != nil {
|
if req.CtLowerBound != nil {
|
||||||
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
|
ctClause["$gt"] = util.DerefInt64(req.CtLowerBound)
|
||||||
|
@ -1217,12 +1225,8 @@ func (m *Mongo) GetMomentListByMids(ctx *gin.Context, req *momentproto.OpListByM
|
||||||
if req.CtUpperBound != nil {
|
if req.CtUpperBound != nil {
|
||||||
ctClause["$lte"] = util.DerefInt64(req.CtUpperBound)
|
ctClause["$lte"] = util.DerefInt64(req.CtUpperBound)
|
||||||
}
|
}
|
||||||
query := qmgo.M{
|
if len(ctClause) != 0 {
|
||||||
"mid": bson.M{
|
query["ct"] = ctClause
|
||||||
"$in": req.Mids,
|
|
||||||
},
|
|
||||||
"ct": ctClause,
|
|
||||||
"del_flag": 0,
|
|
||||||
}
|
}
|
||||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
||||||
if err == qmgo.ErrNoSuchDocuments {
|
if err == qmgo.ErrNoSuchDocuments {
|
||||||
|
|
Loading…
Reference in New Issue