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
624f004e
Commit
624f004e
authored
Oct 12, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取openid
parent
c15a08d6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
.../src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
+2
-2
ch-wx-api/src/test/java/com/wwdz/ch/wx/manager/WxLoginManagerTest.java
.../test/java/com/wwdz/ch/wx/manager/WxLoginManagerTest.java
+24
-0
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
View file @
624f004e
...
...
@@ -54,9 +54,9 @@ public class WxLoginManager {
try
{
WxMaJscode2SessionResult
result
=
this
.
wxMaService
.
getUserService
().
getSessionInfo
(
loginCode
);
openId
=
result
.
getOpenid
();
logger
.
info
(
"
获取openId成功 openId :{}"
,
openId
);
logger
.
info
(
"
loginCode:{},获取openId成功 openId :{}"
,
loginCode
,
openId
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"
获取微信登录用户的openId失败"
,
e
);
logger
.
error
(
"
loginCode:{}, 获取微信登录用户的openId失败:{}"
,
loginCode
,
e
);
}
return
openId
;
}
...
...
ch-wx-api/src/test/java/com/wwdz/ch/wx/manager/WxLoginManagerTest.java
0 → 100644
View file @
624f004e
package
com.wwdz.ch.wx.manager
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
junit
.
Assert
.*;
@SpringBootTest
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
public
class
WxLoginManagerTest
{
@Autowired
WxLoginManager
wxLoginManager
;
@Test
public
void
getWxOpenId
()
{
String
code
=
"0c3ngB000UtjQQ1LBJ000kE8X02ngB0L"
;
wxLoginManager
.
getWxOpenId
(
code
);
}
}
\ No newline at end of file
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