]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
小心心 fix
authorqydysky <qydysky@foxmail.com>
Sat, 12 Jun 2021 12:32:24 +0000 (20:32 +0800)
committerqydysky <qydysky@foxmail.com>
Sat, 12 Jun 2021 12:32:24 +0000 (20:32 +0800)
F/api.go
F/xinxin.go

index f4ef3c78b8ac4e24e0ba164bea77533d011208b2..f2baae36cd5f2a4d83e977f7f80badc955801c3d 100644 (file)
--- 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){
index 30aeac68ccf856e83e5701ecd4f61e3f2bd4bb3a..2362534fecdca72b3683b0748973fe9500880c7b 100644 (file)
@@ -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\"]",