Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
06caa3fa
Commit
06caa3fa
authored
Jan 07, 2020
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix wechat oauth
parent
7781913e
Pipeline
#18863
passed with stage
in 1 minute 22 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
wechat.js
app/controller/gjj/wechat.js
+5
-4
No files found.
app/controller/gjj/wechat.js
View file @
06caa3fa
...
...
@@ -223,7 +223,7 @@ class WechatController extends Controller {
const
url
=
`
${
WECHAT_AUTH
}
?appid=
${
appid
}
&secret=
${
appsecret
}
&code=
${
code
}
&grant_type=authorization_code`
;
const
result
=
await
ctx
.
helper
.
send_request
(
url
,
{},
{
method
:
'GET'
});
ctx
.
logger
.
info
(
JSON
.
stringify
({
wx_kefu
_query
:
result
}));
ctx
.
logger
.
info
(
JSON
.
stringify
({
url
,
wx_athena
_query
:
result
}));
if
(
result
.
status
!==
200
)
{
ctx
.
failed
(
'获取openid失败1'
);
}
...
...
@@ -241,12 +241,13 @@ class WechatController extends Controller {
ctx
.
cookies
.
set
(
'jianbing_customer_id'
,
null
,
{
httpOnly
:
false
,
signed
:
false
,
path
:
'/'
,
overwrite
:
true
});
ctx
.
cookies
.
set
(
'auth_token'
,
null
,
{
httpOnly
:
false
,
signed
:
false
,
path
:
'/'
,
overwrite
:
true
});
const
redirect_page
=
wechatApp
.
login_url
?
wechatApp
.
login_url
:
(
wechatApp
.
business_url
?
wechatApp
.
business_url
:
REDIRECT_PAGE
);
// const redirect_page = wechatApp.login_url ? wechatApp.login_url : (wechatApp.business_url ? wechatApp.business_url : REDIRECT_PAGE);
const
redirect_page
=
wechatApp
.
business_url
?
wechatApp
.
business_url
:
REDIRECT_PAGE
;
const
redirect_url
=
redirect_page
.
indexOf
(
'http'
)
>
-
1
?
redirect_page
:
this
.
app
.
config
.
PULIC_BASE_URL
+
redirect_page
;
// 判断是否已绑定手机号
const
user_exist_url
=
`
${
this
.
app
.
config
.
NODE_BASE_URL
}
/user_api/v1/user/is_exist/
${
openid
}
`
;
const
bind_phone_result
=
await
ctx
.
helper
.
send_request
(
user_exist_url
,
{
type
:
5
},
{
method
:
'GET'
});
ctx
.
logger
.
info
(
JSON
.
stringify
({
kefu
_bind_phone_result
:
bind_phone_result
}));
ctx
.
logger
.
info
(
JSON
.
stringify
({
athena_bind_phone_params
:
{
openid
,
type
:
5
},
athena
_bind_phone_result
:
bind_phone_result
}));
if
(
bind_phone_result
.
status
!==
200
)
{
ctx
.
redirect
(
redirect_url
+
`?channel_id=
${
channel_id
}
&type=noLogin`
);
return
;
}
...
...
@@ -260,7 +261,7 @@ class WechatController extends Controller {
ctx
.
redirect
(
redirect_url
+
`?channel_id=
${
channel_id
}
&type=noLogin`
);
return
;
}
ctx
.
redirect
(
redirect_url
+
`?channel_id=
${
channel_id
}
&type=hasLogin`
);
return
;
// 已导入公积金
ctx
.
redirect
(
redirect_url
+
`?channel_id=
${
channel_id
}
&type=hasLogin`
);
return
;
}
}
...
...
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