|
@@ -43,11 +43,15 @@ public class WxServiceImpl implements IWxService {
|
|
|
WxClient wxClient;
|
|
|
@Autowired
|
|
|
RedisUtil redisUtil;
|
|
|
+ @Value("${wx.env_version}")
|
|
|
+ String envVersion;
|
|
|
+ @Value("${wx.path}")
|
|
|
+ String wxPath;
|
|
|
|
|
|
//二维码
|
|
|
static String getWxQrCodeUrl ="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=%s";
|
|
|
//太阳码
|
|
|
- static String getWxSunCodeUrl ="https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s";
|
|
|
+ static String getWxSunCodeUrl ="https://api.weixin.qq.com/wxa/getwxacode?access_token=%s";
|
|
|
|
|
|
|
|
|
public String getToken(){
|
|
@@ -82,6 +86,7 @@ public class WxServiceImpl implements IWxService {
|
|
|
log.info("微信生成二维码接口返回内容长度小于1000");
|
|
|
String result = IOUtils.toString(response.getEntity().getContent());
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
+ System.out.println(jsonObject);
|
|
|
if(jsonObject.containsKey("errcode") && reCount < 2){
|
|
|
int errcode = jsonObject.getInteger("errcode");
|
|
|
if(errcode == 40001) {
|
|
@@ -124,7 +129,8 @@ public class WxServiceImpl implements IWxService {
|
|
|
httpClient = HttpClients.createDefault();
|
|
|
HttpPost httpPost = new HttpPost(urlStr);
|
|
|
Map<String, Object> jsonMap = new HashMap<>();
|
|
|
- jsonMap.put("scene", path);
|
|
|
+ jsonMap.put("path", wxPath+"?"+path);
|
|
|
+ jsonMap.put("env_version", envVersion);
|
|
|
log.info("上送给微信生成二维码的内容为:{}", JSONObject.toJSONString(jsonMap));
|
|
|
StringEntity requestEntity = new StringEntity(JSONObject.toJSONString(jsonMap), "utf-8");
|
|
|
requestEntity.setContentEncoding("UTF-8");
|