access toekn
出現了Exception in thread "main" net.sf.json.JSONException: JSONObject["expires_in"] not found.這個問題
?public?static?AccessToken?getAccessToken()?throws?Exception?{ ????????//?TODO?code?application?logic?here ???????AccessToken?token?=?new?AccessToken(); ????????String?url?=?ACCESS_TOKEN_URL.replace("APPID",?APPID).replace("APPSECRET",?APPSECRET); ????????WeixinUtil?wx=new?WeixinUtil(); ????????System.out.println(url); ???????? ????????while(true){ ????????????JSONObject?jsonObject?=wx.httpsRequest(url,"GET",null); ????????????if(null?!=?jsonObject){ ??????????? ????????????????token.setToken(jsonObject.getString("access_token")); ????????????????token.setExpiresIn(jsonObject.getInt("expires_in")); //????????????????獲取到的access_tocken值可以寫入到文本文件中供其他業務邏輯調用,實例中只打印了沒有保存到文件 ???????????????System.out.println("獲取成功"+token.getToken()+"||expires_in="+token.getExpiresIn()); ??????????????? ????????????} ????????????//休眠1小時57分鐘,提前3分鐘獲取新的access_token ????????????sleep((7200-7000)*1000); ????????}
2022-03-23
這里的選框坐標其實就是其左上角(left-top-corner)的坐標,因為左上角坐標沒動,所以不需要重設坐標。...沒基礎看什么