记得上下班打卡 | git大法好,push需谨慎

Commit 76d1149f authored by 张国柄's avatar 张国柄

fix:config:adam wechat;

parent 326c807e
......@@ -337,12 +337,12 @@ public class AdamLoginController {
public ResponseDto<String> wxaCode2Session(@RequestParam String jsCode) {
String openId = null;
try {
// String url = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";
String url = AdamWechatConst.API_URL_JS_CODE2SESSION.replace("APPID", AdamWechatConst.zhengzaiAppletAppid)
.replace("SECRET", AdamWechatConst.zhengzaiAppletSecret).replace("JSCODE", jsCode);
String respJStr = HttpUtil.get(url, null);
JsonNode respJNode = JsonUtils.fromJson(respJStr, JsonNode.class);
if (null == respJNode) {
if (null == respJNode || !respJNode.get("errcode").textValue().equalsIgnoreCase("0")) {
log.warn("WX.API调用失败[{}]", respJStr);
return ResponseDto.success(null);
}
openId = respJNode.get("openid").asText();
......@@ -358,12 +358,12 @@ public class AdamLoginController {
public ResponseDto<String> wxOauth2AccessToken(@RequestParam String code) {
String openId = null;
try {
// String url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
String url = AdamWechatConst.API_URL_OAUTH2_ACCESS_TOKEN.replace("APPID", AdamWechatConst.zhengzaiServiceAppid)
.replace("SECRET", AdamWechatConst.zhengzaiServiceSecret).replace("CODE", code);
String respJStr = HttpUtil.get(url, null);
JsonNode respJNode = JsonUtils.fromJson(respJStr, JsonNode.class);
if (null == respJNode || !respJNode.get("errcode").isEmpty()) {
if (null == respJNode || !respJNode.get("errcode").textValue().equalsIgnoreCase("0")) {
log.warn("WX.API调用失败[{}]", respJStr);
return ResponseDto.success(null);
}
openId = respJNode.get("openid").asText();
......
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