Merge pull request 'by Robin at 20240411' (#265) from dev-feat-IRONFANS-70-Robin into feat-IRONFANS-70

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/265
This commit is contained in:
chenhao 2024-04-11 18:33:56 +08:00
commit 1301c0a9ec
3 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,7 @@ const (
AccountPunishment_BlockFromCreatingMoment = 0 // 禁止发贴 AccountPunishment_BlockFromCreatingMoment = 0 // 禁止发贴
AccountPunishment_BlockFromCreatingFreeZoneMoment = 1 // 禁止发免费空间贴 AccountPunishment_BlockFromCreatingFreeZoneMoment = 1 // 禁止发免费空间贴
AccountPunishment_BlockFromCreatingPaidZoneMoment = 2 // 禁止发付费空间贴 AccountPunishment_BlockFromCreatingPaidZoneMoment = 2 // 禁止发付费空间贴
AccountPunishment_BlockFromCreatingZoneMoment = 3 // 禁止发空间贴
) )
const ( const (

View File

@ -4082,16 +4082,18 @@ func (m *Mongo) GetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.Op
} }
orClause := make([]qmgo.M, 0) orClause := make([]qmgo.M, 0)
orClause = append(orClause, qmgo.M{
"is_headed": consts.IsHeaded_Yes,
})
if len(ctClause) != 0 { if len(ctClause) != 0 {
orClause = append(orClause, qmgo.M{
"is_headed": consts.IsHeaded_Yes,
})
orClause = append(orClause, qmgo.M{ orClause = append(orClause, qmgo.M{
"ct": ctClause, "ct": ctClause,
}) })
} }
if len(orClause) != 0 {
query["$or"] = orClause
}
query["$or"] = orClause
err := col.Find(ctx, query).Sort("-is_headed", "-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list) err := col.Find(ctx, query).Sort("-is_headed", "-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
if err == qmgo.ErrNoSuchDocuments { if err == qmgo.ErrNoSuchDocuments {
err = nil err = nil

View File

@ -560,6 +560,7 @@ func (s *Service) ApiCreateZoneMomentBusinessValidate(ctx *gin.Context, req *zon
QueryAccount(_DefaultAccount.OpListByMid). QueryAccount(_DefaultAccount.OpListByMid).
EnsureAccountExist(). EnsureAccountExist().
EnsureIsThisRole(consts.Streamer). EnsureIsThisRole(consts.Streamer).
EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, consts.AccountPunishment_BlockFromCreatingZoneMoment, _DefaultAccountPunishment.OpListByMidAndType).
EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, pType, _DefaultAccountPunishment.OpListByMidAndType). EnsureSuchAccountPunishmentNotExist(req.GetBaseRequest().Mid, pType, _DefaultAccountPunishment.OpListByMidAndType).
EnsureAmongZoneMomentsPaidItemsLessThanFreeItems(_DefaultZoneMoment.OpCountByMidAndCType, req.GetBaseRequest().Mid, util.DerefInt64(req.CType)). EnsureAmongZoneMomentsPaidItemsLessThanFreeItems(_DefaultZoneMoment.OpCountByMidAndCType, req.GetBaseRequest().Mid, util.DerefInt64(req.CType)).
Validate(). Validate().