Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lcc-akm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangmingming
lcc-akm
Commits
87247bb9
Commit
87247bb9
authored
Mar 08, 2023
by
anqi-wmm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产 sensor_data
测试成功
parent
dc15ac30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
6 deletions
+15
-6
main.go
main.go
+5
-0
easyjet.go
model/easyjet.go
+5
-2
init.go
model/init.go
+5
-1
sensor.go
sensor/sensor.go
+0
-3
No files found.
main.go
View file @
87247bb9
...
...
@@ -15,6 +15,11 @@ func WelcomeHandler(w http.ResponseWriter, r *http.Request) {
func
main
()
{
logrus
.
SetLevel
(
logrus
.
TraceLevel
)
logrus
.
SetFormatter
(
&
logrus
.
TextFormatter
{
//HideKeys: true,
TimestampFormat
:
"2006-01-02 15:04:05.000"
,
//时间格式
FullTimestamp
:
true
,
})
//str := "<noscript><img src=\"https://www.easyjet.com/akam/13/pixel_7b9d10f9?a=dD1lMmMzOTBjM2M4NWUyYz\nkzNjljOTNhZDUyNmRkOGJjMDdjNjM2MWJmJmpzPW9mZg==\" style=\"visibility: hidden; position: absolu\nte; left: -999px; top: -999px;\" /></noscript><script type=\"text/javascript\" src=\"/-Hzovq/uluGM/jHPdr/v3N7/m5OOLVXmDOwY/NG4dCQE/Zy/lnEF9qaQI\"></script></body>\n</html>"
//reg, _ := regexp.Compile("</noscript><script type=\"text/javascript\" src=\"(.+?)\"></s")
//matchs := reg.FindStringSubmatch(str)
...
...
model/easyjet.go
View file @
87247bb9
...
...
@@ -62,15 +62,18 @@ func GetAbck(times int, urlInput string) []*http.Cookie {
//}
//res, _ := io.ReadAll(resp.Body)
ua
:=
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.50"
res
:=
sensor
.
GenData
(
abck
,
bmsz
,
ua
,
urlInput
)
t1
:=
time
.
Now
()
res
:=
sensor
.
GenData
(
abck
,
bmsz
,
ua
,
urlInput
)
logrus
.
Info
(
"生产一次 abck 耗时"
,
time
.
Since
(
t1
)
.
String
())
t1
=
time
.
Now
()
sensor_data
:=
"{
\"
sensor_data
\"
:
\"
"
+
string
(
res
)
+
"
\"
}"
akmRes
,
err
:=
akmClient
.
Client
.
Post
(
"https://www.easyjet.com"
+
akmClient
.
SensorUrl
,
"application/json"
,
strings
.
NewReader
(
sensor_data
))
if
err
!=
nil
{
log
.
Fatalln
(
err
)
}
defer
akmRes
.
Body
.
Close
()
logrus
.
Info
(
"响应abck结果"
,
akmRes
.
StatusCode
,
"请求耗时"
,
time
.
Since
(
t1
)
.
String
())
logrus
.
Info
(
"
第"
,
times
,
"
响应abck结果"
,
akmRes
.
StatusCode
,
"请求耗时"
,
time
.
Since
(
t1
)
.
String
())
return
akmRes
.
Cookies
()
}
...
...
model/init.go
View file @
87247bb9
...
...
@@ -5,11 +5,13 @@ import (
"github.com/sirupsen/logrus"
"net/http"
"test/util"
"time"
)
func
routeToU2
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
t1
:=
time
.
Now
()
data
:=
util
.
GetPostJson
(
r
)
logrus
.
Printf
(
"请求一次"
,
data
)
logrus
.
Info
(
"请求一次"
,
data
)
if
err
:=
checkPostRequire
(
data
);
err
==
false
{
util
.
WriteJson
(
w
,
util
.
ErrorJson
(
"请求参数不正确"
))
}
...
...
@@ -24,6 +26,8 @@ func routeToU2(w http.ResponseWriter, r *http.Request) {
util
.
WriteJson
(
w
,
util
.
ErrorJson
(
"不支持的航司"
))
return
}
logrus
.
Info
(
"请求结束 耗时"
,
time
.
Since
(
t1
)
.
String
())
cookies
:=
akm
.
Cookies
util
.
WriteJson
(
w
,
&
util
.
Response
{
...
...
sensor/sensor.go
View file @
87247bb9
...
...
@@ -2,7 +2,6 @@ package sensor
import
(
"fmt"
"github.com/sirupsen/logrus"
"math"
"math/rand"
"net/url"
...
...
@@ -499,9 +498,7 @@ func bd(a, b string) string {
return
a
+
b
}
func
GenData
(
abck
,
bmsz
,
ua
,
url
string
)
string
{
t1
:=
time
.
Now
()
akm
:=
NewAkmSign
(
0
,
url
,
ua
,
abck
,
bmsz
)
logrus
.
Info
(
"生产一次 abck 耗时"
,
time
.
Since
(
t1
)
.
String
())
return
akm
.
genData
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment