public String getCode(String jsCode) { try { String url= "http://www.baidu.com" ResponseEntity responseEntity = restTemplate.getForEntity(url, WeChatSessionVo.class); if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { log.info("返回body为:{}", JacksonTool.toJson(responseEntity.getBody())); WeChatSessionVo vo= (WeChatSessionVo) responseEntity.getBody(); return vo.getOpenid(); } } catch (Exception e) { log.error("信息出错,jsCode:{}", jsCode, e); } return null; }
标签:WeChatSessionVo,String,restTemplate,vo,responseEntity,使用,jsCode From: https://www.cnblogs.com/niun/p/16711267.html