配置文件修改

This commit is contained in:
meixiongfeng 2022-08-16 13:37:56 +08:00
parent 3eb6773160
commit 3fdd7fe115
5 changed files with 313 additions and 306 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,14 +33,14 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
code = pb.ErrorCode_PagodaNotFound
return
}
if cfg.PreLevel != pagoda.PagodaId {
if cfg.LayerNum != pagoda.PagodaId {
code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配
return
}
//// todo 战斗相关
pagoda.PagodaId = cfg.LayerNum // 更新层数
pagoda.PagodaId = cfg.NextLevel // 更新层数
// 通关奖励
code = this.module.DispenseRes(session, cfg.Reward, true)
@ -48,7 +48,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PagodaChalleng
return
}
mapData := make(map[string]interface{}, 0)
mapData["pagodaId"] = cfg.LayerNum
mapData["pagodaId"] = cfg.NextLevel
code = this.module.ModifyPagodaData(session.GetUserId(), pagoda.Id, mapData)
session.SendMsg(string(this.module.GetType()), PagodaChallengeResp, &pb.PagodaChallengeResp{Data: pagoda})
return

View File

@ -30,6 +30,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
_mData := make(map[string]interface{}, 0)
result.Uid = session.GetUserId()
result.PagodaId = 1 // 初始数据1层
_mData[result.Id] = result
this.module.modelPagoda.addNewPagoda(session.GetUserId(), _mData)
session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: result})

View File

@ -6,6 +6,9 @@ import (
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type ModelPagoda struct {
@ -17,7 +20,10 @@ func (this *ModelPagoda) Init(service core.IService, module core.IModule, comp c
this.TableName = string(comm.TablePagoda)
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Pagoda)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}

View File

@ -14,7 +14,7 @@ type GamepagodaData struct {
Key int32
PagodaType int32
LevelType int32
PreLevel int32
NextLevel int32
LayerNum int32
MonsterLv []int32
MonsterHp []float32
@ -42,7 +42,7 @@ func (_v *GamepagodaData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["pagoda_type"].(float64); !_ok_ { err = errors.New("pagoda_type error"); return }; _v.PagodaType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Level_type"].(float64); !_ok_ { err = errors.New("Level_type error"); return }; _v.LevelType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["PreLevel"].(float64); !_ok_ { err = errors.New("PreLevel error"); return }; _v.PreLevel = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NextLevel"].(float64); !_ok_ { err = errors.New("NextLevel error"); return }; _v.NextLevel = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["layer_num"].(float64); !_ok_ { err = errors.New("layer_num error"); return }; _v.LayerNum = int32(_tempNum_) }
{
var _arr_ []interface{}