34 lines
664 B
Go
34 lines
664 B
Go
package friend
|
|
|
|
import (
|
|
"context"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//搜索
|
|
func (this *ApiComp) Search(ctx context.Context, session comm.IUserSession, req *pb.FriendSearchReq) error {
|
|
var (
|
|
code pb.ErrorCode
|
|
rsp *pb.FriendSearchRsp
|
|
friend *pb.FriendBase
|
|
)
|
|
defer func() {
|
|
if code == pb.ErrorCode_Success {
|
|
rsp = &pb.FriendSearchRsp{
|
|
Friend: friend,
|
|
}
|
|
}
|
|
session.SendMsg(string(this.module.GetType()), Friend_SubType_Search, code, rsp)
|
|
}()
|
|
|
|
user :=this.module.model_friend.Frined_FindCond(req.NickName)
|
|
if user != nil {
|
|
friend = &pb.FriendBase{
|
|
UserId: user.Uid,
|
|
NickName: user.Name,
|
|
}
|
|
}
|
|
return nil
|
|
}
|