Merge pull request 'feat-IRONFANS-70' (#266) from feat-IRONFANS-70 into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/266
This commit is contained in:
chenhao 2024-04-11 18:34:05 +08:00
commit 9d53f252ce
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

@ -3970,16 +3970,18 @@ func (m *Mongo) GetZoneMomentListByZid(ctx *gin.Context, req *zonemomentproto.Op
} }
orClause := make([]qmgo.M, 0) orClause := make([]qmgo.M, 0)
if len(ctClause) != 0 {
orClause = append(orClause, qmgo.M{ orClause = append(orClause, qmgo.M{
"is_headed": consts.IsHeaded_Yes, "is_headed": consts.IsHeaded_Yes,
}) })
if len(ctClause) != 0 {
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().