go_dreamfactory/modules/friend/api_list.go
2022-06-15 19:25:55 +08:00

44 lines
918 B
Go

package friend
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
)
func (this *ApiComp) List_Check(session comm.IUserSession, req *pb.FriendListReq) (chk map[string]interface{}, code pb.ErrorCode) {
return
}
//好友列表
func (this *ApiComp) List(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendListReq) (err error) {
var (
code pb.ErrorCode
self *pb.DB_FriendData
rsp *pb.FriendListRsp
list []*pb.FriendBase
)
defer func() {
if code == pb.ErrorCode_Success {
rsp = &pb.FriendListRsp{
List: list,
}
}
session.SendMsg(string(this.module.GetType()), Friend_SubType_List, code, rsp)
}()
err = this.module.model_friend.GetObj(session.GetUserId(), self)
if self == nil || err != nil {
code = pb.ErrorCode_FriendSelfNoData
return
}
for _, userId := range self.FriendIds {
list = append(list, &pb.FriendBase{
UserId: userId,
})
}
return nil
}