|
|
|
@ -1,6 +1,8 @@
|
|
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.security.MessageDigest;
|
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
@ -153,8 +156,11 @@ public class WeChatServiceImpl implements WeChatService {
|
|
|
|
|
}
|
|
|
|
|
map.put("path", req.getPath() + "?shanghuId=" + req.getShanghuId());
|
|
|
|
|
String jsonStr = JSONUtil.toJsonStr(map);
|
|
|
|
|
String body = HttpUtil.post("https://api.weixin.qq.com/wxa/getwxacode?access_token=" + accessToken, jsonStr);
|
|
|
|
|
// return Base64.getEncoder().encodeToString(body.getBytes());
|
|
|
|
|
return body.getBytes();
|
|
|
|
|
byte[] qrCode = HttpRequest.post("https://api.weixin.qq.com/wxa/getwxacode?access_token=" + accessToken)
|
|
|
|
|
.body(jsonStr)
|
|
|
|
|
.execute().bodyBytes();
|
|
|
|
|
String filePath = "../classes/data/uploads/"+"vx图片"+".jpg";
|
|
|
|
|
File file = FileUtil.writeBytes(qrCode, filePath);
|
|
|
|
|
return qrCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|