Commit 05543b08 by 303514581@qq.com

2019/4/20 js ticket获取机制再修改,调整时间并加入日志监控

parent 022cffea
package com.zhiwei.controller;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.FastDateFormat;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
......@@ -27,6 +29,7 @@ import com.zhiwei.Tool.GetWechatOpenUrl;
import com.zhiwei.Tool.Tools;
import com.zhiwei.config.WechatConfig;
import com.zhiwei.crawler.utils.TimeUtils;
import com.zhiwei.crawler.utils.TimeUtils.FastDateFormatFactory;
import com.zhiwei.entity.TokenEntity;
import com.zhiwei.entity.WeChatTokenEntity;
......@@ -52,7 +55,7 @@ public class WapWechatLoginController {
private static String JsApiTicketUrl = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=";
@Scheduled(fixedDelay = 6000)
@Scheduled(fixedDelay = 6000000)
public void reflashTicket() {
// 获取project
String tokenRes = Tools.httpGet(AccessTokenUrl);
......@@ -62,8 +65,11 @@ public class WapWechatLoginController {
String ticketRes = Tools.httpGet(JsApiTicketUrl + access_Token);
JSONObject ticketInfo = JSONObject.parseObject(ticketRes);
ticket = ticketInfo.getString("ticket");
}else {
ticket = tokenInfo.toJSONString();
FastDateFormat factory = FastDateFormatFactory.create("yyyy-MM-dd HH:mm:ss");
logger.info("更新时间:{}", factory.format(new Date()));
} else {
ticket = null;
logger.error(tokenInfo.toJSONString());
}
}
......
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