Prechádzať zdrojové kódy

debug wechat author

stanley-king 8 rokov pred
rodič
commit
fb96cc18af

+ 1 - 3
helper/login_helper.php

@@ -22,12 +22,11 @@ class login_helper
         if($logger->ismember($mobile) == true)
         {
             Log::record("login_helper::onBinded 1",Log::DEBUG);
-
             $user_info = self::user_info();
             if($user_info != false) {
                 Log::record("login_helper::onBinded 2",Log::DEBUG);
-
                 $logger->bind($user_info);
+                $logger->login();
                 unset($_SESSION['wx_author']);
             }
         }
@@ -39,7 +38,6 @@ class login_helper
             $user_info = self::user_info();
             if($logger->register($passwd,$user_info) != false) {
                 Log::record("login_helper::onBinded 4",Log::DEBUG);
-
                 $logger->login();
                 unset($_SESSION['wx_author']);
             }

+ 6 - 0
helper/session_helper.php

@@ -289,12 +289,14 @@ class session_helper
         {
             if(array_key_exists('wx_author',$_SESSION))
             {
+                Log::record("need_wechat_author 1",Log::DEBUG);
                 if(array_key_exists('handled',$_SESSION['wx_author']))
                 {
                     $user_info = $_SESSION['wx_author']['user_info'];
                     $loginer = new \login\unionid_log($user_info['unionid']);
 
                     if(self::logined()) {
+                        Log::record("need_wechat_author 1 1",Log::DEBUG);
                         $loginer->bind($user_info);
                         $loginer->login();
                         unset($_SESSION['wx_author']);
@@ -303,12 +305,16 @@ class session_helper
                     {
                         if($loginer->ismember() == true)
                         {
+                            Log::record("need_wechat_author 1 2",Log::DEBUG);
+
                             $loginer->bind($user_info);
                             $loginer->login();
                             unset($_SESSION['wx_author']);
                         }
                     }
                 }
+                Log::record("need_wechat_author 2",Log::DEBUG);
+
 
                 return false;
             }

+ 5 - 0
test/TestAuthor.php

@@ -11,6 +11,7 @@ define('BASE_ROOT_PATH',str_replace('/test','',dirname(__FILE__)));
 
 require_once (BASE_ROOT_PATH . '/fooder.php');
 require_once (BASE_ROOT_PATH . '/helper/third_author/wxauthor.php');
+require_once (BASE_ROOT_PATH . '/helper/login_helper.php');
 
 class TestAuthor extends PHPUnit_Framework_TestCase
 {
@@ -24,6 +25,10 @@ class TestAuthor extends PHPUnit_Framework_TestCase
         $author = new thrid_author\wxauthor();
         $author->enter();
     }
+    public function testOnbind()
+    {
+        login_helper::onBinded('18911779278','3568');
+    }
     public function testOrigin()
     {
         $val = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.3.12 (KHTML, like Gecko) Mobile/14C92 MicroMessenger/6.5.7 NetType/WIFI Language/zh_CN';