This commit is contained in:
meixiongfeng 2023-11-30 16:50:45 +08:00
commit 33728ccc1f
2 changed files with 18 additions and 3 deletions

View File

@ -28,6 +28,7 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.GameInviteAcceptR
blueRecord *pb.GameInviteQiecuoRecord
sessions []comm.IUserSession
gamedata *pb.GameInviteData
timeout int32 = 10
rules string
roomid string
ok bool
@ -66,10 +67,18 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.GameInviteAcceptR
}
return
}
switch req.Gtype {
case 0, 1, 2, 3, 4:
timeout = 10
case 5:
timeout = 60
}
rules = gamedata.Rules
for _, v := range gamedata.Targets {
if v.Uid == session.GetUserId() {
if configure.Now().Sub(time.Unix(v.Timestamp, 0)).Seconds() > 10 {
if configure.Now().Sub(time.Unix(v.Timestamp, 0)).Seconds() > float64(timeout) {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_PracticeInviteTimeOut,
Title: pb.ErrorCode_PracticeInviteTimeOut.ToString(),

View File

@ -27,6 +27,7 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.GameInviteQiecuoR
info *pb.GameInviteQiecuoRecord
gamedata *pb.GameInviteData
user *pb.DBUser
timeout int32
ok bool
keep bool
)
@ -77,11 +78,16 @@ func (this *apiComp) Qiecuo(session comm.IUserSession, req *pb.GameInviteQiecuoR
// keep = true
// }
// }
switch req.Gtype {
case 0, 1, 2, 3, 4:
timeout = 10
case 5:
timeout = 60
}
for _, v := range gamedata.Targets {
if v.Uid == req.Fid {
keep = true
if configure.Now().Sub(time.Unix(v.Timestamp, 0)).Seconds() > 10 {
if configure.Now().Sub(time.Unix(v.Timestamp, 0)).Seconds() > float64(timeout) {
v.Timestamp = configure.Now().Unix()
} else {
errdata = &pb.ErrorData{