Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5d905504
authored
Apr 25, 2021
by
孙喜旺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
代码还原
1 parent
74078da5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeiXinAuthInterceptor.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/wxclient/WxAuthClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeiXinAuthInterceptor.java
View file @
5d90550
...
...
@@ -56,21 +56,20 @@ public class WeiXinAuthInterceptor implements Interceptor {
private
String
findAccessToken
(
String
openId
){
//获取用户token
String
accessToken
=
redisCache
.
getCacheObject
(
WeConstans
.
WX_AUTH_ACCESS_TOKEN
+
":"
+
openId
);
if
(
StringUtils
.
isEmpty
(
accessToken
)
){
WxTokenDto
wxTokenDto
=
redisCache
.
getCacheObject
(
WeConstans
.
WX_AUTH_ACCESS_TOKEN
+
":"
+
openId
);
if
(
wxTokenDto
==
null
){
//当用户token失效,则获取refreshToken
String
refreshToken
=
redisCache
.
getCacheObject
(
WeConstans
.
WX_AUTH_REFRESH_ACCESS_TOKEN
+
":"
+
openId
);
if
(
StringUtils
.
isEmpty
(
refreshToken
)){
throw
new
WeComException
(
1001
,
"token失效,请重新授权"
);
}
else
{
WxTokenDto
wxTokenDto
=
wxAuthClient
.
refreshToken
(
appId
,
secret
,
grantType
,
refreshToken
);
wxTokenDto
=
wxAuthClient
.
refreshToken
(
appId
,
grantType
,
refreshToken
);
if
(
wxTokenDto
!=
null
&&
StringUtils
.
isNotEmpty
(
wxTokenDto
.
getAccessToken
())){
redisCache
.
setCacheObject
(
WeConstans
.
WX_AUTH_ACCESS_TOKEN
+
":"
+
openId
,
wxTokenDto
.
getAccessToken
(),
wxTokenDto
.
getExpiresIn
(),
TimeUnit
.
SECONDS
);
accessToken
=
wxTokenDto
.
getAccessToken
();
redisCache
.
setCacheObject
(
WeConstans
.
WX_AUTH_ACCESS_TOKEN
+
":"
+
openId
,
wxTokenDto
,
wxTokenDto
.
getExpiresIn
(),
TimeUnit
.
SECONDS
);
}
}
}
return
accessToken
;
return
wxTokenDto
.
getAccessToken
()
;
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
5d90550
...
...
@@ -74,15 +74,15 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePushDto
)
throws
JsonProcessingException
,
ParseException
{
//
if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
//
&& DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
//
throw new WeComException("发送时间不能小于当前时间");
//
}
if
((
null
!=
customerMessagePushDto
.
getSettingTime
()
&&
!
""
.
equals
(
customerMessagePushDto
.
getSettingTime
()))
&&
DateUtils
.
diffTime
(
new
Date
(),
DateUtil
.
parse
(
customerMessagePushDto
.
getSettingTime
(),
"yyyy-MM-dd HH:mm"
))
>
0
)
{
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
}
if
(
StrUtil
.
isBlank
(
customerMessagePushDto
.
getSettingTime
())){
/*
if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
throw new WeComException("发送时间不能为空");
}
}
*/
List
<
WeCustomer
>
customers
=
Lists
.
newArrayList
();
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/wxclient/WxAuthClient.java
View file @
5d90550
...
...
@@ -31,15 +31,13 @@ public interface WxAuthClient {
/**
* 刷新access_token
*
*
* @param id
* @param appId 公众号的唯一标识
* @param grantType 填写为refresh_token
* @param refreshToken 填写通过access_token获取到的refresh_token参数
* @return
*/
@Request
(
url
=
"/oauth2/refresh_token"
,
type
=
"GET"
)
WxTokenDto
refreshToken
(
String
id
,
@Query
(
"appid"
)
String
appId
,
@Query
(
"grant_type"
)
String
grantType
,
WxTokenDto
refreshToken
(
@Query
(
"appid"
)
String
appId
,
@Query
(
"grant_type"
)
String
grantType
,
@Query
(
"refresh_token"
)
String
refreshToken
);
/**
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment