@PostMapping("upload_feedback_images")
public LexJSONResult feedbackUploadImages(
@RequestParam("file") MultipartFile file, HttpServletRequest request) throws Exception {
log.info("【商户PC】1.17.7 图片上传接口");
String token = request.getHeader("token");
String clerkid = request.getHeader("clerkid");
if (!chekToken.isToken(token, clerkid, 11)) {
return LexJSONResult.errorTokenMsg("token错误!");
}
File file1 = FileHeUtils.multipartFileToFile(file);
System.out.println(file);
System.out.println(file1);
byte[] sha256 = DigestUtil.sha256(file1);
JSONObject meta = new JSONObject();
meta.put("filename", file.getOriginalFilename());
meta.put("sha256", sha256);
JSONObject body = new JSONObject();
body.put("file", file);
body.put("meta", meta);
String url = "https://api.mch.weixin.qq.com/v3/merchant-service/images/upload";
String Authorization = SignV3Utils.getSign("POST", url, meta.toString());
HashMap<String, String> header = new HashMap<>();
header.put("Authorization", Authorization);
header.put("Accept", "application/json");
header.put("Content-Type", "multipart/form-data");
HttpResponse resp = HttpRequest.post(url).form("file", file1).form("meta", meta).addHeaders(header).execute();
String result = resp.body();
JSONObject jsonObject = JSON.parseObject(result);
if (resp.getStatus() == 200) {
return LexJSONResult.ok(jsonObject);
}
return LexJSONResult.build(201, null, jsonObject);
}
、
这个media_id也调不了图片请求接口,为啥,求大神求解(保佑)
查询投诉单列表获取到的mediaUrl后,我需要获取到图片,应该怎么操作
查询接口返回的id才能调用图片请求接口