diff --git a/modules/caravan/api_getstory.go b/modules/caravan/api_getstory.go index d7c200bdc..211e3e4c1 100644 --- a/modules/caravan/api_getstory.go +++ b/modules/caravan/api_getstory.go @@ -70,7 +70,14 @@ func (this *apiComp) GetStory(session comm.IUserSession, req *pb.CaravanGetStory update["tasktime"] = list.Tasktime } - this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update) + if err = this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), update); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } resp.Data = list session.SendMsg(string(this.module.GetType()), "getstory", resp) return diff --git a/modules/caravan/api_ranklist.go b/modules/caravan/api_ranklist.go index 49fd9b527..ce512770f 100644 --- a/modules/caravan/api_ranklist.go +++ b/modules/caravan/api_ranklist.go @@ -36,7 +36,7 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.CaravanRankList Name: userinfo.Name, Userlv: userinfo.Lv, Avatar: userinfo.Avatar, - Rank: rankid, // rankid为0 表示未上榜 + Rank: rankid, Merchantmoney: userinfo.Merchantmoney, CaravanLv: userinfo.Caravanlv, Title: userinfo.Curtitle, diff --git a/modules/caravan/comp_configure.go b/modules/caravan/comp_configure.go index 60276daf2..508fe66d9 100644 --- a/modules/caravan/comp_configure.go +++ b/modules/caravan/comp_configure.go @@ -52,6 +52,21 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp return } +func (this *configureComp) GetCaravanGoods(itemId string) (data *cfg.GameCaravanThingData, err error) { + var ( + v interface{} + ) + if v, err = this.GetConfigure(game_caravan_thing); err == nil { + if configure, ok := v.(*cfg.GameCaravanThing); ok { + if data = configure.Get(itemId); data != nil { + return + } + } + } + err = comm.NewNotFoundConfErr(moduleName, game_caravan_thing, itemId) + this.module.Errorln(err) + return +} // 加载多个配置文件 func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) { @@ -77,11 +92,9 @@ func (this *configureComp) GetCaravanCity(cityId int32) (data *cfg.GameCaravanCi ) if v, err = this.GetConfigure(game_caravan); err == nil { if configure, ok := v.(*cfg.GameCaravanCity); ok { - if data = configure.Get(cityId); data == nil { - err = comm.NewNotFoundConfErr(moduleName, game_caravan, cityId) - this.module.Errorln(err) + if data = configure.Get(cityId); data != nil { + return } - return } } err = comm.NewNotFoundConfErr(moduleName, game_caravan, cityId) @@ -95,34 +108,15 @@ func (this *configureComp) GetCaravanLv(lv int32) (data *cfg.GameCaravanLvData, ) if v, err = this.GetConfigure(game_caravan_lv); err == nil { if configure, ok := v.(*cfg.GameCaravanLv); ok { - if data = configure.Get(lv); data == nil { - err = comm.NewNotFoundConfErr(moduleName, game_caravan_lv, lv) - this.module.Errorln(err) + if data = configure.Get(lv); data != nil { + return } - return } } err = comm.NewNotFoundConfErr(moduleName, game_caravan_lv, lv) return } -func (this *configureComp) GetCaravanGoods(itemId string) (data *cfg.GameCaravanThingData, err error) { - var ( - v interface{} - ) - if v, err = this.GetConfigure(game_caravan_thing); err == nil { - if configure, ok := v.(*cfg.GameCaravanThing); ok { - if data = configure.Get(itemId); data == nil { - err = comm.NewNotFoundConfErr(moduleName, game_caravan_thing, itemId) - this.module.Errorln(err) - } - return - } - } - err = comm.NewNotFoundConfErr(moduleName, game_caravan_thing, itemId) - return -} - func (this *configureComp) GetAllCaravanCity() (data []*cfg.GameCaravanCityData) { if v, err := this.GetConfigure(game_caravan); err == nil { @@ -137,6 +131,7 @@ func (this *configureComp) GetAllCaravanCity() (data []*cfg.GameCaravanCityData) } return } + func (this *configureComp) GetAllCaravanItem() (data []*cfg.GameCaravanThingData) { if v, err := this.GetConfigure(game_caravan_thing); err == nil { diff --git a/modules/caravan/model_caravan.go b/modules/caravan/model_caravan.go index 66f67db73..3c899d979 100644 --- a/modules/caravan/model_caravan.go +++ b/modules/caravan/model_caravan.go @@ -48,7 +48,6 @@ func (this *modelCaravan) getCaravanList(uid string) (result *pb.DBCaravan, err if err = this.Get(uid, result); err != nil && mgo.MongodbNil == err { // 创建一条数据 result.Id = primitive.NewObjectID().Hex() - //result.Resettime = utils.WeekIntervalTime() result.Citystime = configure.Now().Unix() result.Rtime = configure.Now().Unix() result.Lv = 1 @@ -58,8 +57,7 @@ func (this *modelCaravan) getCaravanList(uid string) (result *pb.DBCaravan, err } this.module.InitCaravanCityData(uid, result) // 初始1级 this.module.InitCaravanItemData(uid, result) - this.Add(uid, result) - err = nil + err = this.Add(uid, result) return } diff --git a/modules/caravan/model_rank.go b/modules/caravan/model_rank.go index f5c15e8df..9427acb01 100644 --- a/modules/caravan/model_rank.go +++ b/modules/caravan/model_rank.go @@ -2,6 +2,7 @@ package caravan import ( "context" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" @@ -33,17 +34,20 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor } func (this *ModelRank) SetUsrRankList(uid string) (result *pb.DBCaravanRank, err error) { + var ( + user *pb.DBUser + model *db.DBModel + ) conn_, err := db.Cross() // 获取跨服数据库对象 if err != nil { return } - user, err1 := this.module.ModuleUser.GetUser(uid) - if err1 != nil { - err = err1 + user, err = this.module.ModuleUser.GetUser(uid) + if err != nil { return } - model := db.NewDBModelByExpired(comm.TableCaravanRank, conn_) - if model == nil { + if model = db.NewDBModelByExpired(comm.TableCaravanRank, conn_); model == nil { + err = fmt.Errorf("cand found table :%s,%v", comm.TableCaravanRank, conn_) return } result = &pb.DBCaravanRank{} diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index 3c82ec959..d2970f314 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -60,7 +60,6 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp err = this.LoadConfigure(game_smithytask, cfg.NewGameSmithyTask) err = this.LoadConfigure(game_smithymake, cfg.NewGameSmithyMake) - this.GmGetAllAtlasConf() return } diff --git a/modules/stonehenge/api_bookaward.go b/modules/stonehenge/api_bookaward.go index 792ded3d0..acef92853 100644 --- a/modules/stonehenge/api_bookaward.go +++ b/modules/stonehenge/api_bookaward.go @@ -21,6 +21,7 @@ func (this *apiComp) BookAward(session comm.IUserSession, req *pb.StonehengeBook award []*pb.UserAssets ok bool err error + atno []*pb.UserAtno ) if errdata = this.BookAwardCheck(session, req); errdata != nil { return @@ -38,6 +39,7 @@ func (this *apiComp) BookAward(session comm.IUserSession, req *pb.StonehengeBook for _, v := range confs { if v.Type == req.Btype && v.ColltectionNum == req.Stage { conf = v + break } } } @@ -70,11 +72,11 @@ func (this *apiComp) BookAward(session comm.IUserSession, req *pb.StonehengeBook } bookAward.Stage[conf.ColltectionNum] = true - if errdata = this.module.DispenseRes(session, conf.Reward, true); errdata != nil { + if errdata, atno = this.module.DispenseAtno(session, conf.Reward, true); errdata != nil { return } award = make([]*pb.UserAssets, 0) - for _, v := range conf.Reward { + for _, v := range atno { award = append(award, &pb.UserAssets{ A: v.A, T: v.T, @@ -94,7 +96,7 @@ func (this *apiComp) BookAward(session comm.IUserSession, req *pb.StonehengeBook session.SendMsg(string(this.module.GetType()), "bookaward", &pb.StonehengeBookAwardResp{Btype: req.Btype, Stage: req.Stage, Award: award}) go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "StonehengeBookAwardReq", award) + this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "StonehengeBookAwardReq", atno) }) return } diff --git a/modules/stonehenge/api_challenge.go b/modules/stonehenge/api_challenge.go index 5d8c31eb1..fcb33ffb4 100644 --- a/modules/stonehenge/api_challenge.go +++ b/modules/stonehenge/api_challenge.go @@ -123,12 +123,6 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.StonehengeBattleR BattleEvents: battleConf.BattleReadyID, } - // if _, ok := stone.Rooms.Passive[EventType30]; ok { - - // } - // if _, ok := stone.Rooms.Passive[EventType31]; ok { // 扣我方血量 - - // } errdata, record := this.module.battle.CreateStoneBattle(session, stoneBattle) if errdata != nil { return diff --git a/modules/stonehenge/api_story.go b/modules/stonehenge/api_story.go index 633c939de..03ae28ce6 100644 --- a/modules/stonehenge/api_story.go +++ b/modules/stonehenge/api_story.go @@ -193,7 +193,14 @@ func (this *apiComp) Story(session comm.IUserSession, req *pb.StonehengeStoryReq this.module.modelStonehenge.AddNewEvent([]int32{newEvent}, stone) } update["rooms"] = stone.Rooms - this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update) + if err = this.module.modelStonehenge.ChangeStonehengeData(session.GetUserId(), update); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.String(), + Message: err.Error(), + } + return + } session.SendMsg(string(this.module.GetType()), "story", &pb.StonehengeStoryResp{ Story: stone.Rooms.Story, NewEvent: newEvent, diff --git a/modules/stonehenge/configure.go b/modules/stonehenge/configure.go index e75960827..695fd0199 100644 --- a/modules/stonehenge/configure.go +++ b/modules/stonehenge/configure.go @@ -682,13 +682,13 @@ func (this *configureComp) getGameStoneTaskDatas() (confs []*cfg.GameStoneTaskDa // 获取特权信息 func (this *configureComp) getGameStonePrivilegeData(privilegeId int32) (conf *cfg.GameStonePrivilegeData, err error) { var ( - v interface{} - ok bool + v interface{} ) if v, err = this.GetConfigure(game_stoneprivilege); err == nil { - - if conf, ok = v.(*cfg.GameStonePrivilege).GetDataMap()[privilegeId]; ok { - return + if configure, ok := v.(*cfg.GameStonePrivilege); ok { + if conf = configure.Get(privilegeId); conf != nil { + return + } } } err = comm.NewNotFoundConfErr(string(this.module.GetType()), game_stonetask, privilegeId)