Commit 43d9cecc authored by 王明明's avatar 王明明

vy nk

parent 808176f7
......@@ -128,6 +128,29 @@ func (akm *AkmClient) GetAllCookie() map[string]string {
}
return res
}
func (akm *AkmClient) postSensorJs(times int) error {
abck, bm_sz := akm.GetCookie()
t1 := time.Now()
datas := fmt.Sprintf("times=%d&abck=%s&bm_sz=%s&url=%s", times, abck, bm_sz, akm.postUrl)
r, _ := http.Post("http://127.0.0.1:3033/akm2t", "application/x-www-form-urlencoded", strings.NewReader(datas))
rs, _ := io.ReadAll(r.Body)
rsss := strings.Split(string(rs), "|||||")
sensorData := rsss[0]
UA := rsss[1]
akm.ua = UA
t2 := time.Now()
sensor_data := "{\"sensor_data\":\"" + sensorData + "\"}"
akm.logger.Info("sensor", sensor_data)
statusCode, err := akm.PostJson(times, akm.SensorUrl, sensor_data)
if err != nil {
return err
}
abck, bm_sz = akm.GetCookie()
akm.logger.Info("第", times, "生成一次 abck 耗时 ", t2.Sub(t1).String(), " 响应abck结果 ", statusCode, " abck长度 ", len(abck), " 请求耗时 ", time.Since(t2).String())
return nil
}
func (akm *AkmClient) postSensor(times int) error {
abck, bmsz := akm.GetCookie()
......
......@@ -12,7 +12,7 @@ func VueLing(carrierType, proxyUrl string) (*Akm, error) {
return nil, err
}
for i := 0; i < 4; i++ {
err := akmClient.postSensor(i)
err := akmClient.postSensorJs(i)
if err != nil {
akmClient.logger.WithError(err).Errorln("请求失败")
return nil, err
......
export GOPROXY=https://goproxy.cn
cd /root/src/js && npm i && nohup node run.js > 1.log 2>&1 &
cd /root/src && go run main.go
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment