This commit is contained in:
meixiongfeng 2024-01-04 16:47:15 +08:00
commit 5aab7a0c3c
4 changed files with 23 additions and 3 deletions

View File

@ -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)
}

View File

@ -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
}

View File

@ -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)
})

View File

@ -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)
})