Commit 24137af2 authored by 竹天卫's avatar 竹天卫

优化访问链接

parent 91527e92
......@@ -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("非系统用户不允许登录!");
......
......@@ -22,7 +22,7 @@ public interface Global {
public final static String agentSecretPC = "itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A";
//编译后的回调地址
public final static String backUrl = "https%3a%2f%2fprogram.oxogroup.com%2flab-system";
public final static String backUrl = "https%3a%2f%2fccdcmtl.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>,";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment