|
|
@@ -101,6 +101,12 @@ public class WeChatLoginCheckService {
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000);// 线程休眠一秒
|
|
|
+ } catch (Exception ignored) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -115,7 +121,9 @@ public class WeChatLoginCheckService {
|
|
|
private void handleLoginSuccess(String cookie) {
|
|
|
try {
|
|
|
// 确认登录后,请求登录接口,拿到登录状态的cookie
|
|
|
- WxResultBody bizlogin = WeiXinApi.bizlogin(cookie);
|
|
|
+ WxResultBody bizlogin = WeiXinApi.bizlogin1(cookie);
|
|
|
+ String cookies = bizlogin.getCookies();
|
|
|
+ String cookieRes = cookie + ";" + cookies;
|
|
|
//重定向地址
|
|
|
String redirect_url = bizlogin.getRedirect_url();
|
|
|
//解析成键值对
|
|
|
@@ -125,20 +133,21 @@ public class WeChatLoginCheckService {
|
|
|
System.out.println("------------------");
|
|
|
System.out.println(cookie);
|
|
|
System.out.println(token);
|
|
|
- //设置全局token值
|
|
|
- MyCookieStore.setToken(token);
|
|
|
-
|
|
|
- final String token1 = MyCookieStore.getToken();
|
|
|
- System.out.println("AAA:" + token1);
|
|
|
- try {
|
|
|
- WxResultBody<List<Article>> findExList = WeiXinApi.findExList("MzA4NDAzMjcyOA==", token, cookie);
|
|
|
- List<Article> exList = findExList.getApp_msg_list();
|
|
|
- System.out.println("=====================");
|
|
|
- System.out.println(exList);
|
|
|
- System.out.println(exList.size());
|
|
|
- } catch (Exception ignored) {
|
|
|
-
|
|
|
- }
|
|
|
+ //todo token与cookie的存储方法
|
|
|
+// //设置全局token值
|
|
|
+// MyCookieStore.setToken(token);
|
|
|
+//
|
|
|
+// final String token1 = MyCookieStore.getToken();
|
|
|
+// System.out.println("AAA:" + token1);
|
|
|
+// try {
|
|
|
+// WxResultBody<List<Article>> findExList = WeiXinApi.findExList("MzA4NDAzMjcyOA==", token, cookieRes);
|
|
|
+// List<Article> exList = findExList.getApp_msg_list();
|
|
|
+// System.out.println("=====================");
|
|
|
+// System.out.println(exList);
|
|
|
+// System.out.println(exList.size());
|
|
|
+// } catch (Exception ignored) {
|
|
|
+//
|
|
|
+// }
|
|
|
log.info("微信登录成功,token已保存: {}", token);
|
|
|
} catch (Exception e) {
|
|
|
log.error("处理登录成功失败: {}", e.getMessage(), e);
|