43 lines
859 B
Go
43 lines
859 B
Go
package friend
|
|
|
|
import (
|
|
"context"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
"go_dreamfactory/sys/cache"
|
|
)
|
|
|
|
//黑名单
|
|
func (this *ApiComp) Blacklist(ctx context.Context, session comm.IUserSession, req *pb.FriendBlackListReq) (err error) {
|
|
var (
|
|
code pb.ErrorCode
|
|
self *pb.Cache_FriendData
|
|
rsp *pb.FriendBlackListRsp
|
|
list []*pb.FriendBase
|
|
)
|
|
|
|
defer func() {
|
|
if code == pb.ErrorCode_Success {
|
|
rsp = &pb.FriendBlackListRsp{
|
|
Friends: list,
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), Friend_SubType_Blacklist, code, rsp)
|
|
}()
|
|
|
|
self, err = cache.Defsys.Friend_Get(session.GetUserId())
|
|
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 nil
|
|
}
|