Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
c990b5c6
Commit
c990b5c6
authored
Dec 25, 2024
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容多个小程序配置2
parent
89191dca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
...n/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
+4
-5
ch-core/src/main/java/com/wwdz/ch/core/config/QdWxConfig.java
...ore/src/main/java/com/wwdz/ch/core/config/QdWxConfig.java
+7
-4
No files found.
ch-core/src/main/java/com/wwdz/ch/core/api/qiandao/QdWxLoginManager.java
View file @
c990b5c6
...
@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSON;
...
@@ -7,7 +7,6 @@ import com.alibaba.fastjson.JSON;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.core.util.RedisUtils
;
import
com.wwdz.ch.db.dto.request.UserRequestDto
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserRequestDto
;
import
com.wwdz.ch.db.dto.request.qiandao.QdUserRequestDto
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -52,7 +51,7 @@ public class QdWxLoginManager {
...
@@ -52,7 +51,7 @@ public class QdWxLoginManager {
private
static
final
String
GET_LINK_URL
=
"https://api.weixin.qq.com/wxa/genwxashortlink?access_token=%s"
;
private
static
final
String
GET_LINK_URL
=
"https://api.weixin.qq.com/wxa/genwxashortlink?access_token=%s"
;
@Resource
(
name
=
"qdWxMaService"
)
@Resource
(
name
=
"qdWxMaService"
)
private
WxMaService
w
xMaService
;
private
WxMaService
qdW
xMaService
;
@Autowired
@Autowired
RedisUtils
redisUtils
;
RedisUtils
redisUtils
;
...
@@ -67,7 +66,7 @@ public class QdWxLoginManager {
...
@@ -67,7 +66,7 @@ public class QdWxLoginManager {
WxMaJscode2SessionResult
result
=
null
;
WxMaJscode2SessionResult
result
=
null
;
try
{
try
{
logger
.
info
(
">>>>>>>>> 获取微信openid, 参数loginCode:{}"
,
loginCode
);
logger
.
info
(
">>>>>>>>> 获取微信openid, 参数loginCode:{}"
,
loginCode
);
result
=
this
.
w
xMaService
.
getUserService
().
getSessionInfo
(
loginCode
);
result
=
this
.
qdW
xMaService
.
getUserService
().
getSessionInfo
(
loginCode
);
//实际获取的是unionid,为了和公众号订阅用户关联
//实际获取的是unionid,为了和公众号订阅用户关联
logger
.
info
(
"获取WxMaJscode2SessionResult :{}"
,
result
);
logger
.
info
(
"获取WxMaJscode2SessionResult :{}"
,
result
);
logger
.
info
(
"loginCode:{},获取openId成功 unionid :{}, openid:{}"
,
loginCode
,
result
.
getUnionid
(),
result
.
getOpenid
());
logger
.
info
(
"loginCode:{},获取openId成功 unionid :{}, openid:{}"
,
loginCode
,
result
.
getUnionid
(),
result
.
getOpenid
());
...
@@ -109,7 +108,7 @@ public class QdWxLoginManager {
...
@@ -109,7 +108,7 @@ public class QdWxLoginManager {
logger
.
info
(
"开始获取sessionKey-----------------------"
);
logger
.
info
(
"开始获取sessionKey-----------------------"
);
String
sessionKey
=
""
;
String
sessionKey
=
""
;
try
{
try
{
WxMaJscode2SessionResult
result
=
this
.
w
xMaService
.
getUserService
().
getSessionInfo
(
dto
.
getLoginCode
());
WxMaJscode2SessionResult
result
=
this
.
qdW
xMaService
.
getUserService
().
getSessionInfo
(
dto
.
getLoginCode
());
sessionKey
=
result
.
getSessionKey
();
sessionKey
=
result
.
getSessionKey
();
logger
.
info
(
"获取sessionKey结果:"
+
JSON
.
toJSONString
(
result
));
logger
.
info
(
"获取sessionKey结果:"
+
JSON
.
toJSONString
(
result
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -123,7 +122,7 @@ public class QdWxLoginManager {
...
@@ -123,7 +122,7 @@ public class QdWxLoginManager {
logger
.
info
(
"解析手机号加密信息-----------------------"
);
logger
.
info
(
"解析手机号加密信息-----------------------"
);
try
{
try
{
WxMaPhoneNumberInfo
wxMaPhoneNumberInfo
=
this
.
w
xMaService
.
getUserService
().
getPhoneNoInfo
(
sessionKey
,
dto
.
getEncryptedData
(),
dto
.
getIv
());
WxMaPhoneNumberInfo
wxMaPhoneNumberInfo
=
this
.
qdW
xMaService
.
getUserService
().
getPhoneNoInfo
(
sessionKey
,
dto
.
getEncryptedData
(),
dto
.
getIv
());
logger
.
info
(
"解析手机号加密信息结果:"
+
JSON
.
toJSONString
(
wxMaPhoneNumberInfo
));
logger
.
info
(
"解析手机号加密信息结果:"
+
JSON
.
toJSONString
(
wxMaPhoneNumberInfo
));
phone
=
wxMaPhoneNumberInfo
.
getPhoneNumber
();
phone
=
wxMaPhoneNumberInfo
.
getPhoneNumber
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
ch-core/src/main/java/com/wwdz/ch/core/config/QdWxConfig.java
View file @
c990b5c6
...
@@ -12,14 +12,16 @@ import org.springframework.beans.factory.annotation.Qualifier;
...
@@ -12,14 +12,16 @@ import org.springframework.beans.factory.annotation.Qualifier;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.Resource
;
@Configuration
@Configuration
public
class
QdWxConfig
{
public
class
QdWxConfig
{
@Autowired
@Autowired
private
QdWxProperties
qdWxProperties
;
private
QdWxProperties
qdWxProperties
;
@Bean
(
name
=
"qdWxMaConfig"
)
@Bean
@Qualifier
()
@Qualifier
(
"qdWxMaConfig"
)
public
WxMaConfig
qdWxMaConfig
()
{
public
WxMaConfig
qdWxMaConfig
()
{
WxMaInMemoryConfig
config
=
new
WxMaInMemoryConfig
();
WxMaInMemoryConfig
config
=
new
WxMaInMemoryConfig
();
config
.
setAppid
(
qdWxProperties
.
getQdAppId
());
config
.
setAppid
(
qdWxProperties
.
getQdAppId
());
...
@@ -27,8 +29,9 @@ public class QdWxConfig {
...
@@ -27,8 +29,9 @@ public class QdWxConfig {
return
config
;
return
config
;
}
}
@Bean
(
name
=
"qdWxMaService"
)
@Bean
public
WxMaService
qdWxMaService
(
WxMaConfig
qdWxMaConfig
)
{
@Qualifier
(
"qdWxMaService"
)
public
WxMaService
qdWxMaService
(
@Qualifier
(
"qdWxMaConfig"
)
WxMaConfig
qdWxMaConfig
)
{
WxMaService
service
=
new
WxMaServiceImpl
();
WxMaService
service
=
new
WxMaServiceImpl
();
service
.
setWxMaConfig
(
qdWxMaConfig
);
service
.
setWxMaConfig
(
qdWxMaConfig
);
return
service
;
return
service
;
...
...
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