43 lines
975 B
Go
43 lines
975 B
Go
package parkour
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
//参数校验
|
|
func (this *apiComp) ViewPlayerCheck(session comm.IUserSession, req *pb.ParkourViewPlayerReq) (code pb.ErrorCode) {
|
|
return
|
|
}
|
|
|
|
///游戏
|
|
func (this *apiComp) ViewPlayer(session comm.IUserSession, req *pb.ParkourViewPlayerReq) (code pb.ErrorCode, data *pb.ErrorData) {
|
|
var (
|
|
resp *pb.ParkourViewPlayerResp
|
|
)
|
|
if code = this.ViewPlayerCheck(session, req); code != pb.ErrorCode_Success {
|
|
return
|
|
}
|
|
|
|
for _, uid := range req.Uid {
|
|
if u := this.module.ModuleUser.GetUser(uid); u != nil {
|
|
{
|
|
bOnline := false
|
|
if _, ok := this.module.GetUserSession(uid); ok {
|
|
bOnline = true
|
|
}
|
|
resp.Player = append(resp.Player, &pb.ParkourData{
|
|
Uid: uid,
|
|
Name: u.Name,
|
|
Avatar: u.Avatar,
|
|
Lv: u.Lv,
|
|
IsOnline: bOnline, // 检查是否在线
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), "viewplayer", resp)
|
|
return
|
|
}
|