diff --git a/modules/mail/api.go b/modules/mail/api.go index fc54b31de..f2b8af4c4 100644 --- a/modules/mail/api.go +++ b/modules/mail/api.go @@ -5,6 +5,9 @@ import ( "go_dreamfactory/modules" "go_dreamfactory/lego/core" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" ) const ( @@ -26,6 +29,11 @@ func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core this.MComp_GateComp.Init(service, module, comp, options) this.service = service this.module = module.(*Mail) + + //创建uid索引 + this.module.db_comp.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) return }