上传战斗匹配日志

This commit is contained in:
liwei1dao 2024-01-26 19:38:42 +08:00
parent ccfb093832
commit 9a08ffad16
3 changed files with 50 additions and 50 deletions

View File

@ -14,12 +14,12 @@ func (this *apiComp) RankListCheck(session comm.IUserSession, req *pb.IntegralRa
// /排行榜获取 // /排行榜获取
func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) { func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankListReq) (errdata *pb.ErrorData) {
var ( var (
uids []string uids []string
ranks []*pb.DBIntegralBoss ranks []*pb.DBIntegralBoss
franks []*pb.DBIntegralBoss // franks []*pb.DBIntegralBoss
players []*pb.DBIntegralRank players []*pb.DBIntegralRank
friends []*pb.DBIntegralRank // friends []*pb.DBIntegralRank
err error err error
) )
if errdata = this.RankListCheck(session, req); errdata != nil { if errdata = this.RankListCheck(session, req); errdata != nil {
@ -53,29 +53,29 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.IntegralRankLis
Line: v.Line[req.Nandu], Line: v.Line[req.Nandu],
} }
} }
// 获取好友 // // 获取好友
fids := this.module.ModuleFriend.GetFriendList(session.GetUserId()) // fids := this.module.ModuleFriend.GetFriendList(session.GetUserId())
if franks, err = this.module.modelIntegral.queryPlayers(fids); err != nil { // if franks, err = this.module.modelIntegral.queryPlayers(fids); err != nil {
errdata = &pb.ErrorData{ // errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, // Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(), // Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(), // Message: err.Error(),
} // }
return // return
} // }
friends = make([]*pb.DBIntegralRank, len(franks)) // friends = make([]*pb.DBIntegralRank, len(franks))
for i, v := range franks { // for i, v := range franks {
friends[i] = &pb.DBIntegralRank{ // friends[i] = &pb.DBIntegralRank{
Id: v.Uid, // Id: v.Uid,
Uinfo: v.Uinfo, // Uinfo: v.Uinfo,
Nandu: v.Nandu, // Nandu: v.Nandu,
Score: v.Score[req.Nandu], // Score: v.Score[req.Nandu],
Line: v.Line[req.Nandu], // Line: v.Line[req.Nandu],
} // }
} // }
session.SendMsg(string(this.module.GetType()), "ranklist", &pb.IntegralRankListResp{ session.SendMsg(string(this.module.GetType()), "ranklist", &pb.IntegralRankListResp{
Ranks: players, Ranks: players,
Friends: friends, // Friends: friends,
}) })
return return
} }

View File

@ -59,12 +59,14 @@ func (this *MatchPool) OnInstallComp() {
//加入匹配池 //加入匹配池
func (this *MatchPool) JoinMatchPools(ctx context.Context, req *pb.JoinMatchPoolReq, resp *pb.JoinMatchPoolResp) (err error) { func (this *MatchPool) JoinMatchPools(ctx context.Context, req *pb.JoinMatchPoolReq, resp *pb.JoinMatchPoolResp) (err error) {
this.Debug("JoinMatchPools", log.Field{Key: "req", Value: req.String()})
this.pools.joinPools(req) this.pools.joinPools(req)
return return
} }
//取消匹配 //取消匹配
func (this *MatchPool) CancelMatch(ctx context.Context, req *pb.CancelMatchReq, resp *pb.CancelMatchResp) (err error) { func (this *MatchPool) CancelMatch(ctx context.Context, req *pb.CancelMatchReq, resp *pb.CancelMatchResp) (err error) {
this.Debug("CancelMatch", log.Field{Key: "req", Value: req.String()})
this.pools.cancelMatch(req) this.pools.cancelMatch(req)
return return
} }

View File

@ -66,30 +66,28 @@ func (this *modelPlunder) getPlunderData(session comm.IUserSession) (info *pb.DB
this.module.Errorln(err) this.module.Errorln(err)
return return
} }
if err == mgo.MongodbNil { user, err = this.module.GetUserForSession(session)
user, err = this.module.GetUserForSession(session) if err != nil {
if err != nil { this.module.Errorln(err)
this.module.Errorln(err) return
return
}
info = &pb.DBPlunder{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
Uinfo: comm.GetUserBaseInfo(user),
Ctime: configure.Now().Unix(),
Develop: make(map[int32]int32),
}
for i := 0; i < 3; i++ { // 队列固定三条
info.Line = append(info.Line, &pb.TransportLine{})
}
info.Line = append(info.Line, &pb.TransportLine{
Closetime: -1, // 需要手动解锁
})
// 刷新货物信息
info.Source, _ = this.refreshGoodsInfo()
err = this.Add(session.GetUserId(), info)
} }
info = &pb.DBPlunder{
Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(),
Uinfo: comm.GetUserBaseInfo(user),
Ctime: configure.Now().Unix(),
Develop: make(map[int32]int32),
}
for i := 0; i < 3; i++ { // 队列固定三条
info.Line = append(info.Line, &pb.TransportLine{})
}
info.Line = append(info.Line, &pb.TransportLine{
Closetime: -1, // 需要手动解锁
})
// 刷新货物信息
info.Source, _ = this.refreshGoodsInfo()
err = this.Add(session.GetUserId(), info)
return return
} }