上传公会弹劾代码修复
This commit is contained in:
parent
ce50e425c0
commit
c638d3bbce
@ -4,6 +4,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
"go_dreamfactory/utils"
|
"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)
|
master := this.module.modelSociaty.getMasterInfo(sociaty)
|
||||||
if master != nil {
|
if master != nil {
|
||||||
// 会长弹劾判断
|
if master.Uid == session.GetUserId() { //自己是会长
|
||||||
if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err == nil {
|
sociaty.AccuseTime = 0
|
||||||
// 获取新的会长
|
update := map[string]interface{}{
|
||||||
master = this.module.modelSociaty.getMasterInfo(sociaty)
|
"accuseTime": 0,
|
||||||
|
}
|
||||||
|
this.module.modelSociaty.updateSociaty(sociaty.Id, update)
|
||||||
} else {
|
} else {
|
||||||
|
now := configure.Now().Unix()
|
||||||
|
if now > sociaty.AccuseTime { // 重新选择会长
|
||||||
|
if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err != nil {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
Title: pb.ErrorCode_DBError.ToString(),
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
|
return
|
||||||
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()},
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rsp.Sociaty = sociaty
|
|
||||||
rsp.Master = master
|
rsp.Master = master
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rsp.Sociaty = sociaty
|
||||||
session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp)
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -656,15 +656,7 @@ 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 {
|
|
||||||
//会长在截至时间前进入公会终止弹劾
|
|
||||||
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 {
|
if err := this.electNewMaster(srcMasterId, sociaty); err != nil {
|
||||||
return err
|
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 {
|
if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user