- 调用微信接口获取带参二维码生成图片打不开,图片损坏
String access_token = this.getAccessTokenString(); //封装参数 Map<String, Object> parMap = new HashMap<String, Object>(); parMap.put("medicalOrgCode",medicalOrgCode); parMap.put("departmentCode",departmentCode); Gson gson = new Gson(); String scene = gson.toJson(parMap);//带参 if(width==null||width==0){ width = 430;//默认 } String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+access_token; Map<String,Object> param = new HashMap<>(); param.put("scene", parMap); param.put("page", "pages/index/index"); param.put("width", width); param.put("auto_color", false); Map<String,Object> line_color1 = new HashMap<>(); line_color1.put("r", 0); line_color1.put("g", 0); line_color1.put("b", 0); param.put("line_color", line_color); System.out.println("调用生成微信URL接口传参:" + param); MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); HttpEntity requestEntity = new HttpEntity(param, headers); RestTemplate rest = new RestTemplate(); ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); System.out.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody()); byte[] result = entity.getBody(); System.out.println(Base64.encodeBase64String(result)); InputStream instreams = new ByteArrayInputStream(result); String uploadSysUrl = "F:\\upload"+"/"; saveToImgByInputStream(instreams, uploadSysUrl, id+".jpg"); //保存图片到本地(代码没问题) String resUrl = ossService.uploadObject(instreams, "wxaqrcode/", id, FileUtils.getFileExt(".jpg")); //上传到阿里云 (代码没问题) 求解决
2018-01-11 - 微信小程序开发支持视频对话吗
本人公司正在开发小程序,可能会使用微信视频对话的功能,想问一下,小程序支持调微信视频的接口吗????
2017-12-19