还原秘境门票代码
This commit is contained in:
parent
2e93abd69d
commit
d4b2c7a678
@ -7,6 +7,8 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"math"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
@ -71,28 +73,28 @@ func (this *modelUserMF) updateUserInfo(info *pb.DBUserMFantasy) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *modelUserMF) recoverTicket(session comm.IUserSession, info *pb.DBUserMFantasy) {
|
func (this *modelUserMF) recoverTicket(session comm.IUserSession, info *pb.DBUserMFantasy) {
|
||||||
// var (
|
var (
|
||||||
// duration time.Duration
|
duration time.Duration
|
||||||
// ticket int32
|
ticket int32
|
||||||
// ticketNum int32
|
ticketNum int32
|
||||||
// )
|
)
|
||||||
if time.Unix(info.LastTrigger, 0).Day() < configure.Now().Day() {
|
if time.Unix(info.LastTrigger, 0).Day() < configure.Now().Day() {
|
||||||
info.TriggerNum = 0
|
info.TriggerNum = 0
|
||||||
info.LastTrigger = configure.Now().Unix()
|
info.LastTrigger = configure.Now().Unix()
|
||||||
// info.BuyNum = 0
|
info.BuyNum = 0
|
||||||
|
}
|
||||||
|
// this.module.ModuleItems.RecoverTicket(session)
|
||||||
|
global := this.module.configure.GetGlobalConf()
|
||||||
|
ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.MoonFantasyTicket))
|
||||||
|
if ticket < global.DreamlandFightnum && info.Lastrtickettime > 0 {
|
||||||
|
duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))
|
||||||
|
ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime)))
|
||||||
|
if ticketNum > 0 {
|
||||||
|
if ticketNum+ticket > global.ArenaTicketMax {
|
||||||
|
ticketNum = global.ArenaTicketMax - ticket
|
||||||
|
}
|
||||||
|
this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{A: comm.ItemType, T: comm.MoonFantasyTicket, N: ticketNum}}, true)
|
||||||
|
info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.module.ModuleItems.RecoverTicket(session)
|
|
||||||
// global := this.module.configure.GetGlobalConf()
|
|
||||||
// ticket = int32(this.module.ModuleItems.QueryItemAmount(info.Uid, comm.MoonFantasyTicket))
|
|
||||||
// if ticket < global.DreamlandFightnum && info.Lastrtickettime > 0 {
|
|
||||||
// duration = configure.Now().Sub(time.Unix(info.Lastrtickettime, 0))
|
|
||||||
// ticketNum = int32(math.Floor(duration.Minutes() / float64(global.ArenaTicketRecoveryTime)))
|
|
||||||
// if ticketNum > 0 {
|
|
||||||
// if ticketNum+ticket > global.ArenaTicketMax {
|
|
||||||
// ticketNum = global.ArenaTicketMax - ticket
|
|
||||||
// }
|
|
||||||
// this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{A: comm.ItemType, T: comm.MoonFantasyTicket, N: ticketNum}}, true)
|
|
||||||
// info.Lastrtickettime = time.Unix(info.Lastrtickettime, 0).Add(time.Duration(ticketNum) * time.Minute).Unix()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user