|
@@ -20,64 +20,61 @@ Log::record("state:{$state} originurl=" . wechat_helper::get_origin_url(),Log::D
|
|
|
if(empty($code)) {
|
|
|
Log::record("没有同意授权");
|
|
|
}
|
|
|
-else
|
|
|
+elseif(wechat_helper::has_origin_url())
|
|
|
{
|
|
|
- if(wechat_helper::has_origin_url())
|
|
|
+ $author = new thrid_author\wxauthor();
|
|
|
+ $user_info = $author->callback($code);
|
|
|
+ if(empty($user_info)) {
|
|
|
+ Log::record("微信取到的信息为空",Log::DEBUG);
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- $author = new \thrid_author\wxauthor();
|
|
|
- $user_info = $author->callback($code);
|
|
|
- if(empty($user_info)) {
|
|
|
- Log::record("微信取到的信息为空",Log::DEBUG);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- wechat_helper::set_userinfo($user_info);
|
|
|
- $origin_url = wechat_helper::get_origin_url();
|
|
|
- wechat_helper::clear_origin_url();
|
|
|
- Log::record("origin_url={$origin_url}",Log::DEBUG);
|
|
|
+ wechat_helper::set_userinfo($user_info);
|
|
|
+ $origin_url = wechat_helper::get_origin_url();
|
|
|
+ wechat_helper::clear_origin_url();
|
|
|
+ Log::record("origin_url={$origin_url}",Log::DEBUG);
|
|
|
|
|
|
- if(!empty($origin_url))
|
|
|
- {
|
|
|
- $html = "<!DOCTYPE html>
|
|
|
- <html lang=\"en\">
|
|
|
- <head>
|
|
|
- <meta charset=\"UTF-8\">
|
|
|
- <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\" />
|
|
|
- <meta http-equiv=\"Pragma\" content=\"no-cache\" />
|
|
|
- <meta http-equiv=\"Expires\" content=\"0\" />
|
|
|
- <title>跳转中</title>
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <script>
|
|
|
- window.location.replace(\"{$origin_url}\");
|
|
|
- </script>
|
|
|
- </body>
|
|
|
- </html>";
|
|
|
+ if(!empty($origin_url))
|
|
|
+ {
|
|
|
+ $html = "<!DOCTYPE html>
|
|
|
+ <html lang=\"en\">
|
|
|
+ <head>
|
|
|
+ <meta charset=\"UTF-8\">
|
|
|
+ <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\" />
|
|
|
+ <meta http-equiv=\"Pragma\" content=\"no-cache\" />
|
|
|
+ <meta http-equiv=\"Expires\" content=\"0\" />
|
|
|
+ <title>跳转中</title>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <script>
|
|
|
+ window.location.replace(\"{$origin_url}\");
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+ </html>";
|
|
|
|
|
|
- echo $html;
|
|
|
- }
|
|
|
+ echo $html;
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- $host = urldecode($state);
|
|
|
- $url = "{$host}/mobile/wxauthor.php?code={$code}";
|
|
|
- Log::record("redirect url={$url}",Log::DEBUG);
|
|
|
- $html = "<!DOCTYPE html>
|
|
|
- <html lang=\"en\">
|
|
|
- <head>
|
|
|
- <meta charset=\"UTF-8\">
|
|
|
- <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\" />
|
|
|
- <meta http-equiv=\"Pragma\" content=\"no-cache\" />
|
|
|
- <meta http-equiv=\"Expires\" content=\"0\" />
|
|
|
- <title>跳转中</title>
|
|
|
- </head>
|
|
|
- <body>
|
|
|
- <script>
|
|
|
- window.location.replace(\"{$url}\");
|
|
|
- </script>
|
|
|
- </body>
|
|
|
- </html>";
|
|
|
- echo $html;
|
|
|
- }
|
|
|
+}
|
|
|
+else
|
|
|
+{
|
|
|
+ $host = urldecode($state);
|
|
|
+ $url = "{$host}/mobile/wxauthor.php?code={$code}";
|
|
|
+ Log::record("redirect url={$url}",Log::DEBUG);
|
|
|
+ $html = "<!DOCTYPE html>
|
|
|
+ <html lang=\"en\">
|
|
|
+ <head>
|
|
|
+ <meta charset=\"UTF-8\">
|
|
|
+ <meta http-equiv=\"Cache-Control\" content=\"no-cache, no-store, must-revalidate\" />
|
|
|
+ <meta http-equiv=\"Pragma\" content=\"no-cache\" />
|
|
|
+ <meta http-equiv=\"Expires\" content=\"0\" />
|
|
|
+ <title>跳转中</title>
|
|
|
+ </head>
|
|
|
+ <body>
|
|
|
+ <script>
|
|
|
+ window.location.replace(\"{$url}\");
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+ </html>";
|
|
|
+ echo $html;
|
|
|
}
|