爬塔数据查询接口。狩猎埋点
This commit is contained in:
parent
5614739601
commit
d1e35c0bd4
@ -437,10 +437,10 @@ const (
|
||||
//Rtype77 TaskType = 77 //通关难度A及以上维京远征指定BOSSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
||||
Rtype78 TaskType = 78 //通关难度A维京远征指定BOSS时间达到XX秒以内(检查最高记录是否超过了此难度,超过则完成)
|
||||
Rtype79 TaskType = 79 //使用好友助战英雄通关A难度的指定维京远征BOSS(从接到任务开始,通关阵营中包含好友助战英雄,难度大于等于A的指定维京远征BOSS时任务完成。)
|
||||
//Rtype80 TaskType = 80 //通关难度A指定狩猎BOOS难度N次(从接到任务开始,只有通关A难度进度才+1)
|
||||
//Rtype81 TaskType = 81 //通关A难度狩猎BOOS(检查最高难度记录是否达到了此难度,达到则完成)
|
||||
Rtype82 TaskType = 82 //通关狩猎指定BOOSN次(历史)(从创号开始记录登陆天数,通关任意难度进度都+1)
|
||||
Rtype83 TaskType = 83 //通关难度A及以上指定狩猎BOOSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
||||
Rtype80 TaskType = 80 //通关难度A指定狩猎BOOS难度N次(从接到任务开始,只有通关A难度进度才+1)
|
||||
Rtype81 TaskType = 81 //通关A难度狩猎BOOS(检查最高难度记录是否达到了此难度,达到则完成)
|
||||
Rtype82 TaskType = 82 //通关狩猎指定BOOSN次(历史)(从创号开始记录登陆天数,通关任意难度进度都+1)
|
||||
//Rtype83 TaskType = 83 //通关难度A及以上指定狩猎BOOSN次(从接到任务开始,若通关难度大于等于设定难度,则进度+1)
|
||||
Rtype84 TaskType = 84 //普通塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成)
|
||||
Rtype85 TaskType = 85 //赛季塔达到XX层(检查最高难度记录是否达到了此难度,达到则完成)
|
||||
Rtype86 TaskType = 86 //本赛季的赛季塔达到XX层(检查本赛季最高难度记录是否达到了此难度,达到则完成)
|
||||
|
@ -214,6 +214,7 @@ type (
|
||||
IPagoda interface {
|
||||
ModifyPagodaFloor(session IUserSession, level int32) (code pb.ErrorCode)
|
||||
CheckUserBasePagodaInfo(uid string) (data *pb.DBPagodaRecord) // 查询玩家最佳通关记录
|
||||
CheckPagodaMaxFloor(uid string, pagodaType int32) int32 // 查询塔通关难度type 1 表示普通塔 2 赛季塔
|
||||
///红点
|
||||
IReddot
|
||||
}
|
||||
|
@ -4,11 +4,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
"go_dreamfactory/sys/db"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
@ -27,7 +23,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
mapData map[string]interface{}
|
||||
newChallenge bool // 新的关卡
|
||||
reward []*cfg.Gameatn
|
||||
costTime int32
|
||||
bWin bool // 战斗是否胜利
|
||||
)
|
||||
mapData = make(map[string]interface{}, 0)
|
||||
reward = make([]*cfg.Gameatn, 0)
|
||||
@ -62,73 +58,14 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
newChallenge = true
|
||||
}
|
||||
// check
|
||||
code, _ = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
code, bWin = this.module.battle.CheckBattleReport(session, req.Report)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return
|
||||
}
|
||||
if req.Report != nil {
|
||||
costTime = req.Report.Costtime
|
||||
}
|
||||
key := strconv.Itoa(int(req.BossType)) + "_" + strconv.Itoa(int(req.Difficulty))
|
||||
|
||||
if hunting.BossTime[key] > costTime || hunting.BossTime[key] == 0 && req.Difficulty >= hunting.Boss[req.BossType] { // 刷新记录
|
||||
hunting.BossTime[key] = costTime
|
||||
szLine := make([]*pb.LineUp, 5)
|
||||
Leadpos := 0
|
||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
costTime = req.Report.Costtime
|
||||
Leadpos = int(req.Report.Info.Redflist[0].Leadpos)
|
||||
for i, v := range req.Report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
szLine[i] = &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 写入排行榜
|
||||
objID := ""
|
||||
bFind := false
|
||||
ranks := this.module.modulerank.getHuntingRankList(session.GetUserId())
|
||||
for _, v := range ranks {
|
||||
if v.Bosstype == req.BossType {
|
||||
mapRankData := make(map[string]interface{}, 0)
|
||||
mapRankData["difficulty"] = req.Difficulty
|
||||
mapRankData["bosstype"] = req.BossType
|
||||
mapRankData["Leadpos"] = Leadpos
|
||||
mapRankData["line"] = szLine
|
||||
mapRankData["costTime"] = costTime
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.ChangeList(session.GetUserId(), v.Id, mapRankData)
|
||||
objID = v.Id
|
||||
bFind = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !bFind {
|
||||
userinfo := this.module.ModuleUser.GetUser(session.GetUserId())
|
||||
new := &pb.DBHuntingRank{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: session.GetUserId(),
|
||||
Difficulty: req.Difficulty,
|
||||
Bosstype: req.BossType,
|
||||
Nickname: userinfo.Name,
|
||||
Icon: "",
|
||||
Lv: userinfo.Lv,
|
||||
Leadpos: int32(Leadpos),
|
||||
Line: szLine,
|
||||
CostTime: costTime,
|
||||
}
|
||||
objID = new.Id
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.AddList(session.GetUserId(), new.Id, new)
|
||||
}
|
||||
this.module.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(req.BossType)), req.Difficulty<<16+costTime, objID)
|
||||
if !bWin {
|
||||
return
|
||||
}
|
||||
this.module.CheckRank(session.GetUserId(), req.BossType, req.Difficulty, hunting, req.Report)
|
||||
|
||||
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
|
||||
hunting.LeftCount--
|
||||
@ -154,5 +91,10 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
|
||||
hunting.Boss[k] += 1
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), HuntingChallengeOverResp, &pb.HuntingChallengeOverResp{Data: hunting})
|
||||
|
||||
// 随机任务统计
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype81, req.Difficulty, req.BossType)
|
||||
this.module.ModuleRtask.SendToRtask(session, comm.Rtype82, req.BossType)
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -5,6 +5,11 @@ import (
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/db"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
type Hunting struct {
|
||||
@ -71,3 +76,66 @@ func (this *Hunting) CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingR
|
||||
}
|
||||
return
|
||||
}
|
||||
func (this *Hunting) CheckRank(uid string, boosID int32, difficulty int32, hunting *pb.DBHunting, report *pb.BattleReport) {
|
||||
costTime := report.Costtime
|
||||
key := strconv.Itoa(int(boosID)) + "_" + strconv.Itoa(int(difficulty))
|
||||
|
||||
if hunting.BossTime[key] > costTime || hunting.BossTime[key] == 0 && difficulty >= hunting.Boss[boosID] { // 刷新记录
|
||||
hunting.BossTime[key] = costTime
|
||||
szLine := make([]*pb.LineUp, 5)
|
||||
Leadpos := 0
|
||||
if report != nil && report.Info != nil && len(report.Info.Redflist) > 0 {
|
||||
costTime = report.Costtime
|
||||
Leadpos = int(report.Info.Redflist[0].Leadpos)
|
||||
for i, v := range report.Info.Redflist[0].Team {
|
||||
if v != nil {
|
||||
szLine[i] = &pb.LineUp{
|
||||
Cid: v.HeroID,
|
||||
Star: v.Star,
|
||||
Lv: v.Lv,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 写入排行榜
|
||||
objID := ""
|
||||
bFind := false
|
||||
ranks := this.modulerank.getHuntingRankList(uid)
|
||||
for _, v := range ranks {
|
||||
if v.Bosstype == boosID {
|
||||
mapRankData := make(map[string]interface{}, 0)
|
||||
mapRankData["difficulty"] = difficulty
|
||||
mapRankData["bosstype"] = boosID
|
||||
mapRankData["Leadpos"] = Leadpos
|
||||
mapRankData["line"] = szLine
|
||||
mapRankData["costTime"] = costTime
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.ChangeList(uid, v.Id, mapRankData)
|
||||
objID = v.Id
|
||||
bFind = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !bFind {
|
||||
userinfo := this.ModuleUser.GetUser(uid)
|
||||
new := &pb.DBHuntingRank{
|
||||
Id: primitive.NewObjectID().Hex(),
|
||||
Uid: uid,
|
||||
Difficulty: difficulty,
|
||||
Bosstype: boosID,
|
||||
Nickname: userinfo.Name,
|
||||
Icon: "",
|
||||
Lv: userinfo.Lv,
|
||||
Leadpos: int32(Leadpos),
|
||||
Line: szLine,
|
||||
CostTime: costTime,
|
||||
}
|
||||
objID = new.Id
|
||||
conn_, _ := db.Cross()
|
||||
dbModel := db.NewDBModel(comm.TableHuntingRank, time.Hour, conn_)
|
||||
dbModel.AddList(uid, new.Id, new)
|
||||
}
|
||||
this.modulerank.SetRankListData("huntingRank"+strconv.Itoa(int(boosID)), difficulty<<16+costTime, objID)
|
||||
}
|
||||
}
|
||||
|
@ -211,3 +211,17 @@ func (this *Pagoda) CheckPoint7(uid string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// 给随机任务提供的接口查询当前塔的通关层数
|
||||
func (this *Pagoda) CheckPagodaMaxFloor(uid string, pagodaType int32) int32 {
|
||||
if pagodaType == 1 {
|
||||
if list, err := this.modelPagoda.getPagodaList(uid); err != nil {
|
||||
return list.PagodaId
|
||||
}
|
||||
} else if pagodaType == 2 {
|
||||
if pagoda, err := this.modelPagoda.getPagodaList(uid); err != nil {
|
||||
return pagoda.PagodaId
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user