上传竞技场错误修复

This commit is contained in:
liwei1dao 2023-09-08 20:40:54 +08:00
parent 40c7889b19
commit a71ac34402
3 changed files with 32 additions and 15 deletions

View File

@ -33,7 +33,7 @@ func (this *apiComp) Info(session comm.IUserSession, req *pb.ArenaInfoReq) (errd
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
Message: "no fund user!",
}
return
}

View File

@ -76,10 +76,12 @@ func (this *ModuleRobot_Horoscope) findcanupnode() (conf *cfg.GameHoroscopeData,
for _, v := range v.(*cfg.GameHoroscope).GetDataList() {
ok = true
for _, v := range v.Front {
if v != 0 {
if _, ok = this.Info.Nodes[v]; !ok {
break
}
}
}
if ok {
conf = v
return

View File

@ -142,6 +142,9 @@ func (this *Robot) SendMessage(mtype, stype string, msg proto.Message) (resp pro
SubType: stype,
Data: data,
}
if mtype != "gateway" {
this.curreq = fmt.Sprintf("%s.%s", mtype, stype)
if err = this.WriteMsg(message); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ClientError,
@ -150,17 +153,29 @@ func (this *Robot) SendMessage(mtype, stype string, msg proto.Message) (resp pro
}
return
}
if mtype != "gateway" {
this.curreq = fmt.Sprintf("%s.%s", mtype, stype)
messageresp = <-this.await //等待回应
resp = messageresp.resp
errdata = messageresp.errdata
if this.debug {
if errdata == nil {
log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata == nil})
} else {
log.Error("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata.String()})
}
}
this.statistics = append(this.statistics, &RobotStatistics{
message: fmt.Sprintf("%s.%s", mtype, stype),
time: time.Since(stime).Milliseconds(),
})
if this.debug {
log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "resp", Value: errdata == nil})
} else {
if err = this.WriteMsg(message); err != nil {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ClientError,
Title: pb.ErrorCode_ClientError.String(),
Message: err.Error(),
}
return
}
}
return
@ -255,7 +270,7 @@ func (this *Robot) run() {
log.Error("[机器人 初始执行错误]", log.Field{Key: "Account", Value: this.account}, log.Field{Key: "module", Value: v}, log.Field{Key: "err", Value: err.Error()})
break
}
time.Sleep(time.Millisecond * time.Duration(2000+rand.Int31n(3000)))
time.Sleep(time.Millisecond * time.Duration(2000+rand.Int31n(2000)))
}
for this.cycle {
@ -277,7 +292,7 @@ func (this *Robot) run() {
this.cycle = true
}
}
time.Sleep(time.Millisecond * time.Duration(2000+rand.Int31n(3000)))
time.Sleep(time.Millisecond * time.Duration(2000+rand.Int31n(2000)))
}
}
this.Close()