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
3e4070e3
Commit
3e4070e3
authored
Mar 16, 2017
by
lee_mingzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change something
parent
d6590c44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
192 additions
and
151 deletions
+192
-151
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+192
-151
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
3e4070e3
...
@@ -16,7 +16,9 @@ import cn.quantgroup.xyqb.service.wechat.IWechatService;
...
@@ -16,7 +16,9 @@ import cn.quantgroup.xyqb.service.wechat.IWechatService;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.alibaba.fastjson.TypeReference
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
@@ -180,8 +182,8 @@ public class WeChatController implements IBaseController {
...
@@ -180,8 +182,8 @@ public class WeChatController implements IBaseController {
*/
*/
@RequestMapping
(
"/receiveCode/{key}/{redirect}"
)
@RequestMapping
(
"/receiveCode/{key}/{redirect}"
)
public
void
receiveCode
(
public
void
receiveCode
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
String
redirect
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
@PathVariable
String
redirect
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
schema
=
request
.
getScheme
();
String
schema
=
request
.
getScheme
();
LOGGER
.
info
(
"HTTP协议:"
+
schema
);
LOGGER
.
info
(
"HTTP协议:"
+
schema
);
// 从code获取token
// 从code获取token
...
@@ -203,7 +205,7 @@ public class WeChatController implements IBaseController {
...
@@ -203,7 +205,7 @@ public class WeChatController implements IBaseController {
// welcome 首次登录
// welcome 首次登录
if
(
userInfoInDb
==
null
)
{
if
(
userInfoInDb
==
null
)
{
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
userInfo
.
setNickName
(
nickName
);
userInfo
.
setNickName
(
nickName
);
}
}
...
@@ -229,161 +231,200 @@ public class WeChatController implements IBaseController {
...
@@ -229,161 +231,200 @@ public class WeChatController implements IBaseController {
}
}
/**
/**
* 前端微信跳转页面,通过extdata
* 前端微信跳转页面,通过extdata
*
*
* @param response
* @param response
* @return
* @return
*/
*/
@RequestMapping
(
"/receiveCode/extdata/{key}/{extdata}"
)
@RequestMapping
(
"/receiveCode/extdata/{key}/{extdata}"
)
public
void
receiveCodeWithExtData
(
public
void
receiveCodeWithExtData
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
(
value
=
"extdata"
)
String
extData
,
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
(
value
=
"extdata"
)
String
extData
,
HttpServletRequest
request
,
HttpServletResponse
response
HttpServletRequest
request
,
HttpServletResponse
response
)
{
)
{
try
{
String
schema
=
getProtocol
();
extData
=
getExtData
(
extData
);
LOGGER
.
info
(
"从微信extdata版本接口进入:{}, extData:{}"
,
schema
,
extData
);
if
(
StringUtils
.
isEmpty
(
extData
))
{
normalLogin
(
code
,
systemKey
,
response
,
schema
);
}
else
{
HashMap
<
String
,
Object
>
extDataObj
;
try
{
try
{
extDataObj
=
String
schema
=
getProtocol
();
JSON
.
parseObject
(
extData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
extData
=
getExtData
(
extData
);
});
LOGGER
.
info
(
"从微信extdata版本接口进入:{}, extData:{}"
,
schema
,
extData
);
if
(
StringUtils
.
isEmpty
(
extData
))
{
normalLogin
(
code
,
systemKey
,
response
,
schema
);
}
else
{
HashMap
<
String
,
Object
>
extDataObj
;
try
{
extDataObj
=
JSON
.
parseObject
(
extData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
});
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"解析extData发生错误"
,
ex
);
// 从code获取token
normalLogin
(
code
,
systemKey
,
response
,
schema
);
return
;
}
selfDefinedLogin
(
code
,
systemKey
,
response
,
schema
,
extDataObj
);
}
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"解析extData发生错误"
,
ex
);
LOGGER
.
error
(
"发生异常"
,
ex
);
// 从code获取token
throw
ex
;
normalLogin
(
code
,
systemKey
,
response
,
schema
);
return
;
}
}
selfDefinedLogin
(
code
,
systemKey
,
response
,
schema
,
extDataObj
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"发生异常"
,
ex
);
throw
ex
;
}
}
/**
* 前端微信跳转页面,通过extdata
*
* @param response
* @return
*/
@RequestMapping
(
"/receiveCode/forward/{key}/{extdata}"
)
public
void
receiveCodeWithForward
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
(
value
=
"extdata"
)
String
extData
,
HttpServletResponse
response
)
{
try
{
String
schema
=
getProtocol
();
extData
=
getExtData
(
extData
);
LOGGER
.
info
(
"从微信extdata版本接口进入:{}, extData:{}"
,
schema
,
extData
);
if
(
StringUtils
.
isEmpty
(
extData
))
{
normalLogin
(
code
,
systemKey
,
response
,
schema
);
}
else
{
HashMap
<
String
,
Object
>
extDataObj
;
try
{
extDataObj
=
JSON
.
parseObject
(
extData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
});
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"解析extData发生错误"
,
ex
);
// 从code获取token
normalLogin
(
code
,
systemKey
,
response
,
schema
);
return
;
}
selfDefinedLogin
(
code
,
systemKey
,
response
,
schema
,
extDataObj
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"发生异常"
,
ex
);
throw
ex
;
}
}
private
String
getExtData
(
@PathVariable
(
value
=
"extdata"
)
String
extData
)
{
try
{
extData
=
new
String
(
Base64
.
decodeBase64
(
extData
),
"UTF-8"
);
}
catch
(
Exception
ex
)
{
extData
=
""
;
}
return
extData
;
}
private
boolean
selfDefinedLogin
(
String
code
,
String
systemKey
,
HttpServletResponse
response
,
String
schema
,
HashMap
<
String
,
Object
>
extDataObj
)
{
Long
registerFrom
=
Long
.
valueOf
(
extDataObj
.
getOrDefault
(
"registerFrom"
,
"1"
).
toString
());
String
redirect
=
(
String
)
extDataObj
.
getOrDefault
(
"redirect"
,
"redirect"
);
LOGGER
.
info
(
"从微信登录,registerFrom:{}, redirect:{}"
,
registerFrom
,
redirect
);
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
);
return
true
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
);
return
true
;
}
WechatUserInfo
userInfoInDb
=
wechatService
.
findWechatUserInfoFromDb
(
userInfo
.
getOpenId
());
// welcome 首次登录
if
(
userInfoInDb
==
null
)
{
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
userInfo
.
setNickName
(
nickName
);
}
userInfo
=
wechatService
.
saveWechatUserInfo
(
userInfo
);
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfo
,
registerFrom
);
return
true
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
);
return
true
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
);
return
true
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
,
schema
,
registerFrom
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
return
false
;
}
private
boolean
normalLogin
(
String
code
,
String
systemKey
,
HttpServletResponse
response
,
String
schema
)
{
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
}
WechatUserInfo
userInfoInDb
=
wechatService
.
findWechatUserInfoFromDb
(
userInfo
.
getOpenId
());
// welcome 首次登录
if
(
userInfoInDb
==
null
)
{
private
String
getExtData
(
String
extData
)
{
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
try
{
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
extData
=
new
String
(
Base64
.
decodeBase64
(
extData
),
"UTF-8"
);
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
}
catch
(
Exception
ex
)
{
userInfo
.
setNickName
(
nickName
);
extData
=
""
;
}
}
userInfo
=
wechatService
.
saveWechatUserInfo
(
userInfo
);
return
extData
;
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfo
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
private
boolean
selfDefinedLogin
(
String
code
,
String
systemKey
,
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
HttpServletResponse
response
,
String
schema
,
HashMap
<
String
,
Object
>
extDataObj
)
{
Constants
.
Channel
.
WECHAT
);
Long
registerFrom
=
Long
.
valueOf
(
extDataObj
.
getOrDefault
(
"registerFrom"
,
"1"
).
toString
());
return
true
;
String
redirect
=
(
String
)
extDataObj
.
getOrDefault
(
"redirect"
,
"redirect"
);
LOGGER
.
info
(
"从微信登录,registerFrom:{}, redirect:{}"
,
registerFrom
,
redirect
);
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
);
return
true
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
);
return
true
;
}
WechatUserInfo
userInfoInDb
=
wechatService
.
findWechatUserInfoFromDb
(
userInfo
.
getOpenId
());
// welcome 首次登录
if
(
userInfoInDb
==
null
)
{
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
userInfo
.
setNickName
(
nickName
);
}
userInfo
=
wechatService
.
saveWechatUserInfo
(
userInfo
);
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfo
,
registerFrom
);
return
true
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
);
return
true
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
);
return
true
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
,
schema
,
registerFrom
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
return
false
;
}
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
private
boolean
normalLogin
(
String
code
,
String
systemKey
,
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
HttpServletResponse
response
,
String
schema
)
{
Constants
.
Channel
.
WECHAT
);
// 从code获取token
return
true
;
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
WechatUserInfo
userInfoInDb
=
wechatService
.
findWechatUserInfoFromDb
(
userInfo
.
getOpenId
());
// welcome 首次登录
if
(
userInfoInDb
==
null
)
{
// 微信用户首次登录界面, 首先保存userInfo, 跳入到微信注册登录界面
if
(
StringUtils
.
isNotBlank
(
userInfo
.
getNickName
()))
{
String
nickName
=
EmojiUtil
.
filter
(
userInfo
.
getNickName
());
userInfo
.
setNickName
(
nickName
);
}
userInfo
=
wechatService
.
saveWechatUserInfo
(
userInfo
);
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfo
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
);
return
true
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
,
schema
,
Constants
.
Channel
.
WECHAT
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
return
false
;
}
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
/**
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
,
schema
,
Constants
.
Channel
.
WECHAT
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
return
false
;
}
/**
* 通过redirect_url获取code
* 通过redirect_url获取code
*
*
* @param response
* @param response
...
@@ -394,20 +435,20 @@ public class WeChatController implements IBaseController {
...
@@ -394,20 +435,20 @@ public class WeChatController implements IBaseController {
String
schema
=
request
.
getScheme
();
String
schema
=
request
.
getScheme
();
LOGGER
.
info
(
"HTTP协议no redirect:"
+
schema
);
LOGGER
.
info
(
"HTTP协议no redirect:"
+
schema
);
// 从code获取token
// 从code获取token
normalLogin
(
code
,
systemKey
,
response
,
schema
);
normalLogin
(
code
,
systemKey
,
response
,
schema
);
}
}
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
,
String
schema
,
Long
registerFrom
)
{
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
,
String
schema
,
Long
registerFrom
)
{
//TODO 临时紧急上线修改的.下次上线的时候修复一下,不能这样写.
//TODO 临时紧急上线修改的.下次上线的时候修复一下,不能这样写.
String
url
=
schema
+
"//passport.xyqb.com"
;
String
url
=
schema
+
"//passport.xyqb.com"
;
if
(
StringUtils
.
isEmpty
(
redirect
)
||
"redirect"
.
equals
(
redirect
))
{
if
(
StringUtils
.
isEmpty
(
redirect
)
||
"redirect"
.
equals
(
redirect
))
{
LOGGER
.
info
(
"微信登录:redirect为null,走正常流程."
);
LOGGER
.
info
(
"微信登录:redirect为null,走正常流程."
);
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
,
url
,
Constants
.
Channel
.
WECHAT
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget5"
,
Constants
.
Channel
.
BAITIAO
,
url
,
Constants
.
Channel
.
WECHAT
);
}
else
{
}
else
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
,
url
,
registerFrom
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
,
url
,
registerFrom
);
}
}
}
else
if
(
"local"
.
equals
(
redirect
))
{
}
else
if
(
"local"
.
equals
(
redirect
))
{
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
Constants
.
Channel
.
WECHAT
,
""
,
user
,
merchant
);
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
url
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
LOGGER
.
info
(
"微信登录:跳转地址{}"
,
url
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
...
@@ -418,7 +459,7 @@ public class WeChatController implements IBaseController {
...
@@ -418,7 +459,7 @@ public class WeChatController implements IBaseController {
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
,
String
url
,
Long
registerFrom
)
{
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
,
String
url
,
Long
registerFrom
)
{
AuthBean
authBean
=
sessionService
.
createSession
(
channelId
,
registerFrom
,
""
,
user
,
merchant
);
AuthBean
authBean
=
sessionService
.
createSession
(
channelId
,
registerFrom
,
""
,
user
,
merchant
);
return
url
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
;
return
url
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
;
}
}
private
void
redirectWechatLoginUrlWithoutLogin
(
HttpServletResponse
response
,
Merchant
merchant
,
WechatUserInfo
userInfo
,
Long
registerFrom
)
{
private
void
redirectWechatLoginUrlWithoutLogin
(
HttpServletResponse
response
,
Merchant
merchant
,
WechatUserInfo
userInfo
,
Long
registerFrom
)
{
...
@@ -445,7 +486,7 @@ public class WeChatController implements IBaseController {
...
@@ -445,7 +486,7 @@ public class WeChatController implements IBaseController {
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
return
userUIAddr
+
"/landing?key=baitiao&target=cashTarget5®isterFrom=198&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
return
userUIAddr
+
"/landing?key=baitiao&target=cashTarget5®isterFrom=198&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
}
else
{
}
else
{
return
userUIAddr
+
"/landing?key=xyqb&target=cashTarget4®isterFrom= "
+
registerFrom
+
"&channelId=1&isWechat=true&openId="
+
userInfo
.
getOpenId
();
return
userUIAddr
+
"/landing?key=xyqb&target=cashTarget4®isterFrom= "
+
registerFrom
+
"&channelId=1&isWechat=true&openId="
+
userInfo
.
getOpenId
();
}
}
}
}
...
...
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