图鉴跨服接口
This commit is contained in:
parent
7b53f63d5d
commit
ab9542bdaf
@ -435,7 +435,7 @@ type (
|
||||
}
|
||||
|
||||
IPandaAtlas interface {
|
||||
CheckActivatePandaAtlasCollect(uid string, id string) (code pb.ErrorCode)
|
||||
CheckActivatePandaAtlasCollect(uid string, id string)
|
||||
}
|
||||
//练功房
|
||||
IPractice interface {
|
||||
|
@ -11,6 +11,9 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
type PandaAtlas struct {
|
||||
@ -42,11 +45,55 @@ func (this *PandaAtlas) OnInstallComp() {
|
||||
this.modelPandaAtlas = this.RegisterComp(new(modelPandaAtlas)).(*modelPandaAtlas)
|
||||
}
|
||||
|
||||
func (this *PandaAtlas) CheckActivatePandaAtlasCollect(uid string, id string) (code pb.ErrorCode) {
|
||||
func (this *PandaAtlas) CheckActivatePandaAtlasCollect(uid string, id string) {
|
||||
if this.IsCross() {
|
||||
atlas := &pb.DBPandaAtlas{}
|
||||
if model, err := this.GetDBModelByUid(uid, this.modelPandaAtlas.TableName, this.modelPandaAtlas.Expired); err == nil {
|
||||
|
||||
if err := model.Get(uid, atlas); err != nil { // 防止数据没有初始化情况
|
||||
if mongo.ErrNoDocuments == err {
|
||||
atlas.Id = primitive.NewObjectID().Hex()
|
||||
atlas.Uid = uid
|
||||
atlas.Collect = make(map[string]*pb.CollectInfo, 0)
|
||||
atlas.Award = 1 // 初始1级
|
||||
if conf := this.configure.GetPandoAtlasConf(id); conf != nil {
|
||||
atlas.Collect[id] = &pb.CollectInfo{
|
||||
Score: conf.AtlasScore,
|
||||
Time: configure.Now().Unix(),
|
||||
Activate: false,
|
||||
}
|
||||
update := make(map[string]interface{}, 0)
|
||||
update["collect"] = atlas.Collect
|
||||
if err := model.Add(uid, update); err != nil {
|
||||
this.Errorf("err:%v", err)
|
||||
}
|
||||
}
|
||||
return
|
||||
} else {
|
||||
this.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if _, ok := atlas.Collect[id]; !ok {
|
||||
if conf := this.configure.GetPandoAtlasConf(id); conf != nil {
|
||||
atlas.Collect[id] = &pb.CollectInfo{
|
||||
Score: conf.AtlasScore,
|
||||
Time: configure.Now().Unix(),
|
||||
Activate: false,
|
||||
}
|
||||
update := make(map[string]interface{}, 0)
|
||||
update["collect"] = atlas.Collect
|
||||
if err := model.Change(uid, update); err != nil {
|
||||
this.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list, _ := this.modelPandaAtlas.getPandaAtlasList(uid)
|
||||
if _, ok := list.Collect[id]; !ok {
|
||||
conf := this.configure.GetPandoAtlasConf(id)
|
||||
if conf != nil {
|
||||
if conf := this.configure.GetPandoAtlasConf(id); conf != nil {
|
||||
list.Collect[id] = &pb.CollectInfo{
|
||||
Score: conf.AtlasScore,
|
||||
Time: configure.Now().Unix(),
|
||||
@ -58,7 +105,7 @@ func (this *PandaAtlas) CheckActivatePandaAtlasCollect(uid string, id string) (c
|
||||
return
|
||||
}
|
||||
}
|
||||
code = pb.ErrorCode_SmithyNoFoundAtlas
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -45,7 +45,9 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
log.Errorf("get game_pagoda conf err:%v", err)
|
||||
return
|
||||
})
|
||||
this.SetGrormetCookBookConf()
|
||||
|
||||
configure.RegisterConfigure(game_food, cfg.NewGameBreakingbad, this.SetGrormetCookBookConf)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user