Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
order-group-application
order-group
Commits
72cae5aa
Commit
72cae5aa
authored
Nov 17, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 token的刷新机制
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
cefeab39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
order-application-service/src/main/java/cn/freemud/handler/WeChatLiveMsgHandle.java
+5
-6
No files found.
order-application-service/src/main/java/cn/freemud/handler/WeChatLiveMsgHandle.java
View file @
72cae5aa
...
@@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -59,6 +56,8 @@ public class WeChatLiveMsgHandle {
...
@@ -59,6 +56,8 @@ public class WeChatLiveMsgHandle {
@Autowired
@Autowired
private
RedisCache
redisCache
;
private
RedisCache
redisCache
;
private
List
<
String
>
refresList
=
Arrays
.
asList
(
"42001"
,
"40001"
);
/**
/**
* @param orderBean
* @param orderBean
* @param flag 0 支付成功
* @param flag 0 支付成功
...
@@ -95,7 +94,7 @@ public class WeChatLiveMsgHandle {
...
@@ -95,7 +94,7 @@ public class WeChatLiveMsgHandle {
WeChatClient
weChatClient
=
new
WeChatClient
();
WeChatClient
weChatClient
=
new
WeChatClient
();
WeChatBaseResponse
<
NullFieldVo
>
weChatBaseResponse
=
weChatClient
.
orderApply
(
accessToken
,
request
,
WeChatConstant
.
OrderMethod
.
ORDER_PAY
);
WeChatBaseResponse
<
NullFieldVo
>
weChatBaseResponse
=
weChatClient
.
orderApply
(
accessToken
,
request
,
WeChatConstant
.
OrderMethod
.
ORDER_PAY
);
if
(
"42001"
.
equal
s
(
weChatBaseResponse
.
getErrcode
()))
{
if
(
refresList
.
contain
s
(
weChatBaseResponse
.
getErrcode
()))
{
accessToken
=
this
.
refreshAccessToken
(
orderBean
.
getAppId
(),
orderBean
.
getParentCode
());
accessToken
=
this
.
refreshAccessToken
(
orderBean
.
getAppId
(),
orderBean
.
getParentCode
());
weChatBaseResponse
=
weChatClient
.
orderApply
(
accessToken
,
request
,
WeChatConstant
.
OrderMethod
.
ORDER_PAY
);
weChatBaseResponse
=
weChatClient
.
orderApply
(
accessToken
,
request
,
WeChatConstant
.
OrderMethod
.
ORDER_PAY
);
}
}
...
@@ -148,7 +147,7 @@ public class WeChatLiveMsgHandle {
...
@@ -148,7 +147,7 @@ public class WeChatLiveMsgHandle {
}
}
// 处理 token失败的情况 42001 表示 accesstoken 有问题 重新调用一遍
// 处理 token失败的情况 42001 表示 accesstoken 有问题 重新调用一遍
if
(
"42001"
.
equal
s
(
weChatBaseResponse
.
getErrcode
()))
{
if
(
refresList
.
contain
s
(
weChatBaseResponse
.
getErrcode
()))
{
String
accessTokenNew
=
this
.
refreshAccessToken
(
createPrepayRequestDto
.
getWxAppId
(),
createPrepayRequestDto
.
getPartnerId
());
String
accessTokenNew
=
this
.
refreshAccessToken
(
createPrepayRequestDto
.
getWxAppId
(),
createPrepayRequestDto
.
getPartnerId
());
WeChatBaseResponse
<
OrderCreateResponseVO
>
agResponse
=
weChatClient
.
orderApply
(
accessTokenNew
,
requestVO
,
WeChatConstant
.
OrderMethod
.
ORDER_ADD
);
WeChatBaseResponse
<
OrderCreateResponseVO
>
agResponse
=
weChatClient
.
orderApply
(
accessTokenNew
,
requestVO
,
WeChatConstant
.
OrderMethod
.
ORDER_ADD
);
...
...
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