LingxinMeng 6 maanden geleden
bovenliggende
commit
79b542a125

+ 8 - 0
resource/vtd_pod_template-pjibot.yaml

@@ -74,8 +74,16 @@ spec:
           value: start-position-x
         - name: START_POSITION_Y
           value: start-position-y
+        - name: START_POSITION_Z
+          value: start-position-z
+        - name: START_POSITION_H
+          value: start-position-h
         - name: END_POSITION_X
           value: end-position-x
         - name: END_POSITION_Y
           value: end-position-y
+        - name: END_POSITION_Z
+          value: end-position-z
+        - name: END_POSITION_H
+          value: end-position-h
   restartPolicy: Never

+ 8 - 0
resource/vtd_pod_template-pjisuv.yaml

@@ -74,8 +74,16 @@ spec:
           value: start-position-x
         - name: START_POSITION_Y
           value: start-position-y
+        - name: START_POSITION_Z
+          value: start-position-z
+        - name: START_POSITION_H
+          value: start-position-h
         - name: END_POSITION_X
           value: end-position-x
         - name: END_POSITION_Y
           value: end-position-y
+        - name: END_POSITION_Z
+          value: end-position-z
+        - name: END_POSITION_H
+          value: end-position-h
   restartPolicy: Never

+ 10 - 6
src/package/application/run_task.go

@@ -196,7 +196,7 @@ func RunWaitingCluster() {
 			infra.GlobalLogger.Errorf("下载xosc文件【%v】失败,错误信息为:%v", xoscOssPath, err)
 			continue
 		}
-		s1, s2, s3, s4, xodrPath, osgbPath := util.ParseXosc(xoscLocalPath)
+		startPositionX, startPositionY, startPositionZ, startPositionH, endPositionX, endPositionY, endPositionZ, endPositionH, xodrPath, osgbPath := util.ParseXosc(xoscLocalPath)
 		firstTaskCache.Task.Scenario.ScenarioOdr = xodrPath
 		firstTaskCache.Task.Scenario.ScenarioOsgb = osgbPath
 		// ------- 修改OGT传感器显示目标物框 -------
@@ -303,10 +303,14 @@ func RunWaitingCluster() {
 		podString = strings.Replace(podString, "kafka-offset", "\""+util.ToString(offset)+"\"", -1)
 		podString = strings.Replace(podString, "cpu-order", "\""+util.ToString(restParallelism-1)+"\"", -1) // cpu编号是剩余并行度-1
 		podString = strings.Replace(podString, "algorithm-container", algorithmContainer, -1)
-		podString = strings.Replace(podString, "start-position-x", "\""+s1+"\"", -1)
-		podString = strings.Replace(podString, "start-position-y", "\""+s2+"\"", -1)
-		podString = strings.Replace(podString, "end-position-x", "\""+s3+"\"", -1)
-		podString = strings.Replace(podString, "end-position-y", "\""+s4+"\"", -1)
+		podString = strings.Replace(podString, "start-position-x", "\""+startPositionX+"\"", -1)
+		podString = strings.Replace(podString, "start-position-y", "\""+startPositionY+"\"", -1)
+		podString = strings.Replace(podString, "start-position-z", "\""+startPositionZ+"\"", -1)
+		podString = strings.Replace(podString, "start-position-h", "\""+startPositionH+"\"", -1)
+		podString = strings.Replace(podString, "end-position-x", "\""+endPositionX+"\"", -1)
+		podString = strings.Replace(podString, "end-position-y", "\""+endPositionY+"\"", -1)
+		podString = strings.Replace(podString, "end-position-Z", "\""+endPositionZ+"\"", -1)
+		podString = strings.Replace(podString, "end-position-H", "\""+endPositionH+"\"", -1)
 
 		// --------------- 保存成文件
 		err = util.WriteFile(podString, yamlPath)
@@ -319,7 +323,7 @@ func RunWaitingCluster() {
 		// --------------- 启动 pod
 		_, sr, err := util.Execute("kubectl", "apply", "-f", yamlPath)
 		if err != nil {
-			infra.GlobalLogger.Errorf("启动pod失败,执行结果为 %v,错误信息为 %v", s2, err)
+			infra.GlobalLogger.Errorf("启动pod失败,执行结果为 %v,错误信息为 %v", sr, err)
 			continue
 		}
 		infra.GlobalLogger.Errorf("启动pod成功,执行结果为 %v。", sr)

+ 1 - 1
src/package/infra/middleware/m_log_request.go

@@ -10,7 +10,7 @@ import (
 如果您希望获取请求的真实IP地址,而不是本地回环地址,可以考虑使用一些反向代理服务器或负载均衡器,它们通常会在请求头中添加一个字段来传递客户端的真实IP地址。在Gin中,您可以使用`c.Request.Header.Get("X-Real-IP")`或`c.Request.Header.Get("X-Forwarded-For")`来获取这些头部信息中的真实IP地址。请注意,使用这些方法时需要谨慎,确保信任传递的 IP 地址信息,以防止IP欺骗等安全问题。
 */
 
-// LogRequest 中间件函数,用于打印请求方的IP地址和请求路径
+// 中间件函数,用于打印请求方的IP地址和请求路径
 func LogRequest() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		//clientIP := c.ClientIP()          // 获取请求方的IP地址

+ 1 - 1
src/package/infra/middleware/m_whitelist.go

@@ -17,7 +17,7 @@ var (
 	}
 )
 
-// WhitelistMiddleware 白名单中间件
+// 白名单中间件
 func WhitelistMiddleware() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		// 检查IP地址

+ 18 - 2
src/package/util/u_xosc.go

@@ -30,11 +30,15 @@ var (
 )
 
 // - filepath  文件路径 "D:\\test.xosc"
-func ParseXosc(filepath string) (string, string, string, string, string, string) {
+func ParseXosc(filepath string) (string, string, string, string, string, string, string, string, string, string) {
 	startPositionX := ""
 	startPositionY := ""
+	startPositionZ := ""
+	startPositionH := ""
 	endPositionX := ""
 	endPositionY := ""
+	endPositionZ := ""
+	endPositionH := ""
 	xodrPath := ""
 	osgbPath := ""
 	doc := etree.NewDocument()
@@ -60,6 +64,12 @@ func ParseXosc(filepath string) (string, string, string, string, string, string)
 										if attr3.Key == "y" {
 											startPositionY = attr3.Value
 										}
+										if attr3.Key == "z" {
+											startPositionZ = attr3.Value
+										}
+										if attr3.Key == "h" {
+											startPositionH = attr3.Value
+										}
 									}
 								}
 								if i == len(vertexs)-1 {
@@ -71,6 +81,12 @@ func ParseXosc(filepath string) (string, string, string, string, string, string)
 										if attr3.Key == "y" {
 											endPositionY = attr3.Value
 										}
+										if attr3.Key == "z" {
+											endPositionZ = attr3.Value
+										}
+										if attr3.Key == "h" {
+											endPositionH = attr3.Value
+										}
 									}
 								}
 							}
@@ -96,7 +112,7 @@ func ParseXosc(filepath string) (string, string, string, string, string, string)
 		}
 	}
 
-	return startPositionX, startPositionY, endPositionX, endPositionY, xodrPath, osgbPath
+	return startPositionX, startPositionY, startPositionZ, startPositionH, endPositionX, endPositionY, endPositionZ, endPositionH, xodrPath, osgbPath
 }
 
 func getValueByKey(key string) string {