Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
bfbb7b69a0
@ -10,6 +10,8 @@ import (
|
|||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelRank struct {
|
type ModelRank struct {
|
||||||
@ -21,6 +23,9 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
|
|||||||
this.TableName = comm.TableEnchantRank // 挑战记录
|
this.TableName = comm.TableEnchantRank // 挑战记录
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleEnchant = module.(*Enchant)
|
this.moduleEnchant = module.(*Enchant)
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
err error
|
err error
|
||||||
chanegCard []*pb.DBHero // 推送属性变化
|
chanegCard []*pb.DBHero // 推送属性变化
|
||||||
res []*cfg.Gameatn // 学习天赋需要消耗的道具
|
res []*cfg.Gameatn // 学习天赋需要消耗的道具
|
||||||
|
hero *pb.DBHero
|
||||||
)
|
)
|
||||||
|
|
||||||
chanegCard = make([]*pb.DBHero, 0)
|
chanegCard = make([]*pb.DBHero, 0)
|
||||||
@ -41,8 +42,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.module.Debugf("%v", talent)
|
this.module.Debugf("TalentLearn:%v", talent)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if req.Heroid == "" { // 英雄id不能为空
|
if req.Heroid == "" { // 英雄id不能为空
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
@ -66,6 +66,12 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
talent, err = this.module.modelTalent.CreateHeroTalent(session.GetUserId(), req.Heroid)
|
talent, err = this.module.modelTalent.CreateHeroTalent(session.GetUserId(), req.Heroid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.module.Errorf("create talent data failed:%v", err)
|
this.module.Errorf("create talent data failed:%v", err)
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,18 +85,25 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
user := this.module.ModuleUser.GetUser(session.GetUserId())
|
hero = this.module.QueryHeroByConfId(session.GetUserId(), talent.HeroId)
|
||||||
if user != nil {
|
if hero == nil {
|
||||||
// 校验玩家等级
|
errdata = &pb.ErrorData{
|
||||||
if talentConf.Condition > user.Lv { // 等级不满足
|
Code: pb.ErrorCode_HeroNoExist,
|
||||||
errdata = &pb.ErrorData{
|
Title: pb.ErrorCode_HeroNoExist.ToString(),
|
||||||
Code: pb.ErrorCode_UserLvNoEnough,
|
Message: err.Error(),
|
||||||
Title: pb.ErrorCode_UserLvNoEnough.ToString(),
|
|
||||||
Message: fmt.Sprintf("等级不满足要求:curLv = %d,lv = %d", user.Lv, talentConf.Condition),
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验玩家等级
|
||||||
|
if talentConf.Condition > hero.Lv { // 等级不满足
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_UserLvNoEnough,
|
||||||
|
Title: pb.ErrorCode_UserLvNoEnough.ToString(),
|
||||||
|
Message: fmt.Sprintf("英雄等级不满足要求:curLv = %d,lv = %d", hero.Lv, talentConf.Condition),
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 校验
|
// 校验
|
||||||
@ -160,13 +173,8 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 同步修改属性
|
// 同步修改属性
|
||||||
heroList := this.module.GetHeroList(session.GetUserId())
|
this.module.modelHero.setTalentProperty(hero, talentConf)
|
||||||
for _, v := range heroList {
|
chanegCard = append(chanegCard, hero) // 添加推送属性变化信息
|
||||||
if v.HeroID == talent.HeroId { // 找到对应的英雄ID
|
|
||||||
this.module.modelHero.setTalentProperty(v, talentConf)
|
|
||||||
chanegCard = append(chanegCard, v) // 添加推送属性变化信息
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
|
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
|
||||||
session.SendMsg(string(this.module.GetType()), HeroTalentLearnResp, &pb.HeroTalentLearnResp{
|
session.SendMsg(string(this.module.GetType()), HeroTalentLearnResp, &pb.HeroTalentLearnResp{
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 记录一些扩展数据 图鉴 改名次数等
|
// 记录一些扩展数据 图鉴 改名次数等
|
||||||
@ -19,6 +20,9 @@ type ModelRecord struct {
|
|||||||
func (this *ModelRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
func (this *ModelRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||||
this.TableName = comm.TableUserRecord
|
this.TableName = comm.TableUserRecord
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 英雄天赋组件
|
// 英雄天赋组件
|
||||||
@ -21,6 +23,9 @@ func (this *ModelTalent) Init(service core.IService, module core.IModule, comp c
|
|||||||
this.TableName = comm.TableTalent
|
this.TableName = comm.TableTalent
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.module = module.(*Hero)
|
this.module = module.(*Hero)
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"go_dreamfactory/sys/db"
|
"go_dreamfactory/sys/db"
|
||||||
|
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ModelRank struct {
|
type ModelRank struct {
|
||||||
@ -21,6 +23,9 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
|
|||||||
this.TableName = comm.TableHuntingRecord // 挑战记录
|
this.TableName = comm.TableHuntingRecord // 挑战记录
|
||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.moduleHunting = module.(*Hunting)
|
this.moduleHunting = module.(*Hunting)
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
"go.mongodb.org/mongo-driver/mongo"
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
)
|
)
|
||||||
|
|
||||||
type modelFetterstory struct {
|
type modelFetterstory struct {
|
||||||
@ -22,6 +23,9 @@ func (this *modelFetterstory) Init(service core.IService, module core.IModule, c
|
|||||||
err = this.MCompModel.Init(service, module, comp, options)
|
err = this.MCompModel.Init(service, module, comp, options)
|
||||||
this.module = module.(*Library)
|
this.module = module.(*Library)
|
||||||
this.service = service
|
this.service = service
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,3 +159,13 @@ func (this *modelAtlas) checkReddot17102(uid string) bool {
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
func (this *modelAtlas) checkReddot17106(uid string) bool {
|
||||||
|
list, _ := this.module.modelAtlas.getSmithyAtlasList(uid)
|
||||||
|
for _, v := range list.Collect {
|
||||||
|
if v.Activate == false {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
@ -130,6 +130,9 @@ func (this *Smithy) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (r
|
|||||||
case comm.Reddot17107: // 铁匠铺手册台收藏家奖励按钮上
|
case comm.Reddot17107: // 铁匠铺手册台收藏家奖励按钮上
|
||||||
reddot[comm.Reddot17107] = this.modelTask.checkReddot17107(session.GetUserId())
|
reddot[comm.Reddot17107] = this.modelTask.checkReddot17107(session.GetUserId())
|
||||||
break
|
break
|
||||||
|
case comm.Reddot17106: //
|
||||||
|
reddot[comm.Reddot17106] = this.modelAtlas.checkReddot17106(session.GetUserId())
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user