You've already forked FrameTour-BE
2
This commit is contained in:
@@ -30,7 +30,7 @@ public class WxMpUtil {
|
||||
String response = HttpUtil.get(url);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
ACCESS_TOKEN = jsonObject.getString("access_token");
|
||||
expireTime = new Date(System.currentTimeMillis() + jsonObject.getInteger("expires_in") * 1000);
|
||||
expireTime = new Date(System.currentTimeMillis() + jsonObject.getInteger("expires_in") * 1000 / 2);
|
||||
return ACCESS_TOKEN;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,10 @@ public class WxMpUtil {
|
||||
httpPost.setHeader("Content-Type", "application/json");
|
||||
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
if (response.getStatusLine().getStatusCode() != 200) {
|
||||
expireTime = new Date();
|
||||
throw new Exception("获取小程序码失败");
|
||||
}
|
||||
HttpEntity responseEntity = response.getEntity();
|
||||
if (responseEntity != null) {
|
||||
byte[] bytes = EntityUtils.toByteArray(responseEntity);
|
||||
|
Reference in New Issue
Block a user