This commit is contained in:
liwei1dao 2023-01-31 11:54:21 +08:00
commit e0d59fc0f8
3 changed files with 19 additions and 0 deletions

View File

@ -5,6 +5,9 @@ import (
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelMline struct { type ModelMline struct {
@ -16,6 +19,10 @@ func (this *ModelMline) Init(service core.IService, module core.IModule, comp co
this.TableName = comm.TableMline this.TableName = comm.TableMline
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Mline) this.module = module.(*Mline)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }

View File

@ -8,6 +8,8 @@ import (
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
"go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelRecord struct { type ModelRecord struct {
@ -19,6 +21,10 @@ func (this *ModelRecord) Init(service core.IService, module core.IModule, comp c
this.TableName = comm.TableTrollRecord this.TableName = comm.TableTrollRecord
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Troll) this.module = module.(*Troll)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }

View File

@ -10,6 +10,8 @@ import (
"go_dreamfactory/sys/db" "go_dreamfactory/sys/db"
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
) )
type ModelRank struct { type ModelRank struct {
@ -21,6 +23,10 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
this.TableName = comm.TableVikingRank this.TableName = comm.TableVikingRank
err = this.MCompModel.Init(service, module, comp, options) err = this.MCompModel.Init(service, module, comp, options)
this.moduleViking = module.(*Viking) this.moduleViking = module.(*Viking)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return return
} }
func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) { func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) {