package friend import ( "go_dreamfactory/comm" "go_dreamfactory/pb" ) func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (chk map[string]interface{}, code comm.ErrorCode) { chk = make(map[string]interface{}) self := &pb.DBFriend{UId: session.GetUserId()} err := this.module.modelFriend.Get(session.GetUserId(), self) if self == nil || err != nil { code = comm.ErrorCode{Code: pb.ErrorCode_FriendSelfNoData} return } chk["self"] = self return } //黑名单 func (this *apiComp) Blacklist(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendBlackListReq) (code pb.ErrorCode) { var ( self *pb.DBFriend rsp *pb.FriendBlackListRsp list []*pb.FriendBase ) defer func() { rsp = &pb.FriendBlackListRsp{ Friends: list, } err := session.SendMsg(string(this.module.GetType()), FriendSubTypeBlacklist, rsp) if err != nil { code = pb.ErrorCode_SystemError return } }() if v, ok := chk["self"]; ok { self = v.(*pb.DBFriend) for _, userId := range self.BlackIds { //TODO 完善FriendBase信息 list = append(list, &pb.FriendBase{ UserId: userId, }) } } return }