From b22202ac21560d3cdc8e6beec3a633ce7448ea42 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 11 Jan 2024 13:55:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=94=E7=AD=94=E5=99=A8?= =?UTF-8?q?=E7=A7=BB=E4=BD=8D=E6=93=8D=E4=BD=9C=EF=BC=9A=E5=BF=85=E9=A1=BB?= =?UTF-8?q?=E5=9C=A8link=E8=BE=B9=E7=95=8C=E6=88=96=E7=9B=B8=E9=82=BB?= =?UTF-8?q?=E5=BA=94=E7=AD=94=E5=99=A8=E4=B9=8B=E9=97=B4=EF=BC=8C=E8=B6=8A?= =?UTF-8?q?=E8=BF=87=E6=88=96=E9=87=8D=E5=8F=A0=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wayside/memory/wayside_memory_transponder.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ts/simulation/wayside/memory/wayside_memory_transponder.go b/ts/simulation/wayside/memory/wayside_memory_transponder.go index a09a437..e3b507c 100644 --- a/ts/simulation/wayside/memory/wayside_memory_transponder.go +++ b/ts/simulation/wayside/memory/wayside_memory_transponder.go @@ -17,7 +17,7 @@ import ( ) // BalisePositionModify 应答器移位 -func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) error { +func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDto) *sys_error.BusinessError { uid := QueryMapUidMapByType(req.MapId, &data_proto.Transponder{})[req.BaliseId].Uid transponder := simulation.Repo.FindTransponder(uid) if transponder == nil { @@ -88,10 +88,8 @@ func BalisePositionModify(simulation *VerifySimulation, req *dto.BaliseMoveReqDt } //更新应答器公里标和Link位置 entry, _ := entity.GetEntityByUid(simulation.World, uid) - if km.Value < minKm.Value { - km.Value = minKm.Value - } else if km.Value > maxKm.Value { - km.Value = maxKm.Value + if km.Value <= minKm.Value || km.Value >= maxKm.Value { + return sys_error.New(fmt.Sprintf("超出可设置范围(%d:%d)", minKm.Value, maxKm.Value)) } component.KmType.Set(entry, km) offset := number.Abs(km.Value - akm.Value)