Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Automat
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
1
Merge Requests
1
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
冯佳佳
Automat
Commits
c5bbc40a
Commit
c5bbc40a
authored
Nov 10, 2021
by
yanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加了一个空行
parent
6dbe8187
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
myapps/sukang24h/api/wx_auth_portal.py
+11
-5
No files found.
myapps/sukang24h/api/wx_auth_portal.py
View file @
c5bbc40a
...
@@ -31,6 +31,7 @@ wx_auth_route = Blueprint('wx_auth', __name__)
...
@@ -31,6 +31,7 @@ wx_auth_route = Blueprint('wx_auth', __name__)
@wx_auth_route.route
(
'/test'
,
methods
=
[
'POST'
])
@wx_auth_route.route
(
'/test'
,
methods
=
[
'POST'
])
def
my_test
():
def
my_test
():
a
=
{
'error_code'
:
'0'
,
'error_message'
:
'Success'
}
a
=
{
'error_code'
:
'0'
,
'error_message'
:
'Success'
}
return
jsonify
(
a
)
return
jsonify
(
a
)
...
@@ -59,16 +60,20 @@ def mini_login():
...
@@ -59,16 +60,20 @@ def mini_login():
return
jsonify
(
WX_LOGIN_CODE_ERROR
)
return
jsonify
(
WX_LOGIN_CODE_ERROR
)
try
:
try
:
user_info
=
WeChatWxaCrypto
(
user_session
[
"session_key"
],
iv
,
app_id
)
.
decrypt_message
(
encrypted_data
)
user_info
=
WeChatWxaCrypto
(
user_session
[
"session_key"
],
iv
,
app_id
)
.
decrypt_message
(
encrypted_data
)
except
:
except
:
try
:
try
:
session_key
=
redis_client
.
get
(
WX_SESSION_KEY
+
user_session
[
"openid"
])
session_key
=
redis_client
.
get
(
user_info
=
WeChatWxaCrypto
(
session_key
,
iv
,
app_id
)
.
decrypt_message
(
encrypted_data
)
WX_SESSION_KEY
+
user_session
[
"openid"
])
user_info
=
WeChatWxaCrypto
(
session_key
,
iv
,
app_id
)
.
decrypt_message
(
encrypted_data
)
except
:
except
:
return
BaseResponse
(
error_code
=
500
,
error_message
=
'user info decrypt error'
)
return
BaseResponse
(
error_code
=
500
,
error_message
=
'user info decrypt error'
)
is_new_user
=
0
is_new_user
=
0
wx_user_model
=
WxUser
.
query
.
filter_by
(
openid
=
user_session
[
"openid"
])
.
first
()
wx_user_model
=
WxUser
.
query
.
filter_by
(
openid
=
user_session
[
"openid"
])
.
first
()
if
not
wx_user_model
:
if
not
wx_user_model
:
wx_user_model
=
WxUser
()
wx_user_model
=
WxUser
()
wx_user_model
.
status
=
1
wx_user_model
.
status
=
1
...
@@ -88,7 +93,8 @@ def mini_login():
...
@@ -88,7 +93,8 @@ def mini_login():
wx_user_model
.
platform
=
platform_appid_config_list
.
index
(
app_id
)
wx_user_model
.
platform
=
platform_appid_config_list
.
index
(
app_id
)
db
.
session
.
add
(
wx_user_model
)
db
.
session
.
add
(
wx_user_model
)
db
.
session
.
commit
()
db
.
session
.
commit
()
token
=
generate_jwt
(
payload
=
{
"user_id"
:
wx_user_model
.
id
},
expiry
=
time
.
time
()
+
24
*
60
*
60
)
token
=
generate_jwt
(
payload
=
{
"user_id"
:
wx_user_model
.
id
},
expiry
=
time
.
time
()
+
24
*
60
*
60
)
return
jsonify
({
return
jsonify
({
'customer_id'
:
wx_user_model
.
id
,
'customer_id'
:
wx_user_model
.
id
,
'token'
:
token
,
'token'
:
token
,
...
...
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