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
568b4a02
Commit
568b4a02
authored
Jan 19, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构微信服务接口代码
parent
0c52ce53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
228 deletions
+123
-228
WeChatController.java
...group/xyqb/controller/external/user/WeChatController.java
+123
-228
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/user/WeChatController.java
View file @
568b4a02
...
...
@@ -17,7 +17,6 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.TypeReference
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -25,21 +24,15 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.Arrays
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
/**
* Created by 11 on 2017/1/17.
...
...
@@ -66,12 +59,19 @@ public class WeChatController implements IBaseController {
@Autowired
private
IUserService
userService
;
// https://passport.xyqb.com/landing?key=xxx&target=cashTarget5®isterFrom=198&channelId=%d
/**
* 用户中心UI的http协议头域名
* http://passport.xyqb.com
*/
@Value
(
"${passport.http}"
)
private
String
userU
IAddr
;
private
String
userU
iDomain
;
@Value
(
"${passport.http}"
)
private
String
userDomainStr
;
/**
* 用户中心UI的https协议头域名
* https://passport.xyqb.com
*/
@Value
(
"${passport.https}"
)
private
String
userUiDomainS
;
@Value
(
"${api.http}"
)
private
String
xyqbDomainStr
;
...
...
@@ -79,10 +79,6 @@ public class WeChatController implements IBaseController {
@Autowired
private
IHttpService
httpService
;
//加https地址
@Value
(
"${passport.https}"
)
private
String
userUIAddrS
;
/**
* 开发者资质认证,有必要吗?
*
...
...
@@ -169,183 +165,101 @@ public class WeChatController implements IBaseController {
* @return
*/
@RequestMapping
(
"/receiveCode/extdata/{key}/{extdata}"
)
public
void
receiveCodeWithExtData
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
(
value
=
"extdata"
)
String
extData
,
HttpServletResponse
response
)
{
public
void
receiveCodeWithExtData
(
String
code
,
@PathVariable
(
value
=
"key"
)
String
systemKey
,
@PathVariable
(
value
=
"extdata"
)
String
extData
,
HttpServletResponse
response
)
{
Long
registerFrom
=
null
;
String
redirect
=
null
;
String
schema
=
null
;
try
{
String
schema
=
getProtocol
();
try
{
extData
=
new
String
(
Base64
.
decodeBase64
(
extData
),
"UTF-8"
);
}
catch
(
Exception
ex
)
{
extData
=
""
;
}
String
protocol
=
"http:"
;
LOGGER
.
info
(
"从微信extdata版本接口进入:{}, extData:{}"
,
schema
,
extData
);
if
(
StringUtils
.
isEmpty
(
extData
))
{
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
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
,
protocol
);
return
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
,
schema
,
Constants
.
Channel
.
WECHAT
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
else
{
HashMap
<
String
,
Object
>
extDataObj
;
try
{
extDataObj
=
JSON
.
parseObject
(
extData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>()
{
});
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"解析extData发生错误"
,
ex
);
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
extData
=
new
String
(
Base64
.
decodeBase64
(
extData
),
"UTF-8"
);
}
catch
(
Exception
ex
)
{
extData
=
""
;
}
if
(
StringUtils
.
isBlank
(
extData
))
{
receiveCodeWithDefault
(
code
,
systemKey
,
schema
,
registerFrom
,
redirect
,
response
);
return
;
}
LOGGER
.
info
(
"从微信extdata版本接口进入:{}, extData:{}"
,
schema
,
extData
);
HashMap
<
String
,
Object
>
extDataObj
;
try
{
extDataObj
=
JSON
.
parseObject
(
extData
,
new
TypeReference
<
HashMap
<
String
,
Object
>>(){});
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"解析extData发生错误"
,
ex
);
receiveCodeWithDefault
(
code
,
systemKey
,
schema
,
registerFrom
,
redirect
,
response
);
return
;
}
schema
=
extDataObj
.
getOrDefault
(
"protocol"
,
"http:"
).
toString
();
LOGGER
.
info
(
"从微信登录extData中获得协议信息,protocol:{}"
,
schema
);
registerFrom
=
Long
.
valueOf
(
extDataObj
.
getOrDefault
(
"registerFrom"
,
"1"
).
toString
());
redirect
=
(
String
)
extDataObj
.
getOrDefault
(
"redirect"
,
"redirect"
);
LOGGER
.
info
(
"从微信登录,registerFrom:{}, redirect:{}"
,
registerFrom
,
redirect
);
receiveCodeWithDefault
(
code
,
systemKey
,
schema
,
registerFrom
,
redirect
,
response
);
}
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
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
,
protocol
);
return
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
Constants
.
Channel
.
WECHAT
,
protocol
);
return
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
""
,
schema
,
Constants
.
Channel
.
WECHAT
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
return
;
}
/**
* 前端微信跳转页面
* @param code
* @param systemKey
* @param schema
* @param registerFrom
* @param redirect
* @param response
*/
private
void
receiveCodeWithDefault
(
String
code
,
String
systemKey
,
String
schema
,
Long
registerFrom
,
String
redirect
,
HttpServletResponse
response
){
/*
* 预处理(容错)
*/
registerFrom
=
Optional
.
ofNullable
(
registerFrom
).
orElse
(
Constants
.
Channel
.
WECHAT
);
redirect
=
Optional
.
ofNullable
(
redirect
).
orElse
(
""
);
schema
=
StringUtils
.
isBlank
(
schema
)
?
getProtocol
()
:
schema
;
String
domain
=
userUiDomain
;
if
(
Objects
.
equals
(
schema
,
"https:"
)){
domain
=
userUiDomainS
;
}
protocol
=
extDataObj
.
getOrDefault
(
"protocol"
,
"http:"
).
toString
();
LOGGER
.
info
(
"从微信登录extData中获得协议信息,protocol:{}"
,
protocol
);
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
,
protocol
);
return
;
}
WechatUserInfo
userInfo
=
// 从code获取token
Merchant
merchant
=
merchantService
.
findMerchantByName
(
systemKey
);
AccessTokenResponse
token
=
wechatService
.
getToken
(
code
);
if
(
token
==
null
)
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
,
domain
);
return
;
}
WechatUserInfo
userInfo
=
wechatService
.
getWechatUserInfoFromWechatServer
(
token
.
getAccessToken
(),
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
,
protocol
);
return
;
}
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
,
protocol
);
return
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
,
protocol
);
return
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
,
protocol
);
return
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
,
schema
,
registerFrom
);
LOGGER
.
info
(
"Location:[{}]"
,
redirectUrl
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
token
.
getOpenId
());
if
(
userInfo
==
null
||
StringUtils
.
isEmpty
(
userInfo
.
getOpenId
()))
{
// 让用户登录,不关联微信, 构造不关联微信的url
redirectNormalUrl
(
response
,
merchant
,
registerFrom
,
domain
);
return
;
}
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
);
}
}
catch
(
Exception
ex
)
{
LOGGER
.
error
(
"发生异常"
,
ex
);
throw
ex
;
userInfo
=
wechatService
.
saveWechatUserInfo
(
userInfo
);
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfo
,
registerFrom
,
domain
);
return
;
}
if
(
userInfoInDb
.
getUserId
()
==
null
)
{
// 用户已经微信登录了,但是没有关联信用钱包,跳转到注册页面
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
,
domain
);
return
;
}
User
user
=
userService
.
findById
(
userInfoInDb
.
getUserId
());
if
(
user
==
null
)
{
redirectWechatLoginUrlWithoutLogin
(
response
,
merchant
,
userInfoInDb
,
registerFrom
,
domain
);
return
;
}
// 已经关联了用户
// create session, 登进去,该怎么玩怎么玩。
String
redirectUrl
=
createUserSession
(
user
,
merchant
,
redirect
,
schema
,
registerFrom
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
/**
...
...
@@ -404,92 +318,73 @@ public class WeChatController implements IBaseController {
response
.
setStatus
(
301
);
}
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
,
String
schema
,
Long
registerFrom
)
{
//String url = "http://passport.xyqb.com";
String
url
=
"http://"
+
userDomainStr
;
if
(
"https:"
.
equals
(
schema
))
{
url
=
"https://"
+
userDomainStr
;
}
private
String
createUserSession
(
User
user
,
Merchant
merchant
,
String
redirect
,
String
domain
,
Long
registerFrom
)
{
if
(
StringUtils
.
isEmpty
(
redirect
)
||
"redirect"
.
equals
(
redirect
))
{
LOGGER
.
info
(
"微信登录:redirect为null,走正常流程."
);
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
,
domain
,
Constants
.
Channel
.
WECHAT
);
}
else
if
(
"wechat-pay"
.
equals
(
merchant
.
getName
()))
{
AuthBean
authBean
=
sessionService
.
createSession
(
Constants
.
Channel
.
WECHAT
,
registerFrom
,
""
,
user
,
merchant
);
return
url
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
Constants
.
Channel
.
WECHAT
+
"&key="
+
merchant
.
getName
()
+
"&target=cashTarget5"
;
return
domain
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
Constants
.
Channel
.
WECHAT
+
"&key="
+
merchant
.
getName
()
+
"&target=cashTarget5"
;
}
else
{
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
,
url
,
registerFrom
);
return
loginInWechatWithSessionCreated
(
user
,
merchant
,
"cashTarget4"
,
1L
,
domain
,
registerFrom
);
}
}
else
if
(
"local"
.
equals
(
redirect
))
{
LOGGER
.
info
(
"微信登录:redirect不为null,创建session跳到指定前端页面."
);
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
(
"微信登录:跳转地址{}"
,
domain
+
"/weixin/callback?phoneNo="
+
user
.
getPhoneNo
()
+
"&token="
+
authBean
.
getToken
());
Long
channelId
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
222L
:
1L
;
String
target
=
"baitiao"
.
equals
(
merchant
.
getName
())
?
"cashTarget5"
:
"cashTarget4"
;
return
url
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
return
domain
+
"/landing?token="
+
authBean
.
getToken
()
+
"®isterFrom="
+
registerFrom
+
"&channelId="
+
channelId
+
"&key="
+
merchant
.
getName
()
+
"&target="
+
target
+
"&isWechat=true"
;
}
return
null
;
}
private
String
loginInWechatWithSessionCreated
(
User
user
,
Merchant
merchant
,
String
target
,
Long
channelId
,
String
url
,
Long
registerFrom
)
{
AuthBean
authBean
=
sessionService
.
createSession
(
channelId
,
registerFrom
,
""
,
user
,
merchant
);
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
,
String
protocol
)
{
String
redirectUrl
=
assembleWechatRedirectUrl
(
merchant
,
userInfo
,
registerFrom
,
protocol
);
private
void
redirectWechatLoginUrlWithoutLogin
(
HttpServletResponse
response
,
Merchant
merchant
,
WechatUserInfo
userInfo
,
Long
registerFrom
,
String
domain
)
{
String
redirectUrl
=
assembleWechatRedirectUrl
(
merchant
,
userInfo
,
registerFrom
,
domain
);
LOGGER
.
info
(
"redirectWechatLoginUrlWithoutLogin redirectUrl:[{}]"
,
redirectUrl
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
private
void
redirectNormalUrl
(
HttpServletResponse
response
,
Merchant
merchant
,
Long
registerFrom
,
String
protocol
)
{
String
redirectUrl
=
assembleNormalRedirectUrl
(
merchant
,
registerFrom
,
protocol
);
private
void
redirectNormalUrl
(
HttpServletResponse
response
,
Merchant
merchant
,
Long
registerFrom
,
String
domain
)
{
String
redirectUrl
=
assembleNormalRedirectUrl
(
merchant
,
registerFrom
,
domain
);
LOGGER
.
info
(
"redirectNormalUrl redirectUrl:[{}]"
,
redirectUrl
);
response
.
setHeader
(
"Location"
,
redirectUrl
);
response
.
setStatus
(
301
);
}
private
String
assembleNormalRedirectUrl
(
Merchant
merchant
,
Long
registerFrom
,
String
protocol
)
{
String
domains
=
userUIAddr
;
if
(
protocol
!=
null
&&
protocol
.
equals
(
"https:"
)){
domains
=
userUIAddrS
;
}
private
String
assembleNormalRedirectUrl
(
Merchant
merchant
,
Long
registerFrom
,
String
domain
)
{
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
if
(
registerFrom
==
58
l
||
registerFrom
==
198
l
){
return
domain
s
+
"/landing?key=baitiao&target=cashTarget5&channelId=222®isterFrom="
+
registerFrom
;
if
(
registerFrom
==
58L
||
registerFrom
==
198L
){
return
domain
+
"/landing?key=baitiao&target=cashTarget5&channelId=222®isterFrom="
+
registerFrom
;
}
else
{
return
domain
s
+
"/landing?key=baitiao&target=cashTarget5&channelId=222®isterFrom=198"
;
return
domain
+
"/landing?key=baitiao&target=cashTarget5&channelId=222®isterFrom=198"
;
}
}
else
if
(
"wechat-pay"
.
equals
(
merchant
.
getName
()))
{
return
domain
s
+
"/landing?key=wechat-pay&target=cashTarget5&channelId=1&page=landing/4®isterFrom"
+
registerFrom
;
return
domain
+
"/landing?key=wechat-pay&target=cashTarget5&channelId=1&page=landing/4®isterFrom"
+
registerFrom
;
}
else
{
return
domain
s
+
"/landing?key=xyqb&target=cashTarget4&channelId=1®isterFrom="
+
registerFrom
;
return
domain
+
"/landing?key=xyqb&target=cashTarget4&channelId=1®isterFrom="
+
registerFrom
;
}
}
private
String
assembleWechatRedirectUrl
(
Merchant
merchant
,
WechatUserInfo
userInfo
,
Long
registerFrom
,
String
protocol
)
{
String
domains
=
userUIAddr
;
if
(
protocol
!=
null
&&
protocol
.
equals
(
"https:"
)){
domains
=
userUIAddrS
;
}
private
String
assembleWechatRedirectUrl
(
Merchant
merchant
,
WechatUserInfo
userInfo
,
Long
registerFrom
,
String
domain
)
{
if
(
"baitiao"
.
equals
(
merchant
.
getName
()))
{
if
(
registerFrom
==
58
l
||
registerFrom
==
198
l
){
return
domains
+
"/landing?key=baitiao&target=cashTarget5®isterFrom="
+
registerFrom
+
"&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
if
(
registerFrom
==
58L
||
registerFrom
==
198L
){
return
domain
+
"/landing?key=baitiao&target=cashTarget5®isterFrom="
+
registerFrom
+
"&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
}
else
{
return
domain
s
+
"/landing?key=baitiao&target=cashTarget5®isterFrom=198&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
return
domain
+
"/landing?key=baitiao&target=cashTarget5®isterFrom=198&channelId=222&isWechat=true&openId="
+
userInfo
.
getOpenId
();
}
}
else
if
(
"wechat-pay"
.
equals
(
merchant
.
getName
()))
{
return
domain
s
+
"/landing?key=wechat-pay&target=cashTarget5&page=landing/4®isterFrom= "
+
registerFrom
+
"&channelId=1&isWechat=true&openId="
+
userInfo
.
getOpenId
();
return
domain
+
"/landing?key=wechat-pay&target=cashTarget5&page=landing/4®isterFrom= "
+
registerFrom
+
"&channelId=1&isWechat=true&openId="
+
userInfo
.
getOpenId
();
}
else
{
return
domain
s
+
"/landing?key=xyqb&target=cashTarget4®isterFrom= "
+
registerFrom
+
"&channelId=1&isWechat=true&openId="
+
userInfo
.
getOpenId
();
return
domain
+
"/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