上传配置
This commit is contained in:
parent
04e3e99bde
commit
87f4c1c3a6
@ -347,6 +347,9 @@ const (
|
|||||||
TableStoryline = "storyline"
|
TableStoryline = "storyline"
|
||||||
|
|
||||||
TableGameMiner = "miner"
|
TableGameMiner = "miner"
|
||||||
|
|
||||||
|
// 迷宫图鉴
|
||||||
|
TableStonehengeBook = "stonehengebook"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RPC服务接口定义处
|
// RPC服务接口定义处
|
||||||
|
32
modules/stonehenge/api_bookaward.go
Normal file
32
modules/stonehenge/api_bookaward.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package stonehenge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *apiComp) BookAwardCheck(session comm.IUserSession, req *pb.StonehengeBookAwardReq) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) BookAward(session comm.IUserSession, req *pb.StonehengeBookAwardReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
info *pb.DBStonehengeBook
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if errdata = this.BookAwardCheck(session, req); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if info, err = this.module.modelStonehengeBook.getStonehengeBook(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.String(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
session.SendMsg(string(this.module.GetType()), "bookinfo", &pb.StonehengeBookInfoResp{Info: info})
|
||||||
|
return
|
||||||
|
}
|
32
modules/stonehenge/api_bookinfo.go
Normal file
32
modules/stonehenge/api_bookinfo.go
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package stonehenge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
)
|
||||||
|
|
||||||
|
//参数校验
|
||||||
|
func (this *apiComp) BookInfoCheck(session comm.IUserSession, req *pb.StonehengeBookInfoReq) (errdata *pb.ErrorData) {
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *apiComp) BookInfo(session comm.IUserSession, req *pb.StonehengeBookInfoReq) (errdata *pb.ErrorData) {
|
||||||
|
var (
|
||||||
|
info *pb.DBStonehengeBook
|
||||||
|
err error
|
||||||
|
)
|
||||||
|
if errdata = this.BookInfoCheck(session, req); errdata != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if info, err = this.module.modelStonehengeBook.getStonehengeBook(session.GetUserId()); err != nil {
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: pb.ErrorCode_DBError,
|
||||||
|
Title: pb.ErrorCode_DBError.String(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
session.SendMsg(string(this.module.GetType()), "bookinfo", &pb.StonehengeBookInfoResp{Info: info})
|
||||||
|
return
|
||||||
|
}
|
@ -22,6 +22,7 @@ const (
|
|||||||
game_bossconf = "game_stoneboss.json"
|
game_bossconf = "game_stoneboss.json"
|
||||||
game_battleconf = "game_stonebattle.json"
|
game_battleconf = "game_stonebattle.json"
|
||||||
game_stonetalent = "game_stonetalent.json"
|
game_stonetalent = "game_stonetalent.json"
|
||||||
|
game_stoneillustrated = "game_stoneillustrated.json"
|
||||||
)
|
)
|
||||||
|
|
||||||
///背包配置管理组件
|
///背包配置管理组件
|
||||||
|
50
modules/stonehenge/modelStonehengeBook.go
Normal file
50
modules/stonehenge/modelStonehengeBook.go
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
package stonehenge
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/mgo"
|
||||||
|
"go_dreamfactory/modules"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 图鉴
|
||||||
|
type ModelStonehengeBook struct {
|
||||||
|
modules.MCompModel
|
||||||
|
module *Stonehenge
|
||||||
|
}
|
||||||
|
|
||||||
|
//组件初始化接口
|
||||||
|
func (this *ModelStonehengeBook) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||||
|
this.TableName = comm.TableStonehengeBook
|
||||||
|
this.MCompModel.Init(service, module, comp, opt)
|
||||||
|
this.module = module.(*Stonehenge)
|
||||||
|
|
||||||
|
//创建uid索引
|
||||||
|
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||||
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取图鉴
|
||||||
|
func (this *ModelStonehengeBook) getStonehengeBook(uid string) (info *pb.DBStonehengeBook, err error) {
|
||||||
|
info = &pb.DBStonehengeBook{}
|
||||||
|
if err = this.Get(uid, info); err != nil && mgo.MongodbNil != err { // 创建一条初始的数据
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if mgo.MongodbNil == err {
|
||||||
|
info = &pb.DBStonehengeBook{
|
||||||
|
Id: primitive.NewObjectID().Hex(),
|
||||||
|
Uid: uid,
|
||||||
|
Books: make([]int32, 0),
|
||||||
|
Award: make(map[int32]*pb.DBStonehengeBookAward),
|
||||||
|
}
|
||||||
|
err = this.Add(uid, info)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
@ -23,6 +23,7 @@ type Stonehenge struct {
|
|||||||
api_comp *apiComp
|
api_comp *apiComp
|
||||||
configure *configureComp
|
configure *configureComp
|
||||||
modelStonehenge *MStonehenge
|
modelStonehenge *MStonehenge
|
||||||
|
modelStonehengeBook *ModelStonehengeBook
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
//模块名
|
||||||
@ -53,6 +54,7 @@ func (this *Stonehenge) OnInstallComp() {
|
|||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
this.modelStonehenge = this.RegisterComp(new(MStonehenge)).(*MStonehenge)
|
this.modelStonehenge = this.RegisterComp(new(MStonehenge)).(*MStonehenge)
|
||||||
|
this.modelStonehengeBook = this.RegisterComp(new(ModelStonehengeBook)).(*ModelStonehengeBook)
|
||||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user