好友搜索
This commit is contained in:
parent
4bb8715e7f
commit
6c258e903b
@ -45,6 +45,8 @@ func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.FriendApplyLis
|
||||
list = append(list, &pb.FriendBase{
|
||||
UserId: userId,
|
||||
NickName: user.Name,
|
||||
Level: user.Lv,
|
||||
Avatar: user.Avatar,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,8 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.FriendListReq) (cod
|
||||
list = append(list, &pb.FriendBase{
|
||||
UserId: userId,
|
||||
NickName: user.Name,
|
||||
Level: user.Lv,
|
||||
Avatar: user.Avatar,
|
||||
})
|
||||
}
|
||||
|
||||
|
33
modules/friend/api_randlist.go
Normal file
33
modules/friend/api_randlist.go
Normal file
@ -0,0 +1,33 @@
|
||||
package friend
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
func (this *apiComp) RandlistCheck(session comm.IUserSession, req *pb.FriendOnlineReq) (code pb.ErrorCode) {
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Randlist(session comm.IUserSession, req *pb.FriendOnlineReq) (code pb.ErrorCode, data proto.Message) {
|
||||
var (
|
||||
self *pb.DBFriend
|
||||
)
|
||||
//在线玩家
|
||||
|
||||
self = this.moduleFriend.modelFriend.GetFriend(session.GetUserId())
|
||||
if self == nil {
|
||||
code = pb.ErrorCode_FriendSelfNoData
|
||||
return
|
||||
}
|
||||
|
||||
// 好友列表
|
||||
// self.FriendIds
|
||||
|
||||
// 已申请的好友
|
||||
// self.ApplyIds
|
||||
|
||||
return
|
||||
}
|
@ -80,7 +80,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
}
|
||||
|
||||
//缓存user session
|
||||
err = this.module.modelSession.Change(user.Uid, map[string]interface{}{
|
||||
err = this.module.modelSession.ChangeList("online", user.Uid, map[string]interface{}{
|
||||
"uid": user.Uid,
|
||||
"sessionId": session.GetSessionId(),
|
||||
"serviceTag": session.GetServiecTag(),
|
||||
|
@ -21,10 +21,17 @@ func (this *ModelSession) Init(service core.IService, module core.IModule, comp
|
||||
|
||||
//获取用户
|
||||
func (this *ModelSession) getUserSession(uid string) (cuser *pb.CacheUser) {
|
||||
cuser = &pb.CacheUser{}
|
||||
if err := this.Get(uid, cuser); err != nil {
|
||||
var sl []*pb.CacheUser
|
||||
|
||||
if err := this.GetList("online", sl); err != nil {
|
||||
this.module.Errorf("GetUserSession err:%v", err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, v := range sl {
|
||||
if v.Uid == uid {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -75,6 +75,10 @@ func (this *User) CleanSession(session comm.IUserSession) {
|
||||
this.modelSetting.Del(session.GetUserId(), db.SetDBMgoLog(false))
|
||||
}
|
||||
|
||||
// 在线玩家列表
|
||||
func (this *User) UserOnline() {
|
||||
}
|
||||
|
||||
//查询用户属性值 例如 金币 经验
|
||||
func (this *User) QueryAttributeValue(uid string, attr string) (value int32) {
|
||||
user := this.modelUser.GetUser(uid)
|
||||
|
Loading…
Reference in New Issue
Block a user