go_dreamfactory/modules/island/modelhero.go
2023-11-01 20:34:14 +08:00

39 lines
973 B
Go

package island
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
type modelHeroComp struct {
modules.MCompModel
module *IsLand
}
func (this *modelHeroComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompModel.Init(service, module, comp, options)
this.TableName = comm.TableIsLandHero
this.module = module.(*IsLand)
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
// 读取数据
// 获取玩家的英雄列表
func (this *modelHeroComp) getHeroList(uid string) (heros []*pb.DBHero, err error) {
heros = make([]*pb.DBHero, 0)
err = this.GetList(uid, &heros)
return
}
func (this *modelHeroComp) addheros(heros *pb.DBHero) (err error) {
return
}