afa 4 달 전
부모
커밋
0d8e9fe5d3
3개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      application/api/controller/Chabao.php
  2. 1 0
      application/common/library/Auth.php
  3. 1 1
      application/common/library/Token.php

+ 1 - 1
application/api/controller/Chabao.php

@@ -86,7 +86,7 @@ class Chabao extends Api
         } catch (Exception $e) {
             // 回滚事务
            Db::rollback();
-            return $e->getMessage();
+           $this->error($e->getMessage());
         }
         if($newUserID == 0) $this->error('注册失败');
         $this->success('ok', ['token' => Token::getEncryptedToken($newUserID)]);

+ 1 - 0
application/common/library/Auth.php

@@ -98,6 +98,7 @@ class Auth
 
         // 校验Token有效性
         $check = Token::check($tokenInfo["user_id"], $tokenInfo["token"]);
+     
         if (!$check) {
             return false;
         }

+ 1 - 1
application/common/library/Token.php

@@ -109,7 +109,7 @@ class Token
     {
         $decode   = json_decode(base64_decode($token), true);
         $tokenArr = [];
-        if (!empty($decode) && !empty($decode["user_id"]) && is_int($decode["user_id"]) && !empty($decode["token"]) && is_string($decode["token"]) && !empty($decode["address"]) && is_string($decode["address"])) {
+        if (!empty($decode) && !empty($decode["user_id"]) && is_int($decode["user_id"]) && !empty($decode["token"]) && is_string($decode["token"])) {
             $tokenArr["user_id"] = $decode["user_id"];
             $tokenArr["token"]   = $decode["token"];
         }