From 43a2893d2928f5c78788b1bdf54cd9698ec94b9c Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 8 Nov 2022 14:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sociaty/model_sociaty.go | 10 +++++----- sys/db/dbmodel.go | 6 +++++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 584e6350d..53b31e3a3 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -554,12 +554,12 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error { //会长离线时间 now := time.Now().Unix() left := now - user.Offlinetime - if left < int64(ggd.GuildImpeachmentCountDown*3600) || user.Offlinetime == 0 { + if left < int64(ggd.GuildInitiateImpeachmentTime*3600) || user.Offlinetime == 0 { return errors.New("会长很称职,无需弹劾") } else { - //更新会长的弹劾时间 + //更新会长的弹劾倒计时时间 update := map[string]interface{}{ - "accuseTime": time.Now().Unix(), + "accuseTime": utils.AddHour(int(ggd.GuildImpeachmentCountDown)), } return this.updateSociaty(sociaty.Id, update) } @@ -573,9 +573,9 @@ func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) e if ggd == nil { return errors.New("config not found") } - now := time.Now().Unix() //终止弹劾 - if now-sociaty.AccuseTime < int64(ggd.GuildImpeachmentCountDown*3600) { + now := time.Now().Unix() + if now < sociaty.AccuseTime { update := map[string]interface{}{ "accuseTime": 0, } diff --git a/sys/db/dbmodel.go b/sys/db/dbmodel.go index 76868d14e..20caa25a9 100644 --- a/sys/db/dbmodel.go +++ b/sys/db/dbmodel.go @@ -277,7 +277,11 @@ func (this *DBModel) ChangeList(uid string, _id string, data map[string]interfac option := newDBOption(opt...) if option.IsMgoLog { - err = this.UpdateModelLogs(this.TableName, uid, bson.M{"_id": _id, "uid": uid}, data) + if uid == "" { + err = this.UpdateModelLogs(this.TableName, uid, bson.M{"_id": _id}, data) + }else{ + err = this.UpdateModelLogs(this.TableName, uid, bson.M{"_id": _id, "uid": uid}, data) + } } if this.Expired > 0 { this.conn.UpDateModelExpired(this.ukey(uid), nil, this.Expired)