Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
tianjin-cement
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
竹天卫
tianjin-cement
Commits
24137af2
Commit
24137af2
authored
Nov 10, 2020
by
竹天卫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化访问链接
parent
91527e92
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
21 deletions
+21
-21
WeiXinService.java
...n/wise/sc/cement/business/service/impl/WeiXinService.java
+20
-20
Global.java
...n/java/cn/wise/sc/cement/business/util/weixin/Global.java
+1
-1
No files found.
cement-business/src/main/java/cn/wise/sc/cement/business/service/impl/WeiXinService.java
View file @
24137af2
...
...
@@ -50,27 +50,27 @@ public class WeiXinService {
System
.
out
.
println
(
"==================code==================="
);
System
.
out
.
println
(
code
);
try
{
//
String accessToken = null;
//
if (type.equals("PC")) {
//
accessToken = getAccessToken();
//
} else if (type.equals("APP")) {
//
accessToken = getPCAccessToken();
//
} else {
//
return BaseResponse.errorMsg("参数错误");
//
}
//
String param = "access_token=%s&code=%s";
//
param = String.format(param, accessToken, code);
//
JSONObject jsonObject = WeixinInterfaceUtil.doGet(Global.USERINFOURL, param);
//
if (jsonObject.get("errcode").toString().equals("40029")) {
//
return BaseResponse.errorMsg("code失效!");
//
}
//
String UserId = jsonObject.getString("UserId");
//
System.out.println("==================UserId===================");
//
System.out.println(UserId);
//
JSONObject userJson = getUser(accessToken, UserId);
String
accessToken
=
null
;
if
(
type
.
equals
(
"PC"
))
{
accessToken
=
getAccessToken
();
}
else
if
(
type
.
equals
(
"APP"
))
{
accessToken
=
getPCAccessToken
();
}
else
{
return
BaseResponse
.
errorMsg
(
"参数错误"
);
}
String
param
=
"access_token=%s&code=%s"
;
param
=
String
.
format
(
param
,
accessToken
,
code
);
JSONObject
jsonObject
=
WeixinInterfaceUtil
.
doGet
(
Global
.
USERINFOURL
,
param
);
if
(
jsonObject
.
get
(
"errcode"
).
toString
().
equals
(
"40029"
))
{
return
BaseResponse
.
errorMsg
(
"code失效!"
);
}
String
UserId
=
jsonObject
.
getString
(
"UserId"
);
System
.
out
.
println
(
"==================UserId==================="
);
System
.
out
.
println
(
UserId
);
JSONObject
userJson
=
getUser
(
accessToken
,
UserId
);
QueryWrapper
<
SysUser
>
wrapper
=
new
QueryWrapper
<>();
//
wrapper.eq("phone", userJson.get("mobile"));
wrapper
.
eq
(
"phone"
,
code
);
//暂时用手机号代替code
wrapper
.
eq
(
"phone"
,
userJson
.
get
(
"mobile"
));
//
wrapper.eq("phone", code); //暂时用手机号代替code
SysUser
sysUser
=
userService
.
getOne
(
wrapper
);
if
(
sysUser
==
null
)
{
return
BaseResponse
.
errorMsg
(
"非系统用户不允许登录!"
);
...
...
cement-business/src/main/java/cn/wise/sc/cement/business/util/weixin/Global.java
View file @
24137af2
...
...
@@ -22,7 +22,7 @@ public interface Global {
public
final
static
String
agentSecretPC
=
"itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A"
;
//编译后的回调地址
public
final
static
String
backUrl
=
"https%3a%2f%2f
program.oxogroup
.com%2flab-system"
;
public
final
static
String
backUrl
=
"https%3a%2f%2f
ccdcmtl.sinoma-tianjin
.com%2flab-system"
;
//实验室管理系统链接
public
final
static
String
systemUrl
=
"<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
+
corpId
+
"&redirect_uri="
+
backUrl
+
"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">天津院实验室管理系统"
+
"</a>,"
;
...
...
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