package sociaty import ( "go_dreamfactory/comm" "go_dreamfactory/pb" "google.golang.org/protobuf/proto" ) // 弹劾会长 func (this *apiComp) AsscuseCheck(session comm.IUserSession, req *pb.SociatyAccuseReq) (code pb.ErrorCode) { return } func (this *apiComp) Asscuse(session comm.IUserSession, req *pb.SociatyAccuseReq) (code pb.ErrorCode, data proto.Message) { if code = this.AsscuseCheck(session, req); code != pb.ErrorCode_Success { return } uid := session.GetUserId() sociaty := this.module.modelSociaty.getUserSociaty(uid) if sociaty.Id == "" { code = pb.ErrorCode_SociatyNoFound this.module.Errorf("uid:%s not in sociaty", uid) return } if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_VICEPRESIDENT, pb.SociatyJob_ADMIN, pb.SociatyJob_MEMBER) { code = pb.ErrorCode_SociatyNoRight return } if err := this.module.modelSociaty.accuse(sociaty); err != nil { code = pb.ErrorCode_SociatyAccuse this.module.Errorf("弹劾失败:%v", err) return } rsp := &pb.SociatyAccuseResp{ SociatyId: sociaty.Id, } if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp); err != nil { code = pb.ErrorCode_SystemError } return }