|
@@ -68,6 +68,10 @@ func Tick(c *gin.Context) {
|
|
c.JSON(http.StatusBadRequest, commonEntity.Response{Code: 500, Msg: "保存比赛开始时间报错。"})
|
|
c.JSON(http.StatusBadRequest, commonEntity.Response{Code: 500, Msg: "保存比赛开始时间报错。"})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
|
+ Code: 200,
|
|
|
|
+ Msg: "队伍 " + teamName + " 的考试开始。",
|
|
|
|
+ })
|
|
} else if !util.ContainsKey(cacheTeamName, teamName) && (math.Abs(positionX-InitialPositionX) > 5.00 || math.Abs(positionY-InitialPositionY) > 5.00) { // 不在起点(开始)
|
|
} else if !util.ContainsKey(cacheTeamName, teamName) && (math.Abs(positionX-InitialPositionX) > 5.00 || math.Abs(positionY-InitialPositionY) > 5.00) { // 不在起点(开始)
|
|
// 车辆不是在起点启动的自动驾驶模式
|
|
// 车辆不是在起点启动的自动驾驶模式
|
|
var result []webServerEntity.ExamPo
|
|
var result []webServerEntity.ExamPo
|
|
@@ -86,6 +90,7 @@ func Tick(c *gin.Context) {
|
|
// 添加队伍名到缓存中
|
|
// 添加队伍名到缓存中
|
|
cacheTeamName[teamName] = time.Now()
|
|
cacheTeamName[teamName] = time.Now()
|
|
} else {
|
|
} else {
|
|
|
|
+ c_log.GlobalLogger.Errorf("队伍 %v 的考试车辆未在起点开启自动驾驶模式,且今日无考试记录,错误启动自动驾驶模式。", param.TeamName)
|
|
c.JSON(http.StatusOK, commonEntity.Response{
|
|
c.JSON(http.StatusOK, commonEntity.Response{
|
|
Code: 400,
|
|
Code: 400,
|
|
Msg: "车辆未在起点开启自动驾驶模式,且今日无考试记录,错误启动自动驾驶模式。",
|
|
Msg: "车辆未在起点开启自动驾驶模式,且今日无考试记录,错误启动自动驾驶模式。",
|
|
@@ -103,17 +108,24 @@ func Tick(c *gin.Context) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
c_log.GlobalLogger.Infof("队伍 %v 的考试在中途中断后重新开始。", teamName)
|
|
c_log.GlobalLogger.Infof("队伍 %v 的考试在中途中断后重新开始。", teamName)
|
|
|
|
+ c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
|
+ Code: 200,
|
|
|
|
+ Msg: "队伍 " + teamName + " 的考试在中途中断后重新开始。",
|
|
|
|
+ })
|
|
} else if util.ContainsKey(cacheTeamName, teamName) { // 进行中
|
|
} else if util.ContainsKey(cacheTeamName, teamName) { // 进行中
|
|
cacheTeamName[teamName] = time.Now()
|
|
cacheTeamName[teamName] = time.Now()
|
|
c_log.GlobalLogger.Errorf("接收到心跳信息,队伍名字为 %s,x坐标为 %.f,y坐标为 %.f ", teamName, positionX, positionY)
|
|
c_log.GlobalLogger.Errorf("接收到心跳信息,队伍名字为 %s,x坐标为 %.f,y坐标为 %.f ", teamName, positionX, positionY)
|
|
|
|
+ c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
|
+ Code: 200,
|
|
|
|
+ Msg: "队伍 " + teamName + " 的考试进行中,心跳接收成功。",
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
c_log.GlobalLogger.Errorf("接收到心跳信息但考试并未开始,队伍名字为 %s,x坐标为 %.f,y坐标为 %.f ", teamName, positionX, positionY)
|
|
c_log.GlobalLogger.Errorf("接收到心跳信息但考试并未开始,队伍名字为 %s,x坐标为 %.f,y坐标为 %.f ", teamName, positionX, positionY)
|
|
|
|
+ c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
|
+ Code: 200,
|
|
|
|
+ Msg: "队伍 " + teamName + " 的考试未开始。",
|
|
|
|
+ })
|
|
}
|
|
}
|
|
-
|
|
|
|
- c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
|
- Code: 200,
|
|
|
|
- Msg: "心跳接收成功。",
|
|
|
|
- })
|
|
|
|
}
|
|
}
|
|
|
|
|
|
func ExamEndTicker() {
|
|
func ExamEndTicker() {
|