Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
25dc666d
Commit
25dc666d
authored
Feb 23, 2017
by
lee_mingzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除调试用的日志
parent
3bbaa0bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
17 deletions
+13
-17
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+13
-17
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
25dc666d
...
...
@@ -174,9 +174,7 @@ public class WeChatController {
* @return
*/
@RequestMapping
(
"/receiveCode/{key}/{redirect}"
)
public
void
receiveCode
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
String
redirect
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
schema
=
request
.
getScheme
();
LOGGER
.
info
(
"HTTP协议:"
+
schema
);
public
void
receiveCode
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
String
redirect
,
HttpServletResponse
response
)
{
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
...
...
@@ -216,7 +214,7 @@ public class WeChatController {
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
,
schema
);
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
...
...
@@ -228,9 +226,7 @@ public class WeChatController {
* @return
*/
@RequestMapping
(
"/receiveCode/{key}"
)
public
void
receiveCodeNoRedirect
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
schema
=
request
.
getScheme
();
LOGGER
.
info
(
"HTTP协议no redirect:"
+
schema
);
public
void
receiveCodeNoRedirect
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
HttpServletResponse
response
)
{
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
...
...
@@ -270,36 +266,36 @@ public class WeChatController {
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
,
schema
);
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
,
String
schema
)
{
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
)
{
//TODO 临时紧急上线修改的.下次上线的时候修复一下,不能这样写.
String
url
=
"http://passport.xyqb.com"
;
/*
String url = "http://passport.xyqb.com";
if("https".equals(schema)) {
url = "https://passport.xyqb.com";
}
}
*/
if
(
StringUtils
.
isEmpty
(
redirect
)
||
"redirect"
.
equals
(
redirect
))
{
LOGGER
.
info
(
"微信登录:redirect为null,走正常流程."
);
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
,
schema
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
);
}
else
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
,
schema
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
);
}
}
else
if
(
"local"
.
equals
(
redirect
)){
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
u
rl
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
return
u
rl
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
();
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
u
serUIAddr
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
return
u
serUIAddr
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
();
}
return
null
;
}
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
,
String
url
)
{
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
)
{
AuthBean
authBean
=
sessionService
.
createSession
(
channelId
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
return
u
rl
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom=198&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
;
return
u
serUIAddr
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom=198&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
;
}
private
void
redirectWechatLoginUrlWithoutLogin
(
HttpServletResponse
response
,
Merchant
merchant
,
WechatUserInfo
userInfo
)
{
...
...
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