diff --git a/modules/mline/model_mainline.go b/modules/mline/model_mainline.go index a08eafe45..9563316ac 100644 --- a/modules/mline/model_mainline.go +++ b/modules/mline/model_mainline.go @@ -5,6 +5,9 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelMline struct { @@ -16,6 +19,10 @@ func (this *ModelMline) Init(service core.IService, module core.IModule, comp co this.TableName = comm.TableMline err = this.MCompModel.Init(service, module, comp, options) this.module = module.(*Mline) + //创建uid索引 + this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) return } diff --git a/modules/troll/model_record.go b/modules/troll/model_record.go index e1d7f01ba..350763867 100644 --- a/modules/troll/model_record.go +++ b/modules/troll/model_record.go @@ -8,6 +8,8 @@ import ( "go_dreamfactory/sys/configure" "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelRecord struct { @@ -19,6 +21,10 @@ func (this *ModelRecord) Init(service core.IService, module core.IModule, comp c this.TableName = comm.TableTrollRecord err = this.MCompModel.Init(service, module, comp, options) this.module = module.(*Troll) + //创建uid索引 + this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) return } diff --git a/modules/viking/model_rank.go b/modules/viking/model_rank.go index f1589e531..681e9014f 100644 --- a/modules/viking/model_rank.go +++ b/modules/viking/model_rank.go @@ -10,6 +10,8 @@ import ( "go_dreamfactory/sys/db" "github.com/go-redis/redis/v8" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelRank struct { @@ -21,6 +23,10 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor this.TableName = comm.TableVikingRank err = this.MCompModel.Init(service, module, comp, options) this.moduleViking = module.(*Viking) + //创建uid索引 + this.DB.CreateIndex(core.SqlTable(comm.TableMail), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) return } func (this *ModelRank) AddRankList(uId string, id string, data *pb.DBVikingRank) (err error) {