上传公会弹劾代码修复
This commit is contained in:
parent
ce50e425c0
commit
c638d3bbce
@ -4,6 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/utils"
|
||||
)
|
||||
|
||||
@ -74,32 +75,33 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (er
|
||||
}
|
||||
}
|
||||
|
||||
if sociaty.AccuseTime > 0 {
|
||||
// 获取会长
|
||||
master := this.module.modelSociaty.getMasterInfo(sociaty)
|
||||
if master != nil {
|
||||
// 会长弹劾判断
|
||||
if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err == nil {
|
||||
// 获取新的会长
|
||||
master = this.module.modelSociaty.getMasterInfo(sociaty)
|
||||
if master.Uid == session.GetUserId() { //自己是会长
|
||||
sociaty.AccuseTime = 0
|
||||
update := map[string]interface{}{
|
||||
"accuseTime": 0,
|
||||
}
|
||||
this.module.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||
} else {
|
||||
now := configure.Now().Unix()
|
||||
if now > sociaty.AccuseTime { // 重新选择会长
|
||||
if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err != nil {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DBError,
|
||||
Title: pb.ErrorCode_DBError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
|
||||
this.module.Error("会长弹劾",
|
||||
log.Field{Key: "uid", Value: uid},
|
||||
log.Field{Key: "sociatyId", Value: sociaty.Id},
|
||||
log.Field{Key: "master", Value: master.Uid},
|
||||
log.Field{Key: "err", Value: err.Error()},
|
||||
)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
rsp.Sociaty = sociaty
|
||||
rsp.Master = master
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rsp.Sociaty = sociaty
|
||||
session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp)
|
||||
return
|
||||
}
|
||||
|
@ -656,15 +656,7 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
|
||||
// 会长在截至时间前进入公会终止弹劾,否则进行新会长选举
|
||||
// srcMasterId 原会长ID
|
||||
func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error {
|
||||
if sociaty.AccuseTime != 0 {
|
||||
//会长在截至时间前进入公会终止弹劾
|
||||
now := configure.Now().Unix()
|
||||
if now < sociaty.AccuseTime {
|
||||
update := map[string]interface{}{
|
||||
"accuseTime": 0,
|
||||
}
|
||||
return this.updateSociaty(sociaty.Id, update)
|
||||
} else {
|
||||
|
||||
//选举新会长
|
||||
if err := this.electNewMaster(srcMasterId, sociaty); err != nil {
|
||||
return err
|
||||
@ -673,8 +665,7 @@ func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) e
|
||||
if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user