diff --git a/modules/sociaty/api_cross_mine.go b/modules/sociaty/api_cross_mine.go index 1ea9ef6ec..a147fdf91 100644 --- a/modules/sociaty/api_cross_mine.go +++ b/modules/sociaty/api_cross_mine.go @@ -55,7 +55,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co if master != nil { //判断当前玩家是否是会长 if master.Uid == uid { //会长 - this.module.modelSociaty.extendJob(uid, sociaty) + this.module.modelSociaty.extendJob(master.Uid, sociaty) } } rsp.Sociaty = sociaty diff --git a/modules/sociaty/api_cross_quit.go b/modules/sociaty/api_cross_quit.go index c44860ba5..dd9e70163 100644 --- a/modules/sociaty/api_cross_quit.go +++ b/modules/sociaty/api_cross_quit.go @@ -63,7 +63,7 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co Uid: uid, SociatyId: sociaty.Id, } - if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil { + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp); err != nil { code = pb.ErrorCode_SystemError } return diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 63de1cdf3..1d1b6e2a9 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -569,22 +569,26 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error { // srcMasterId 原会长ID func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error { if sociaty.AccuseTime != 0 { + ggd := this.moduleSociaty.configure.GetGlobalConf() + if ggd == nil { + return errors.New("config not found") + } now := time.Now().Unix() //48小时内终止弹劾 - if now-sociaty.AccuseTime < 48*3600 { + if now-sociaty.AccuseTime < int64(ggd.GuildImpeachmentCountDown*3600) { update := map[string]interface{}{ "accuseTime": 0, } return this.updateSociaty(sociaty.Id, update) } else { - //会长降为普通成员 - if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil { - return err - } //选举新会长 if err := this.electNewMaster(srcMasterId, sociaty); err != nil { return err } + //会长降为普通成员 + if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil { + return err + } } } return nil @@ -602,7 +606,7 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia vpIds = append(vpIds, m) } else if m.Job == pb.SociatyJob_ADMIN { aIds = append(aIds, m) - } else { + } else if m.Job == pb.SociatyJob_MEMBER { mIds = append(mIds, m) } }