From 0795687d2d8a40a67c80d266df5f9640578691f4 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sat, 12 Jun 2021 20:32:24 +0800 Subject: [PATCH] =?utf8?q?=E5=B0=8F=E5=BF=83=E5=BF=83=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- F/api.go | 39 +++++++++++++++++++++------------------ F/xinxin.go | 20 +++++++++++--------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/F/api.go b/F/api.go index f4ef3c7..f2baae3 100644 --- a/F/api.go +++ b/F/api.go @@ -1933,17 +1933,26 @@ func F_x25Kn() { //新调用,此退出 if boot_F_x25Kn.NeedExit(id) {return} - var rt_obj = RT{ - R:R{ - Id:`[`+strconv.Itoa(c.ParentAreaID)+`,`+strconv.Itoa(c.AreaID)+`,`+strconv.Itoa(loop_num)+`,`+strconv.Itoa(c.Roomid)+`]`, - Device:`["`+LIVE_BUVID+`","`+new_uuid+`"]`, - Ets:res.Data.Timestamp, - Benchmark:res.Data.Secret_key, - Time:res.Data.Heartbeat_interval, - Ts:int(p.Sys().GetMTime()), - Ua:`Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0`, - }, - T:res.Data.Secret_rule, + var ( + rt_obj = RT{ + R:R{ + Id:`[`+strconv.Itoa(c.ParentAreaID)+`,`+strconv.Itoa(c.AreaID)+`,`+strconv.Itoa(loop_num)+`,`+strconv.Itoa(c.Roomid)+`]`, + Device:`["`+LIVE_BUVID+`","`+new_uuid+`"]`, + Ets:res.Data.Timestamp, + Benchmark:res.Data.Secret_key, + Time:res.Data.Heartbeat_interval, + Ts:int(p.Sys().GetMTime()), + Ua:`Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0`, + }, + T:res.Data.Secret_rule, + } + wasm string + ) + + + if rt_obj,wasm = Wasm(0, rt_obj);wasm == `` {//0全局 + apilog.L(`E: `,`发生错误`) + return } PostStr := `id=`+rt_obj.R.Id+`&` @@ -1957,13 +1966,7 @@ func F_x25Kn() { PostStr += `ua=`+rt_obj.R.Ua+`&` PostStr += `csrf_token=`+csrf+`&csrf=`+csrf+`&` PostStr += `visit_id=` - - if wasm := Wasm(0, rt_obj);wasm == `` {//0全局 - apilog.L(`E: `,`发生错误`) - return - } else { - PostStr = `s=`+wasm+`&`+PostStr - } + PostStr = `s=`+wasm+`&`+PostStr Cookie := make(map[string]string) c.Cookie.Range(func(k,v interface{})(bool){ diff --git a/F/xinxin.go b/F/xinxin.go index 30aeac6..2362534 100644 --- a/F/xinxin.go +++ b/F/xinxin.go @@ -138,7 +138,9 @@ func server() { wslog.L(`I: `,`使用WebJs`,webpath,`进行加密`) } -func Wasm(uid uintptr,s RT) (o string) {//maxloop 超时重试 +func Wasm(uid uintptr,rt RT) (so RT, o string) {//maxloop 超时重试 + so = rt + {//nodejs if nodeJsUrl != "" { req := reqf.New() @@ -147,12 +149,12 @@ func Wasm(uid uintptr,s RT) (o string) {//maxloop 超时重试 `Content-Type`: `application/json`, }, Url:nodeJsUrl, - PostStr:toNodeJsString(s), + PostStr:toNodeJsString(so), Proxy:c.Proxy, Timeout:3*1000, });err != nil { wslog.L(`E: `,err) - o = Wasm(uid, s) + so,o = Wasm(uid, so) return } @@ -185,10 +187,10 @@ func Wasm(uid uintptr,s RT) (o string) {//maxloop 超时重试 return } - if !strings.Contains(s.R.Ua, `Test`) { - s.R.Ts = int(p.Sys().GetMTime()) + if !strings.Contains(so.R.Ua, `Test`) { + so.R.Ts = int(p.Sys().GetMTime()) } - b, e := json.Marshal(s) + b, e := json.Marshal(so) if e != nil { wslog.L(`E: `,e) } @@ -202,8 +204,8 @@ func Wasm(uid uintptr,s RT) (o string) {//maxloop 超时重试 for { select { case r :=<- rec_chan: - if r.Id != s.R.Id {break}//或许接收到之前的请求,校验Id字段 - return r.S + if r.Id != so.R.Id {break}//或许接收到之前的请求,校验Id字段 + return so, r.S case <- time.After(time.Second*time.Duration(1)): wslog.L(`E: `,`超时!响应>1s,确认保持`,webpath,`开启`) return @@ -226,7 +228,7 @@ func Close(uid uintptr){ func test(uid uintptr) bool { time.Sleep(time.Second*time.Duration(3)) - if s := Wasm(uid, RT{ + if _,s := Wasm(uid, RT{ R:R{ Id: "[9,371,1,22613059]", Device: "[\"AUTO8216117272375373\",\"77bee604-b591-4664-845b-b69603f8c71c\"]", -- 2.39.2