From 8bef7ca2dd8fefbc65f4fa1d6147cf0320f04d37 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 31 Jan 2023 10:44:48 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=97=E6=BC=8F=E7=9A=84=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/mline/model_mainline.go | 7 +++++++ modules/troll/model_record.go | 6 ++++++ modules/viking/model_rank.go | 6 ++++++ 3 files changed, 19 insertions(+) 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) {