go_dreamfactory/modules/friend/api_blacklist.go
2022-07-01 14:51:11 +08:00

51 lines
1.0 KiB
Go

package friend
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) BlacklistCheck(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode) {
return
}
//黑名单
func (this *apiComp) Blacklist(session comm.IUserSession, req *pb.FriendBlackListReq) (code pb.ErrorCode, data proto.Message) {
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
}
}()
self = &pb.DBFriend{UId: session.GetUserId()}
err := this.module.modelFriend.Get(session.GetUserId(), self)
if self == nil || err != nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
for _, userId := range self.BlackIds {
//TODO 完善FriendBase信息
list = append(list, &pb.FriendBase{
UserId: userId,
})
}
return
}