From 0bf03f4d441ad0e92376ecbe493e1f891597e684 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 15 Dec 2022 14:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=B4=A2=E5=BC=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/arena/modelarena.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/arena/modelarena.go b/modules/arena/modelarena.go index c85c657b4..11c304704 100644 --- a/modules/arena/modelarena.go +++ b/modules/arena/modelarena.go @@ -34,13 +34,15 @@ func (this *modelArena) Init(service core.IService, module core.IModule, comp co this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Arena) //创建uid索引 - _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ - Keys: bson.A{ - bsonx.Doc{ - {Key: "uid", Value: bsonx.Int32(1)}, - }, - bson.M{"loc": "2dsphere"}, + if _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{ + {Key: "uid", Value: bsonx.Int32(1)}, }, + }); err != nil { + return + } + _, err = this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bson.M{"loc": "2dsphere"}, }) return }