From d8c55662279b6dcc5b27486c62aba4d042bef30a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 4 Jan 2024 16:18:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/dcolor/model.go | 2 ++ modules/dcolor/room.go | 6 +++--- modules/pay/modelDaily.go | 9 +++++++++ modules/pay/modelDiamond.go | 9 +++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/modules/dcolor/model.go b/modules/dcolor/model.go index 6cb7d4bc0..9fb01a225 100644 --- a/modules/dcolor/model.go +++ b/modules/dcolor/model.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" @@ -40,6 +41,7 @@ func (this *modelComp) getModel(uid string) (info *pb.DBDColor, err error) { Integral: 0, Weekaward: make(map[int32]bool), Allaward: make(map[int32]bool), + Weektime: configure.Now().Unix(), } err = this.Add(uid, info) } diff --git a/modules/dcolor/room.go b/modules/dcolor/room.go index 874a41d2a..7079507b5 100644 --- a/modules/dcolor/room.go +++ b/modules/dcolor/room.go @@ -92,7 +92,7 @@ func (this *Room) PlayerHandle(uid string, handle *pb.DColorHandleReq) (err erro this.data.Blue.Score = this.data.Red.Score / 2 } else { this.data.Blue.Score = int32(math.Floor(float64(conf.Fraction) * float64(tconf.Pro) / float64(1000))) - this.data.Red.Score = this.data.Red.Score / 2 + this.data.Red.Score = this.data.Blue.Score / 2 } } else { this.currside = 0 @@ -161,11 +161,11 @@ func (this *Room) PlayerOffline(uid string) (err error) { } else { session = this.sessions[1] this.data.Blue.Score = int32(math.Floor(float64(conf.Fraction) * float64(tconf.Pro) / float64(1000))) - this.data.Red.Score = this.data.Red.Score / 2 + this.data.Red.Score = this.data.Blue.Score / 2 } this.data.Red.Integral += this.data.Red.Score - this.data.Red.Accruedintegral += this.data.Blue.Score + this.data.Red.Accruedintegral += this.data.Red.Score if this.data.Red.Score > this.data.Red.Maxintegral { this.data.Red.Maxintegral = this.data.Red.Score } diff --git a/modules/pay/modelDaily.go b/modules/pay/modelDaily.go index 806999164..aa9e6f22f 100644 --- a/modules/pay/modelDaily.go +++ b/modules/pay/modelDaily.go @@ -98,6 +98,15 @@ func (this *modelDailyComp) delivery(session comm.IUserSession, pid int32) (errd if errdata, items = this.module.DispenseAtno(session, conf.Item, true); errdata != nil { return } + if err = this.updateUserDaily(info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.WriteUserLog(session.GetUserId(), pid, comm.GMResAddType, "delivery", conf.Item) }) diff --git a/modules/pay/modelDiamond.go b/modules/pay/modelDiamond.go index 28d756709..855958c34 100644 --- a/modules/pay/modelDiamond.go +++ b/modules/pay/modelDiamond.go @@ -93,6 +93,15 @@ func (this *modelDiamondComp) delivery(session comm.IUserSession, id int32) (err if errdata, items = this.module.DispenseAtno(session, res, true); errdata != nil { return } + if err = this.updatemodel(info); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.WriteUserLog(session.GetUserId(), id, comm.GMResAddType, "deliverybyid", items) })