update trade

This commit is contained in:
wh_zcy 2023-02-14 17:24:19 +08:00
parent 2d1838174e
commit 311f45c351
3 changed files with 30 additions and 0 deletions

View File

@ -141,6 +141,7 @@ const (
TableSeasonRecord = "seasonRecord" // 赛季塔记录
/// 美食馆
TableSmithy = "smithy"
TableSmithyTrade = "trade"
/// 赛季塔数据表
TableSeasonPagoda = "seasonpagoda"
//

View File

@ -0,0 +1,27 @@
package smithy
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 modelTrade struct {
modules.MCompModel
module *Smithy
}
func (this *modelTrade) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = string(comm.TableSmithyTrade)
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Smithy)
// uid 创建索引
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
//

View File

@ -15,6 +15,7 @@ import (
type Smithy struct {
modules.ModuleBase
modelSmithy *modelSmithy
modelTrade *modelTrade
api *apiComp
configure *configureComp
}
@ -38,6 +39,7 @@ func (this *Smithy) OnInstallComp() {
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelSmithy = this.RegisterComp(new(modelSmithy)).(*modelSmithy)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
this.modelTrade = this.RegisterComp(new(modelTrade)).(*modelTrade)
}
// 接口信息