From da82f1a7655eeab91b92895de9f0042471fb3aad Mon Sep 17 00:00:00 2001 From: fish Date: Sat, 27 Apr 2019 15:17:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=B8=E9=A1=B6=E7=B1=BB=E5=9E=8B=E4=BC=A0?= =?UTF-8?q?=E6=84=9F=E5=99=A8=E4=BD=BF=E7=94=A8=E7=89=B9=E5=AE=9A=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router.go | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/router.go b/router.go index 09bfb9e..be6d0bd 100644 --- a/router.go +++ b/router.go @@ -48,6 +48,8 @@ func gw_router() { type DparkConf struct { ExtensionInTime int `json:"in"` ExtensionOutTime int `json:"out"` + ExtensionInTime2 int `json:"in2"` + ExtensionOutTime2 int `json:"out2"` } var dparkConf DparkConf @@ -407,6 +409,16 @@ func dealDatav3(data []byte) string{ cs2001 := data[6] + var R_data P1004_6 + R_data.CODE = 1008 + R_data.ID = adr + //尿布台 + R_data.VERSION = "yunhorn_2_v1" + R_data.ONLINE = true + R_data.DATA = make(map[string]interface{}) + R_data.DATA["cs2001"]=cs2001 + + datatypeStr := strconv.FormatInt(int64(data[5]&0xff), 16) cs2001Str := strconv.FormatInt(int64(data[6]&0xff), 16) @@ -427,11 +439,17 @@ func dealDatav3(data []byte) string{ if newdtype==1{ tof = data[7] + R_data.VERSION = "yunhorn_1_v1" + R_data.DATA["tof"]=tof tofTmp := strconv.FormatInt(int64(data[7]&0xff), 10) readyData.WriteString("*") readyData.WriteString(tofTmp) } + data_bufTmp, _ := json.Marshal(R_data) + data_buf := string(data_bufTmp) + go post_to_server(data_buf) + // log.Println("readyData:",readyData.String()) // go pushCODE1007(data) @@ -496,13 +514,29 @@ func dealDatav3(data []byte) string{ log.Println("yunhorndeug.push.data.durationAsInt64:",durationAsInt64) if current == 0 { - if durationAsInt64 < extensionOutTime { + //类型2 吸顶 + if datatype==2{ + if durationAsInt64 < extensionOutTime2 { + return "" + } + }else{ + if durationAsInt64 < extensionOutTime { + return "" + } + } + + }else{ + //类型2 吸顶 + if datatype==2{ + if durationAsInt64 < extensionInTime2 { return "" } - }else{ + }else{ if durationAsInt64 < extensionInTime { return "" } + } + } //改变状态