From cd0c174fff33e6f60de9f83c0e1b46374699eca3 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 15 Dec 2022 14:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B4=A2=E5=BC=95=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/modelarena.go | 2 +- modules/arena/modelrecord.go | 2 +- modules/battle/modelBattle.go | 8 +++----- modules/chat/modelChat.go | 2 +- modules/equipment/modelEquipment.go | 2 +- modules/forum/modelForum.go | 2 +- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index 7b393cad5..c85c657b4 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -34,7 +34,7 @@ func (this *modelArena) Init(service core.IService, module core.IModule, comp co this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Arena) //创建uid索引 - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bson.A{ bsonx.Doc{ {Key: "uid", Value: bsonx.Int32(1)}, diff --git a/modules/arena/modelrecord.go b/modules/arena/modelrecord.go index 7b02c814f..c71315bd0 100644 --- a/modules/arena/modelrecord.go +++ b/modules/arena/modelrecord.go @@ -21,7 +21,7 @@ func (this *modelRecord) Init(service core.IService, module core.IModule, comp c this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Arena) //创建uid索引 - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return diff --git a/modules/battle/modelBattle.go b/modules/battle/modelBattle.go index e0481bbb5..76174d1c9 100644 --- a/modules/battle/modelBattle.go +++ b/modules/battle/modelBattle.go @@ -12,8 +12,6 @@ import ( "time" "go.mongodb.org/mongo-driver/bson/primitive" - "go.mongodb.org/mongo-driver/mongo" - "go.mongodb.org/mongo-driver/x/bsonx" ) ///数据组件 @@ -28,9 +26,9 @@ func (this *modelBattleComp) Init(service core.IService, module core.IModule, co this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Battle) this.TableName = "battle" - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ - Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}}, - }) + // _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + // Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}}, + // }) return } diff --git a/modules/chat/modelChat.go b/modules/chat/modelChat.go index b28faef8a..c2a1a61df 100644 --- a/modules/chat/modelChat.go +++ b/modules/chat/modelChat.go @@ -32,7 +32,7 @@ func (this *modelChatComp) Init(service core.IService, module core.IModule, comp this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Chat) //创建uid索引 - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "ruid", Value: bsonx.Int32(1)}}, }) return diff --git a/modules/equipment/modelEquipment.go b/modules/equipment/modelEquipment.go index 68830a407..d4900e46c 100644 --- a/modules/equipment/modelEquipment.go +++ b/modules/equipment/modelEquipment.go @@ -27,7 +27,7 @@ func (this *modelEquipmentComp) Init(service core.IService, module core.IModule, this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Equipment) //创建uid索引 - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return diff --git a/modules/forum/modelForum.go b/modules/forum/modelForum.go index 3a34421db..e5191991a 100644 --- a/modules/forum/modelForum.go +++ b/modules/forum/modelForum.go @@ -28,7 +28,7 @@ func (this *modelForumComp) Init(service core.IService, module core.IModule, com this.module = module.(*Forum) //创建uid索引 - this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}}, }) return