Commit f814c849 by 袁伟铭

1.0.0

parent c9f0ee97
package com.zq.common.utils; package com.zq.common.utils;
import cn.hutool.core.codec.Base64;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jfinal.weixin.sdk.api.AccessToken; import com.jfinal.weixin.sdk.api.AccessToken;
...@@ -32,7 +33,7 @@ import java.util.Map; ...@@ -32,7 +33,7 @@ import java.util.Map;
@Slf4j @Slf4j
@Data @Data
public class WeiXinUtils { public class WeixinUtils {
// 小程序发送红包的请求 // 小程序发送红包的请求
private String sendminiprogramhb = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendminiprogramhb"; private String sendminiprogramhb = "https://api.mch.weixin.qq.com/mmpaymkttransfers/sendminiprogramhb";
...@@ -59,11 +60,12 @@ public class WeiXinUtils { ...@@ -59,11 +60,12 @@ public class WeiXinUtils {
Map<String, String> header = new HashMap<>(); Map<String, String> header = new HashMap<>();
header.put("Content-type", "application/json; charset=utf-8"); header.put("Content-type", "application/json; charset=utf-8");
header.put("Accept", "application/json"); header.put("Accept", "application/json");
String result = HttpRequest.post(url)
byte[] bytes = HttpRequest.post(url)
.body(param.toString()) .body(param.toString())
.headerMap(header, true) .headerMap(header, true)
.execute().body(); .execute().bodyBytes();
return "data:image/png;base64," + result; return "data:image/png;base64," + Base64.encode(bytes);
} }
/** /**
......
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