Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
03fc105ef6
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user