赛季塔需要手动激活
This commit is contained in:
parent
95cf865134
commit
802a322f2a
@ -7,7 +7,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@ -26,7 +25,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
var (
|
var (
|
||||||
mapData map[string]interface{}
|
mapData map[string]interface{}
|
||||||
pagoda *pb.DBPagoda
|
pagoda *pb.DBPagoda
|
||||||
seasonPagoda *pb.DBSeasonPagoda
|
|
||||||
costTime int32 // 本次战斗消耗的时间
|
costTime int32 // 本次战斗消耗的时间
|
||||||
)
|
)
|
||||||
mapData = make(map[string]interface{}, 0)
|
mapData = make(map[string]interface{}, 0)
|
||||||
@ -58,12 +56,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 塔数据校验
|
// 塔数据校验
|
||||||
seasonPagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
pagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
code = pb.ErrorCode_PagodaNotFound
|
code = pb.ErrorCode_PagodaNotFound
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if seasonPagoda.Type != req.PagodaType || conf.LayerNum-1 != seasonPagoda.PagodaId {
|
if pagoda.Type != req.PagodaType || conf.LayerNum-1 != pagoda.PagodaId {
|
||||||
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -119,32 +117,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
}
|
}
|
||||||
// 普通塔通关了
|
// 普通塔通关了
|
||||||
Nomalcfg := this.module.configure.GetPagodaConfigData(comm.PagodaType, pagoda.PagodaId+1)
|
Nomalcfg := this.module.configure.GetPagodaConfigData(comm.PagodaType, pagoda.PagodaId+1)
|
||||||
if Nomalcfg == nil { // 创建赛季塔数据
|
if Nomalcfg == nil {
|
||||||
// 修改expand 数据
|
// 修改expand 数据
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"completePagoda": true,
|
"completePagoda": true,
|
||||||
}
|
}
|
||||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update)
|
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update)
|
||||||
seasonPagoda := &pb.DBSeasonPagoda{}
|
|
||||||
seasonPagoda.Id = primitive.NewObjectID().Hex()
|
|
||||||
|
|
||||||
seasonPagoda.Uid = session.GetUserId()
|
|
||||||
seasonPagoda.PagodaId = 0 // 初始数据0层
|
|
||||||
|
|
||||||
if conn, err := db.Cross(); err == nil {
|
|
||||||
rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{})
|
|
||||||
server := &pb.DBServerData{}
|
|
||||||
rst.Decode(server)
|
|
||||||
seasonPagoda.Type = server.SeasonType // 动态获取塔数据
|
|
||||||
}
|
|
||||||
this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), seasonPagoda)
|
|
||||||
// 推送新的
|
|
||||||
pagoda.PagodaId = seasonPagoda.PagodaId
|
|
||||||
pagoda.Type = seasonPagoda.Type
|
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: pagoda})
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
seasonPagoda.PagodaId = conf.LayerNum
|
pagoda.PagodaId = conf.LayerNum
|
||||||
mapData["pagodaId"] = conf.LayerNum
|
mapData["pagodaId"] = conf.LayerNum
|
||||||
// 记录爬塔明细数据
|
// 记录爬塔明细数据
|
||||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||||
@ -164,8 +145,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
newData := &pb.DBPagodaRecord{
|
newData := &pb.DBPagodaRecord{
|
||||||
Id: primitive.NewObjectID().Hex(),
|
Id: primitive.NewObjectID().Hex(),
|
||||||
Uid: session.GetUserId(),
|
Uid: session.GetUserId(),
|
||||||
PagodaId: seasonPagoda.PagodaId,
|
PagodaId: pagoda.PagodaId,
|
||||||
Type: seasonPagoda.Type,
|
Type: pagoda.Type,
|
||||||
Nickname: userinfo.Name,
|
Nickname: userinfo.Name,
|
||||||
Icon: "", // icon 暂无
|
Icon: "", // icon 暂无
|
||||||
Lv: userinfo.Lv,
|
Lv: userinfo.Lv,
|
||||||
@ -175,24 +156,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
// 数据写到跨服中
|
// 数据写到跨服中
|
||||||
conn_, err := db.Cross()
|
conn_, err := db.Cross()
|
||||||
dbModel := db.NewDBModel(comm.TableSeasonRecord, time.Hour, conn_)
|
dbModel := db.NewDBModel(comm.TableSeasonRecord, time.Hour, conn_)
|
||||||
//if err = dbModel.GetList(uid, newData); err == nil {
|
|
||||||
dbModel.AddList(uid, newData.Id, newData)
|
dbModel.AddList(uid, newData.Id, newData)
|
||||||
this.module.SetPagodaRankList("pagodaList"+strconv.Itoa(int(newData.PagodaId)), newData.CostTime, newData.Id)
|
this.module.SetPagodaRankList("pagodaList"+strconv.Itoa(int(newData.PagodaId)), newData.CostTime, newData.Id)
|
||||||
//}
|
|
||||||
dbModelTable := db.NewDBModel(comm.TableSeasonPagoda, time.Hour, conn_)
|
dbModelTable := db.NewDBModel(comm.TableSeasonPagoda, time.Hour, conn_)
|
||||||
if err = dbModelTable.Get(session.GetUserId(), seasonPagoda); err == nil {
|
if err = dbModelTable.Get(session.GetUserId(), pagoda); err == nil {
|
||||||
dbModelTable.Change(session.GetUserId(), mapData) // 修改跨服数据
|
dbModelTable.Change(session.GetUserId(), mapData) // 修改跨服数据
|
||||||
this.module.SetPagodaRankList("pagodaSeasonRank", seasonPagoda.PagodaId<<8+costTime, session.GetUserId())
|
this.module.SetPagodaRankList("pagodaSeasonRank", pagoda.PagodaId<<8+costTime, session.GetUserId())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData)
|
||||||
pagoda = &pb.DBPagoda{
|
|
||||||
Id: seasonPagoda.Id,
|
|
||||||
Uid: seasonPagoda.Uid,
|
|
||||||
PagodaId: seasonPagoda.PagodaId,
|
|
||||||
Reward: seasonPagoda.Reward,
|
|
||||||
Type: seasonPagoda.Type,
|
|
||||||
}
|
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user