23167 申请校验问题
This commit is contained in:
parent
52451919ec
commit
67f0f496d1
@ -388,7 +388,7 @@ func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//删除请求记录
|
||||
// 删除请求记录
|
||||
func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) error {
|
||||
for i := 0; i < len(sociaty.ApplyRecord); i++ {
|
||||
if sociaty.ApplyRecord[i].Uid == uid {
|
||||
@ -402,7 +402,7 @@ func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty)
|
||||
return this.updateSociaty(sociaty.Id, update)
|
||||
}
|
||||
|
||||
//添加成员
|
||||
// 添加成员
|
||||
func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
|
||||
if int32(len(sociaty.Members)) >= this.getMemberMax(sociaty) {
|
||||
return comm.NewCustomError(pb.ErrorCode_SociatyMemberCountLimit)
|
||||
@ -487,6 +487,19 @@ func (this *ModelSociaty) agree(uid string, sociaty *pb.DBSociaty) error {
|
||||
if this.isMember(uid, sociaty) {
|
||||
return comm.NewCustomError(pb.ErrorCode_SociatyBelongTo)
|
||||
}
|
||||
|
||||
// 判断改用户是否在申请记录中
|
||||
var flag bool
|
||||
for _, r := range sociaty.GetApplyRecord() {
|
||||
if r.Uid == uid {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !flag {
|
||||
return comm.NewCustomError(pb.ErrorCode_SociatyApplyCancel)
|
||||
}
|
||||
|
||||
//删除申请记录
|
||||
if err := this.delFromApplyRecord(uid, sociaty); err != nil {
|
||||
return err
|
||||
@ -501,7 +514,7 @@ func (this *ModelSociaty) agree(uid string, sociaty *pb.DBSociaty) error {
|
||||
return this.module.modelSociatyTask.initSociatyTask(uid, sociaty.Id)
|
||||
}
|
||||
|
||||
//拒绝
|
||||
// 拒绝
|
||||
func (this *ModelSociaty) refuse(uid string, sociaty *pb.DBSociaty) error {
|
||||
return this.delFromApplyRecord(uid, sociaty)
|
||||
}
|
||||
@ -542,7 +555,7 @@ func (this *ModelSociaty) discharge(targetId string, sociaty *pb.DBSociaty) erro
|
||||
return this.updateSociaty(sociaty.Id, update)
|
||||
}
|
||||
|
||||
//获取职位数
|
||||
// 获取职位数
|
||||
func (this *ModelSociaty) getJobCount(job pb.SociatyJob, sociaty *pb.DBSociaty) (count int) {
|
||||
for _, m := range sociaty.Members {
|
||||
if m.Job == job {
|
||||
@ -639,7 +652,7 @@ func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) e
|
||||
return nil
|
||||
}
|
||||
|
||||
//选举新会长
|
||||
// 选举新会长
|
||||
func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSociaty) error {
|
||||
vpIds := []*pb.SociatyMember{} // 副会长
|
||||
aIds := []*pb.SociatyMember{} //管理员
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user