29 lines
717 B
Go
29 lines
717 B
Go
package arena
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
|
|
"go.mongodb.org/mongo-driver/mongo"
|
|
"go.mongodb.org/mongo-driver/x/bsonx"
|
|
)
|
|
|
|
///竞技场 战斗记录
|
|
type modelRecord struct {
|
|
modules.MCompModel
|
|
module *Arena
|
|
}
|
|
|
|
//组件初始化接口
|
|
func (this *modelRecord) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
|
this.TableName = comm.TableArena
|
|
this.MCompModel.Init(service, module, comp, opt)
|
|
this.module = module.(*Arena)
|
|
//创建uid索引
|
|
_, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
|
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
|
})
|
|
return
|
|
}
|