49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package friend
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.FriendApplyListReq) (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) ApplyList(session comm.IUserSession, chk map[string]interface{}, req *pb.FriendApplyListReq) (code pb.ErrorCode) {
|
|
var (
|
|
self *pb.DBFriend
|
|
rsp *pb.FriendApplyListRsp
|
|
list []*pb.FriendBase
|
|
)
|
|
|
|
defer func() {
|
|
if code == pb.ErrorCode_Success {
|
|
rsp = &pb.FriendApplyListRsp{
|
|
List: list,
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), FriendSubTypeApplyList, rsp)
|
|
}()
|
|
|
|
if v, ok := chk["self"]; ok {
|
|
self = v.(*pb.DBFriend)
|
|
for _, userId := range self.ApplyIds {
|
|
//TODO 组装FriendBase明细数据
|
|
list = append(list, &pb.FriendBase{
|
|
UserId: userId,
|
|
})
|
|
}
|
|
}
|
|
|
|
return
|
|
}
|