|
@@ -1,15 +1,61 @@
|
|
package handler
|
|
package handler
|
|
|
|
|
|
-import "github.com/gin-gonic/gin"
|
|
|
|
|
|
+import (
|
|
|
|
+ "cicv-data-closedloop/amd64/dispatch_server/package/infra"
|
|
|
|
+ "cicv-data-closedloop/amd64/dispatch_server/package/util"
|
|
|
|
+ "github.com/gin-gonic/gin"
|
|
|
|
+ "net/http"
|
|
|
|
+)
|
|
|
|
|
|
|
|
+// 返回 true
|
|
func Confirm(c *gin.Context) {
|
|
func Confirm(c *gin.Context) {
|
|
-
|
|
|
|
|
|
+ c.String(http.StatusOK, "true")
|
|
}
|
|
}
|
|
|
|
|
|
func Tick(c *gin.Context) {
|
|
func Tick(c *gin.Context) {
|
|
-
|
|
|
|
|
|
+ c.String(http.StatusOK, "true")
|
|
}
|
|
}
|
|
|
|
|
|
func State(c *gin.Context) {
|
|
func State(c *gin.Context) {
|
|
|
|
+ taskId := c.Query("taskId")
|
|
|
|
+ state := c.Query("state")
|
|
|
|
+ //podName := c.Query("podName") // todo 根据pod名称杀死pod并清理redis缓存
|
|
|
|
+
|
|
|
|
+ // 发送http请求到索为系统
|
|
|
|
+ /*
|
|
|
|
+ 仿真测试任务回调接口:
|
|
|
|
+ 1、接口url
|
|
|
|
+ http://1.202.169.139:8081/project/task/callback
|
|
|
|
+
|
|
|
|
+ 2、请求方式
|
|
|
|
+ POST
|
|
|
|
+
|
|
|
|
+ 3、请求体
|
|
|
|
+ {
|
|
|
|
+ "taskId":1764907332423110657,
|
|
|
|
+ "state":"RUNNING"
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 4、响应结果
|
|
|
|
|
|
|
|
+ {
|
|
|
|
+ "data":true/false,
|
|
|
|
+ "success": true,
|
|
|
|
+ "message": "ok",
|
|
|
|
+ "code": 1,
|
|
|
|
+ "nowTime": "2024-05-10 15:57:42"
|
|
|
|
+ }
|
|
|
|
+ */
|
|
|
|
+ _, err := util.PostJsonResponseJson(
|
|
|
|
+ "http://1.202.169.139:8081/project/task/callback",
|
|
|
|
+ map[string]string{
|
|
|
|
+ "taskId": taskId,
|
|
|
|
+ "state": state,
|
|
|
|
+ },
|
|
|
|
+ )
|
|
|
|
+ if err != nil {
|
|
|
|
+ infra.GlobalLogger.Error(err)
|
|
|
|
+ c.String(http.StatusOK, "false")
|
|
|
|
+ }
|
|
|
|
+ c.String(http.StatusOK, "true")
|
|
}
|
|
}
|