From 6665072e8dc70a7e285fbe8f65db196e60e99090 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 18 Nov 2022 10:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=9C=88=E5=AD=90=E7=A7=98?= =?UTF-8?q?=E5=A2=83=E6=8C=91=E6=88=98=E5=8D=B7=E5=9B=9E=E5=A4=8D=E6=9C=BA?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/moonfantasy/modelUserMF.go | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/moonfantasy/modelUserMF.go b/modules/moonfantasy/modelUserMF.go index 70d70dc14..994049b25 100644 --- a/modules/moonfantasy/modelUserMF.go +++ b/modules/moonfantasy/modelUserMF.go @@ -34,17 +34,25 @@ func (this *modelUserMF) Init(service core.IService, module core.IModule, comp c } ///查询用户秘境列表 -func (this *modelUserMF) queryUsermfantasy(uId string) (fantasy *pb.DBUserMFantasy, err error) { - fantasy = &pb.DBUserMFantasy{} - if err = this.Get(uId, fantasy); err != nil && err != mgo.MongodbNil { +func (this *modelUserMF) queryUsermfantasy(uId string) (info *pb.DBUserMFantasy, err error) { + info = &pb.DBUserMFantasy{} + if err = this.Get(uId, info); err != nil && err != mgo.MongodbNil { this.module.Errorf("err:%v", err) } if err == mgo.MongodbNil { - fantasy.Id = primitive.NewObjectID().Hex() - fantasy.Uid = uId - // fantasy.Mfantasys = make([]string, 0) - if err = this.Add(uId, fantasy); err != nil { + global := this.module.configure.GetGlobalConf() + info = &pb.DBUserMFantasy{ + Id: primitive.NewObjectID().Hex(), + Uid: uId, + TriggerNum: 0, + LastTrigger: 0, + BuyNum: global.DreamlandFightnum, + Ticket: global.DreamlandFightnum, + Lastrtickettime: configure.Now().Unix(), + } + if err = this.Add(uId, info); err != nil { this.module.Errorf("err:%v", err) + return } err = nil }