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
245334b8
Commit
245334b8
authored
Oct 26, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取token
parent
62569629
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
ch-core/src/main/resources/application-prod.yml
ch-core/src/main/resources/application-prod.yml
+1
-1
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
.../src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
+10
-3
No files found.
ch-core/src/main/resources/application-prod.yml
View file @
245334b8
...
...
@@ -19,7 +19,7 @@ dts:
officialaccount-secret
:
daecb3de53841fe1a787bc9849ac3406
officialaccount-token
:
Uu6GHYOiP1xJ6GaBMyXfnITufAGJTe3Q
officialaccount-key
:
noeN1amYRvzrVmE2GnC5VnsIfgPEmv6bhX54wJOARlM
get-officialaccount-accesstoken-url
:
https://api.weixin.qq.com/cgi-bin/stable_token
?grant_type=client_credential&appid=%s&secret=%s
get-officialaccount-accesstoken-url
:
https://api.weixin.qq.com/cgi-bin/stable_token
#腾讯IM配置
im
:
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
View file @
245334b8
...
...
@@ -159,15 +159,22 @@ public class WxLoginManager {
public
String
refreshAccessToken
()
{
logger
.
info
(
"开始获取小程序access_token----------------"
);
try
{
String
accessTokenUrl
=
String
.
format
(
GET_ACCESS_TOKEN_URL
,
APPLET_APPID
,
APPLET_APP_SECRET
)
;
String
accessTokenUrl
=
null
;
String
res
=
null
;
logger
.
info
(
"取调用凭证access_token url :{}"
,
accessTokenUrl
);
//正式环境的url中包含了"stable_token", 要使用post请求, 测试环境是get请求
if
(!
GET_ACCESS_TOKEN_URL
.
contains
(
"stable_token"
))
{
accessTokenUrl
=
String
.
format
(
GET_ACCESS_TOKEN_URL
,
APPLET_APPID
,
APPLET_APP_SECRET
);
logger
.
info
(
"取调用凭证access_token url :{}"
,
accessTokenUrl
);
res
=
OkHttpUtil
.
builder
().
url
(
accessTokenUrl
)
.
get
().
sync
();
}
else
{
res
=
OkHttpUtil
.
builder
().
url
(
accessTokenUrl
)
accessTokenUrl
=
GET_ACCESS_TOKEN_URL
;
logger
.
info
(
"取调用凭证access_token url :{}"
,
accessTokenUrl
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"grant_type"
,
"client_credential"
);
map
.
put
(
"appid"
,
APPLET_APPID
);
map
.
put
(
"secret"
,
APPLET_APP_SECRET
);
res
=
OkHttpUtil
.
builder
().
addParams
(
map
).
url
(
accessTokenUrl
)
.
post
(
true
).
sync
();
}
logger
.
info
(
"获取小程序access_token结果:"
+
res
);
...
...
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