处理循环引用问题

This commit is contained in:
joylink_zhangsai 2024-01-09 14:51:57 +08:00
parent ffa2dfc6bf
commit 32b4b9ba02
5 changed files with 5 additions and 15 deletions

View File

@ -573,8 +573,9 @@ func transponderMove(c *gin.Context) {
if err := c.ShouldBind(&req); err != nil { if err := c.ShouldBind(&req); err != nil {
panic(sys_error.New("应答器移位操作失败,请求参数异常", err)) panic(sys_error.New("应答器移位操作失败,请求参数异常", err))
} }
simulation := checkDeviceDataAndReturn(req.SimulationId)
slog.Info("传入状态参数", req) slog.Info("传入状态参数", req)
err := memory.TransponderMove(req) err := memory.TransponderMove(simulation, req)
if err != nil { if err != nil {
panic(sys_error.New(fmt.Sprintf("应答器移位操作失败,%s", err.Error()), err)) panic(sys_error.New(fmt.Sprintf("应答器移位操作失败,%s", err.Error()), err))
} }

@ -1 +1 @@
Subproject commit 13ed3c733cea89b06b95d2cc6ac4912ade8cb75a Subproject commit 999608fa88a430cba9bef8915f76993a0e4c6d8e

@ -1 +1 @@
Subproject commit 3b685c99bee48ce05858384c9af357b98ba225d7 Subproject commit a4c17218f7e1901fa25c9c90905a1749f5c57068

View File

@ -4,14 +4,12 @@ import (
"fmt" "fmt"
"joylink.club/bj-rtsts-server/dto" "joylink.club/bj-rtsts-server/dto"
"joylink.club/bj-rtsts-server/sys_error" "joylink.club/bj-rtsts-server/sys_error"
"joylink.club/bj-rtsts-server/ts"
"joylink.club/rtsssimulation/component" "joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/component/component_proto" "joylink.club/rtsssimulation/component/component_proto"
"joylink.club/rtsssimulation/entity" "joylink.club/rtsssimulation/entity"
) )
func TransponderMove(req *dto.TransponderMoveReqDto) error { func TransponderMove(simulation *VerifySimulation, req *dto.TransponderMoveReqDto) error {
simulation := ts.GetSimulation(req.SimulationId)
worldData := entity.GetWorldData(simulation.World) worldData := entity.GetWorldData(simulation.World)
link := worldData.Repo.FindLink(simulation.uidMap[req.LinkId].Uid) link := worldData.Repo.FindLink(simulation.uidMap[req.LinkId].Uid)
if link == nil { if link == nil {

View File

@ -181,12 +181,3 @@ func FindSimulation(simulationId string) *memory.VerifySimulation {
} }
return nil return nil
} }
// GetSimulation 获取仿真
func GetSimulation(simulationId string) *memory.VerifySimulation {
simulation := FindSimulation(simulationId)
if simulation == nil {
panic(sys_error.New(fmt.Sprintf("仿真[%s]不存在", simulationId)))
}
return simulation
}