更新协议名

This commit is contained in:
wh_zcy 2022-11-08 10:02:08 +08:00
parent 95cf865134
commit 64e18214e4
3 changed files with 12 additions and 8 deletions

View File

@ -55,7 +55,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co
if master != nil { if master != nil {
//判断当前玩家是否是会长 //判断当前玩家是否是会长
if master.Uid == uid { //会长 if master.Uid == uid { //会长
this.module.modelSociaty.extendJob(uid, sociaty) this.module.modelSociaty.extendJob(master.Uid, sociaty)
} }
} }
rsp.Sociaty = sociaty rsp.Sociaty = sociaty

View File

@ -63,7 +63,7 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co
Uid: uid, Uid: uid,
SociatyId: sociaty.Id, 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 code = pb.ErrorCode_SystemError
} }
return return

View File

@ -569,22 +569,26 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
// srcMasterId 原会长ID // srcMasterId 原会长ID
func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error { func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error {
if sociaty.AccuseTime != 0 { if sociaty.AccuseTime != 0 {
ggd := this.moduleSociaty.configure.GetGlobalConf()
if ggd == nil {
return errors.New("config not found")
}
now := time.Now().Unix() now := time.Now().Unix()
//48小时内终止弹劾 //48小时内终止弹劾
if now-sociaty.AccuseTime < 48*3600 { if now-sociaty.AccuseTime < int64(ggd.GuildImpeachmentCountDown*3600) {
update := map[string]interface{}{ update := map[string]interface{}{
"accuseTime": 0, "accuseTime": 0,
} }
return this.updateSociaty(sociaty.Id, update) return this.updateSociaty(sociaty.Id, update)
} else { } else {
//会长降为普通成员
if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil {
return err
}
//选举新会长 //选举新会长
if err := this.electNewMaster(srcMasterId, sociaty); err != nil { if err := this.electNewMaster(srcMasterId, sociaty); err != nil {
return err return err
} }
//会长降为普通成员
if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil {
return err
}
} }
} }
return nil return nil
@ -602,7 +606,7 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia
vpIds = append(vpIds, m) vpIds = append(vpIds, m)
} else if m.Job == pb.SociatyJob_ADMIN { } else if m.Job == pb.SociatyJob_ADMIN {
aIds = append(aIds, m) aIds = append(aIds, m)
} else { } else if m.Job == pb.SociatyJob_MEMBER {
mIds = append(mIds, m) mIds = append(mIds, m)
} }
} }