This commit is contained in:
parent
210555f7d5
commit
ce2931c057
|
@ -4579,116 +4579,6 @@ func (m *Mongo) GetUserMomentVisitOffset(ctx *gin.Context, mid int64) (*dbstruct
|
|||
return usermomentvisitoffset, err
|
||||
}
|
||||
|
||||
// 账号处罚相关
|
||||
func (m *Mongo) CreateAccountPunishment(ctx *gin.Context, accountpunishment *dbstruct.AccountPunishment) error {
|
||||
col := m.getColAccountPunishment()
|
||||
_, err := col.InsertOne(ctx, accountpunishment)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) UpdateAccountPunishment(ctx *gin.Context, accountpunishment *dbstruct.AccountPunishment) error {
|
||||
col := m.getColAccountPunishment()
|
||||
set := util.EntityToM(accountpunishment)
|
||||
set["ut"] = time.Now().Unix()
|
||||
up := qmgo.M{
|
||||
"$set": set,
|
||||
}
|
||||
err := col.UpdateId(ctx, accountpunishment.Id, up)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) DeleteAccountPunishment(ctx *gin.Context, id int64) error {
|
||||
col := m.getColAccountPunishment()
|
||||
update := qmgo.M{
|
||||
"$set": qmgo.M{
|
||||
"del_flag": 1,
|
||||
},
|
||||
}
|
||||
err := col.UpdateId(ctx, id, update)
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListReq) ([]*dbstruct.AccountPunishment, error) {
|
||||
list := make([]*dbstruct.AccountPunishment, 0)
|
||||
col := m.getColAccountPunishment()
|
||||
query := qmgo.M{
|
||||
"status": qmgo.M{
|
||||
"$ne": consts.AccountPunishment_Interrupted,
|
||||
},
|
||||
"end_time": qmgo.M{
|
||||
"$gt": time.Now().Unix(),
|
||||
},
|
||||
"del_flag": 0,
|
||||
}
|
||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return list, err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetAccountPunishmentListById(ctx *gin.Context, id int64) (*dbstruct.AccountPunishment, error) {
|
||||
accountpunishment := &dbstruct.AccountPunishment{}
|
||||
col := m.getColAccountPunishment()
|
||||
query := qmgo.M{
|
||||
"_id": id,
|
||||
"del_flag": 0,
|
||||
}
|
||||
err := col.Find(ctx, query).One(&accountpunishment)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return nil, err
|
||||
}
|
||||
return accountpunishment, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetAccountPunishmentListByMidAndType(ctx *gin.Context, mid int64, typ int64) (*dbstruct.AccountPunishment, error) {
|
||||
accountpunishment := &dbstruct.AccountPunishment{}
|
||||
col := m.getColAccountPunishment()
|
||||
query := qmgo.M{
|
||||
"mid": mid,
|
||||
"type": typ,
|
||||
"status": qmgo.M{
|
||||
"$ne": consts.AccountPunishment_Interrupted,
|
||||
},
|
||||
"end_time": qmgo.M{
|
||||
"$gt": time.Now().Unix(),
|
||||
},
|
||||
"del_flag": 0,
|
||||
}
|
||||
err := col.Find(ctx, query).One(&accountpunishment)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return nil, err
|
||||
}
|
||||
return accountpunishment, err
|
||||
}
|
||||
|
||||
func (m *Mongo) GetTerminatedAccountPunishmentList(ctx *gin.Context, req *accountpunishmentproto.OpListTerminatedReq) ([]*dbstruct.AccountPunishment, error) {
|
||||
list := make([]*dbstruct.AccountPunishment, 0)
|
||||
col := m.getColAccountPunishment()
|
||||
query := qmgo.M{
|
||||
"$or": []qmgo.M{
|
||||
{
|
||||
"status": consts.AccountPunishment_Interrupted,
|
||||
},
|
||||
{
|
||||
"end_time": qmgo.M{
|
||||
"$lte": time.Now().Unix(),
|
||||
},
|
||||
},
|
||||
},
|
||||
"del_flag": 0,
|
||||
}
|
||||
err := col.Find(ctx, query).Sort("-ct").Skip(int64(req.Offset)).Limit(int64(req.Limit)).All(&list)
|
||||
if err == qmgo.ErrNoSuchDocuments {
|
||||
err = nil
|
||||
return list, err
|
||||
}
|
||||
return list, err
|
||||
}
|
||||
|
||||
// 空间对话表相关
|
||||
func (m *Mongo) CreateZoneSession(ctx *gin.Context, zonesession *dbstruct.ZoneSession) error {
|
||||
col := m.getColZoneSession()
|
||||
|
|
Loading…
Reference in New Issue