signal
This commit is contained in:
parent
169e79f481
commit
dfe084bbaa
|
@ -2,6 +2,7 @@ package memory
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"joylink.club/bj-rtsts-server/dto"
|
||||
"joylink.club/rtsssimulation/component"
|
||||
"joylink.club/rtsssimulation/entity"
|
||||
|
||||
|
@ -37,7 +38,7 @@ func ChangeSignalState(simulation *VerifySimulation, mapId int32, signalDeviceId
|
|||
case consts.SIGNAL_JCKXH:
|
||||
changeSignalJCKXHState(simulation.World, signalUid, toAspect)
|
||||
default:
|
||||
panic(fmt.Sprintf("操作[%s]的信号机,无法识别组合类型[%s]", signalUid, signalGroupCode))
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: fmt.Sprintf("操作[%s]的信号机,无法识别组合类型[%s]", signalUid, signalGroupCode)})
|
||||
}
|
||||
}
|
||||
func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -48,6 +49,8 @@ func changeSignalJCKXHState(w ecs.World, signalUid string, toAspect state.Signal
|
|||
fi.DriveSignalJCKXHDx(w, signalUid)
|
||||
case state.Signal_H:
|
||||
fi.DriveSignalJCKXHNon(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignalDCXHState(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -56,6 +59,8 @@ func changeSignalDCXHState(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
fi.DriveSignalDCXHDx(w, signalUid)
|
||||
case state.Signal_A:
|
||||
fi.DriveSignalDCXHNon(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignal3XH4State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -71,6 +76,8 @@ func changeSignal3XH4State(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
case state.Signal_H:
|
||||
fi.DriveSignal3XH4Dd(w, signalUid, true)
|
||||
fi.DriveSignal3XH4Non(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignal3XH3State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -86,6 +93,8 @@ func changeSignal3XH3State(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
case state.Signal_H:
|
||||
fi.DriveSignal3XH3Dd(w, signalUid, true)
|
||||
fi.DriveSignal3XH3Non(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignal3XH2State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -101,6 +110,8 @@ func changeSignal3XH2State(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
case state.Signal_H:
|
||||
fi.DriveSignal3XH2Dd(w, signalUid, true)
|
||||
fi.DriveSignal3XH2Non(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignal3XH1State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -119,6 +130,8 @@ func changeSignal3XH1State(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
case state.Signal_H:
|
||||
fi.DriveSignal3XH1Dd(w, signalUid, true)
|
||||
fi.DriveSignal3XH1Non(w, signalUid)
|
||||
default:
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
func changeSignal2XH1State(w ecs.World, signalUid string, toAspect state.Signal_Aspect) {
|
||||
|
@ -132,7 +145,7 @@ func changeSignal2XH1State(w ecs.World, signalUid string, toAspect state.Signal_
|
|||
fi.DriveSignal2XH1Dd(w, signalUid, true)
|
||||
fi.DriveSignal2XH1Non(w, signalUid)
|
||||
default:
|
||||
panic("不支持该操作")
|
||||
panic(dto.ErrorDto{Code: dto.OperationOfSignalNotSupported, Message: dto.ErrorTipMap[dto.OperationOfSignalNotSupported]})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
19
dto/error.go
19
dto/error.go
|
@ -17,15 +17,18 @@ const (
|
|||
NoAuthOperationError = 4001
|
||||
|
||||
QueryDBError = 5000
|
||||
|
||||
OperationOfSignalNotSupported = 6000
|
||||
)
|
||||
|
||||
var ErrorTipMap = map[int]string{
|
||||
1000: "系统内部出错",
|
||||
1001: "动力学接口出错",
|
||||
2000: "数据不存在",
|
||||
2001: "数据已经存在",
|
||||
2002: "数据操作错误",
|
||||
3000: "输入参数格式错误",
|
||||
4001: "无权限操作",
|
||||
5000: "数据库操作错误",
|
||||
LogicError: "系统内部出错",
|
||||
DynamicsError: "动力学接口出错",
|
||||
DataNotExist: "数据不存在",
|
||||
DataAlreadyExist: "数据已经存在",
|
||||
DataOperationError: "数据操作错误",
|
||||
ArgumentParseError: "输入参数格式错误",
|
||||
NoAuthOperationError: "无权限操作",
|
||||
QueryDBError: "数据库操作错误",
|
||||
OperationOfSignalNotSupported: "信号机不支持该操作",
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue