Commit 88eeb2b3 by 303514581@qq.com

2019/4/19 jsapi-ticket有效期更新

parent 46902c19
......@@ -44,7 +44,7 @@ public class WapWechatLoginController {
private static Long ticketTime = null;
private static Long ticket_expires_in = null;
private static Long ticket_expires_in = 5L;
private static String AccessTokenUrl = "http://yuqing.zhiweidata.com/WechatPublic/common/getToken.do?appId=10899EAFD60082D2E44C037DD89B881259479759686FDF66939F540EEC0901B1";
......@@ -121,7 +121,8 @@ public class WapWechatLoginController {
@RequestMapping("/wapwechat/jsapiticket")
public String wapJsapiTicket(HttpServletResponse response, HttpServletRequest request) {
try {
if (!StringUtils.isEmpty(ticket) && ((System.currentTimeMillis() - ticketTime) < (ticket_expires_in * 1000L))) {
if (!StringUtils.isEmpty(ticket)
&& ((System.currentTimeMillis() - ticketTime) < (ticket_expires_in * 1000L))) {
} else {
String tokenRes = Tools.httpGet(AccessTokenUrl);
JSONObject tokenInfo = JSONObject.parseObject(tokenRes);
......@@ -131,7 +132,7 @@ public class WapWechatLoginController {
JSONObject ticketInfo = JSONObject.parseObject(ticketRes);
ticket = ticketInfo.getString("ticket");
ticketTime = System.currentTimeMillis();
ticket_expires_in = ticketInfo.getLongValue("expires_in");
ticket_expires_in = 5L;
}
}
logger.error("ticketTime" + ticketTime + "|" + ticket_expires_in);
......
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