zzf 1 year ago
parent
commit
ab0d6d2777
2 changed files with 13 additions and 2 deletions
  1. 2 2
      api/gateway/gateway.go
  2. 11 0
      initialize/sseclient.go

+ 2 - 2
api/gateway/gateway.go

@@ -212,8 +212,8 @@ func WriteData(c *gin.Context) {
 	fmt.Println("bindUserUrl====" + bindUserUrl)
 	httpResponse := http.GetReq(bindUserUrl)
 	if httpResponse.StatusCode != 200 {
-		fmt.Printf("%s:%s", errors.SetDeviceTimeFailed, httpResponse.Body)
-		response.Failed(errors.SetDeviceTimeFailed, c)
+		fmt.Printf("%s:%s", errors.BindUserFailed, httpResponse.Body)
+		response.Failed(errors.BindUserFailed, c)
 		return
 	}
 	//授时

+ 11 - 0
initialize/sseclient.go

@@ -0,0 +1,11 @@
+package initialize
+
+import (
+	"confrontation-training/global"
+	"github.com/r3labs/sse/v2"
+)
+
+func CreateSseClient() {
+	global.SseClientDevice = sse.NewClient("")
+	global.SseClientData = sse.NewClient("")
+}