Authored by Rock Zhang

修复第三方登录失败的bug(转换回调链接错误导致)

Code Review By Rock Zhang
@@ -915,4 +915,15 @@ class Helpers @@ -915,4 +915,15 @@ class Helpers
915 $sort = $desc == false ? SORT_ASC : SORT_DESC; 915 $sort = $desc == false ? SORT_ASC : SORT_DESC;
916 array_multisort($fieldArr, $sort, $array, $sortType); 916 array_multisort($fieldArr, $sort, $array, $sortType);
917 } 917 }
  918 +
  919 + /**
  920 + * 将首字符为//的url转换为http://
  921 + *
  922 + * @param string $url 需要转换的url
  923 + * @return mixed
  924 + */
  925 + public static function transHttpsUrl($url)
  926 + {
  927 + return preg_replace('/^\/\//', 'http://', $url);
  928 + }
918 } 929 }
@@ -16,5 +16,5 @@ return array( @@ -16,5 +16,5 @@ return array(
16 // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http 16 // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
17 'transport' => 'http', 17 'transport' => 'http',
18 // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数) 18 // 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数)
19 - 'return_url' => SITE_MAIN . '/passport/login/alipaycallback', 19 + 'return_url' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/alipaycallback',
20 ); 20 );
@@ -5,7 +5,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); @@ -5,7 +5,7 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
5 return array( 5 return array(
6 'appid' => '100229394', 6 'appid' => '100229394',
7 'appkey' => 'c0af9c29e0900813028c2ccb42021792', 7 'appkey' => 'c0af9c29e0900813028c2ccb42021792',
8 - 'callback' => strtr(SITE_MAIN, array('//' => 'http://')) . '/passport/login/qqcallback', 8 + 'callback' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/qqcallback',
9 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist', 9 'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist',
10 'errorReport' => true, 10 'errorReport' => true,
11 ); 11 );
@@ -5,5 +5,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']); @@ -5,5 +5,5 @@ defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
5 return array( 5 return array(
6 'appId' => '3739328910', 6 'appId' => '3739328910',
7 'appKey' => '9d44cded26d048e23089e5e975c93df1', 7 'appKey' => '9d44cded26d048e23089e5e975c93df1',
8 - 'appCallbackUrl' => strtr(SITE_MAIN, array('//' => 'http://')) . '/passport/login/sinacallback', 8 + 'appCallbackUrl' => \Plugin\Helpers::transUrl(SITE_MAIN) . '/passport/login/sinacallback',
9 ); 9 );