作者 郭鑫
1 个管道 的构建 通过 耗费 0 秒

测试问题修改

@@ -40,7 +40,7 @@ class WxloginController extends HomeBaseController @@ -40,7 +40,7 @@ class WxloginController extends HomeBaseController
40 } 40 }
41 } 41 }
42 parent::_initialize(); // TODO: Change the autogenerated stub 42 parent::_initialize(); // TODO: Change the autogenerated stub
43 - if(!Session::get('user.accessToken')){ 43 + if(!Session::get('user.accessToken') || !Session::get('uid')){
44 session('uid',null); 44 session('uid',null);
45 session('user.accessToken',null); 45 session('user.accessToken',null);
46 session('user.accessTime',null); 46 session('user.accessTime',null);
@@ -82,17 +82,11 @@ class WxloginController extends HomeBaseController @@ -82,17 +82,11 @@ class WxloginController extends HomeBaseController
82 * Main:授权登录 获取openid 82 * Main:授权登录 获取openid
83 */ 83 */
84 public function OAuth($redirect_uri){ 84 public function OAuth($redirect_uri){
85 - echo "<pre/>";  
86 - print_r('4444');  
87 - print_r(Session::get('uid'));  
88 - die;  
89 if (!Session::get('uid')) { 85 if (!Session::get('uid')) {
90 $url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; 86 $url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
91 $temp_one = explode('code=',$url); 87 $temp_one = explode('code=',$url);
92 if(!empty($temp_one[1])){ 88 if(!empty($temp_one[1])){
93 - echo "<pre/>";  
94 - print_r('333');  
95 - die; 89 +
96 $temp_two = explode('&state',$temp_one[1]); 90 $temp_two = explode('&state',$temp_one[1]);
97 if ($temp_two[0]) { 91 if ($temp_two[0]) {
98 //第二步 获取access_token 92 //第二步 获取access_token
@@ -138,10 +132,7 @@ class WxloginController extends HomeBaseController @@ -138,10 +132,7 @@ class WxloginController extends HomeBaseController
138 } 132 }
139 }else{ 133 }else{
140 $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".Config::get('WX_APPID')."&redirect_uri=" . $redirect_uri . "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"; 134 $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=".Config::get('WX_APPID')."&redirect_uri=" . $redirect_uri . "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
141 - echo "<pre/>";  
142 - print_r(111111111);  
143 - print_r($redirect_uri);  
144 - die; 135 +
145 Header("Location: $url"); 136 Header("Location: $url");
146 exit; 137 exit;
147 } 138 }