Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
doudian-py
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiquan
doudian-py
Commits
51e05f26
Commit
51e05f26
authored
Jun 26, 2025
by
baiquan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化确认是否登录方式
parent
682e20a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
service/page_login.py
+20
-19
No files found.
service/page_login.py
View file @
51e05f26
import
re
import
time
from
datetime
import
datetime
,
timedelta
from
DrissionPage
import
Chromium
from
DrissionPage._functions.by
import
By
from
loguru
import
logger
from
dao.db
import
find_account_by_environment_id
from
service.hub_
import
openBrowser
,
closeBrowser
from
utils.dy_verify
import
get_distance_by_ddddocr
from
utils.errors
import
AppError
from
service.hub_
import
openBrowser
,
closeBrowser
from
dao.db
import
find_account_by_environment_id
def
click_button
(
tab
,
loc
):
...
...
@@ -51,19 +49,13 @@ async def page_login(browser_id):
if
open_count
==
0
:
raise
AppError
(
"启动浏览器失败"
)
doc_loaded
=
None
tab
.
get
(
'https://fxg.jinritemai.com/ffa/mshop/homepage/index'
)
tab
.
listen
.
start
([
"account_login/v2/"
,
"captcha/verify"
])
tab
.
get
(
'https://fxg.jinritemai.com/login/common'
)
for
_
in
range
(
3
):
doc_loaded
=
tab
.
wait
.
doc_loaded
(
timeout
=
10
)
if
doc_loaded
:
break
if
not
doc_loaded
:
raise
AppError
(
"打开浏览器失败"
)
tab
.
wait
(
3
)
title
=
tab
.
title
if
'登录'
in
title
:
tab
.
listen
.
start
([
"account_login/v2/"
,
"captcha/verify"
,
"/aff/check_login"
])
login_res
=
listen_check_login
(
tab
)
logger
.
info
(
f
"当前页面是否登录-->{login_res}"
)
if
not
login_res
:
retry
=
0
while
True
:
if
retry
>
3
:
...
...
@@ -73,7 +65,6 @@ async def page_login(browser_id):
retry
+=
1
try
:
em
=
"邮箱登录"
tab
.
get
(
'https://fxg.jinritemai.com/login/common'
)
doc_loaded
=
tab
.
wait
.
doc_loaded
(
timeout
=
10
)
eles_loaded
=
tab
.
wait
.
eles_loaded
(
em
)
if
not
doc_loaded
or
not
eles_loaded
:
...
...
@@ -113,6 +104,16 @@ def listen_login(tab):
else
:
raise
AppError
(
f
"登录失败 {login_res['description']}"
)
def
listen_check_login
(
tab
):
check_result
=
False
for
packet
in
tab
.
listen
.
steps
(
timeout
=
5
):
if
'/aff/check_login'
in
packet
.
url
:
login_res
=
packet
.
response
.
body
logger
.
info
(
f
'获取确认登录数据:{login_res}'
)
if
login_res
[
'description'
]
==
''
and
login_res
[
'deputy_has_login'
]
==
True
and
login_res
[
'error_code'
]
==
0
:
check_result
=
True
return
check_result
def
verify_captcha
(
tab
):
captcha_verify_image
=
(
By
.
XPATH
,
'//*[@id="captcha_verify_image"]'
)
verify_img_slide
=
(
By
.
XPATH
,
'//*[@id="captcha-verify_img_slide"]'
)
...
...
@@ -150,9 +151,9 @@ def verify_captcha(tab):
iframe
.
actions
.
right
(
x
)
iframe
.
actions
.
release
()
for
verify_packet
in
tab
.
listen
.
steps
(
timeout
=
30
):
if
"
https://verify.zijieapi.com/
captcha/verify"
in
verify_packet
.
url
:
if
"captcha/verify"
in
verify_packet
.
url
:
verify_res
=
verify_packet
.
response
.
body
if
verify_res
[
'code'
]
==
200
or
verify_res
[
'code'
]
==
0
:
if
verify_res
[
'code'
]
!=
50
0
:
logger
.
info
(
f
"-------- login_verify: 滑块处理成功!--------"
)
return
else
:
...
...
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