Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
a6a17bcf
Commit
a6a17bcf
authored
Dec 12, 2017
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jwt
parent
6e9e480a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
Member.php
application/api/controller/Member.php
+2
-1
Basic.php
application/api/extend/Basic.php
+6
-5
JwtUntils.php
application/api/untils/JwtUntils.php
+3
-1
No files found.
application/api/controller/Member.php
View file @
a6a17bcf
...
@@ -66,7 +66,8 @@ class Member extends Basic
...
@@ -66,7 +66,8 @@ class Member extends Basic
* @return type
* @return type
*/
*/
public
function
logout
()
{
public
function
logout
()
{
$id
=
$this
->
params
[
'id'
];
$id
=
$this
->
userId
?
$this
->
userId
:
$this
->
params
[
'id'
];
$data
[
'status'
]
=
101
;
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
''
;
$data
[
'data'
]
=
''
;
$data
[
'msg'
]
=
''
;
$data
[
'msg'
]
=
''
;
...
...
application/api/extend/Basic.php
View file @
a6a17bcf
...
@@ -32,7 +32,7 @@ class Basic extends Controller
...
@@ -32,7 +32,7 @@ class Basic extends Controller
* @var int userId
* @var int userId
*/
*/
protected
$userId
;
protected
$userId
;
protected
$user_nick
;
protected
$phone
;
protected
$phone
;
protected
$timeStamp_
;
protected
$timeStamp_
;
...
@@ -67,11 +67,12 @@ class Basic extends Controller
...
@@ -67,11 +67,12 @@ class Basic extends Controller
$this->authToken = $this->params['AuthToken'];
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result['data']["userId"];
$this->userId = $result->data->id;
$this->phone = $result['data']["phone"];
$this->phone = $result->data->phone;
$this->timeStamp_ = $result["timeStamp_"];
$this->phone = $result->data->user_nick;
$this->timeStamp_ = $result->timeStamp_;
$this->verifyTime();
*/
$this->verifyTime();
*/
}
}
...
...
application/api/untils/JwtUntils.php
View file @
a6a17bcf
...
@@ -19,7 +19,9 @@ class JwtUntils {
...
@@ -19,7 +19,9 @@ class JwtUntils {
*/
*/
public
function
createToken
(
$data
){
public
function
createToken
(
$data
){
if
(
$data
)
{
if
(
$data
)
{
$result
=
\Firebase\JWT\JWT
::
encode
(
$data
,
config
(
'jwt_key'
));
$jwt_data
[
'data'
]
=
$data
;
$jwt_data
[
'timeStamp_'
]
=
time
();
$result
=
\Firebase\JWT\JWT
::
encode
(
$jwt_data
,
config
(
'jwt_key'
));
Session
::
set
(
'authToken'
,
$result
);
Session
::
set
(
'authToken'
,
$result
);
}
else
{
}
else
{
$result
=
false
;
$result
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment