|
|
@@ -122,7 +122,6 @@ public class CreateTokenUtil {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -208,55 +207,7 @@ public class CreateTokenUtil {
|
|
|
System.out.println("key:" + entry.getKey() + ":" + "value:" + entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
-// RestTemplate restTemplate = new RestTemplate();
|
|
|
-// MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>();
|
|
|
-// map.add("shopid","1");
|
|
|
-// HttpHeaders headers = new HttpHeaders();
|
|
|
-// headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
-// HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
|
|
|
-// String userInfoUrl = "https://open.wecard.qq.com/connect/oauth/get-user-info?access_token=" + access_token + "&scope=snsapi_base";
|
|
|
-// StringBuffer userInfoURl = new StringBuffer(userInfoUrl);
|
|
|
-// URI urm = URI.create(userInfoURl.toString());
|
|
|
-// ResponseEntity<String> responseEntity = restTemplate.postForEntity(urm, request, String.class);
|
|
|
-// userInfoJSON = JSON.parseObject(responseEntity.getBody());
|
|
|
-// for (Map.Entry<String, Object> entry : userInfoJSON.entrySet()) {
|
|
|
-// Object o = entry.getValue();
|
|
|
-// if (o instanceof String) {
|
|
|
-// System.out.println("key:"+entry.getKey()+":"+"value:"+entry.getValue());
|
|
|
-// }
|
|
|
-// }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
-
|
|
|
- return userInfoJSON;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 微校小程序H5页面 通过 access_token 获取 用户信息
|
|
|
- *
|
|
|
- * @param url
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONObject sendNotice(String url) {
|
|
|
- JSONObject userInfoJSON = null;
|
|
|
- try {
|
|
|
- RestTemplate restTemplate = new RestTemplate();
|
|
|
- MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
|
|
- map.add("shopid", "1");
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
- HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(map, headers);
|
|
|
- ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, request, String.class);
|
|
|
-
|
|
|
-
|
|
|
- userInfoJSON = JSON.parseObject(responseEntity.getBody());
|
|
|
-
|
|
|
|
|
|
-// StringBuffer unoticeURl = new StringBuffer(url);
|
|
|
-// URI urm = URI.create(unoticeURl.toString());
|
|
|
-// ResponseEntity<String> responsem = restTemplate.postForEntity(urm, httpEntity, String.class);
|
|
|
-// userInfoJSON = JSON.parseObject(responsem.getBody());
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -264,6 +215,7 @@ public class CreateTokenUtil {
|
|
|
return userInfoJSON;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取请求头中的数据
|
|
|
*
|
|
|
@@ -281,7 +233,7 @@ public class CreateTokenUtil {
|
|
|
map.put(key, value);
|
|
|
}
|
|
|
for (Map.Entry<String, String> entry : map.entrySet()) {
|
|
|
- if (entry.getKey().equals("access_token")) {
|
|
|
+ if (entry.getKey().equals("access_token")) {
|
|
|
access_token = entry.getValue();
|
|
|
}
|
|
|
}
|