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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
Member.php
application/api/controller/Member.php
+2
-1
Basic.php
application/api/extend/Basic.php
+9
-8
JwtUntils.php
application/api/untils/JwtUntils.php
+4
-2
No files found.
application/api/controller/Member.php
View file @
a6a17bcf
...
...
@@ -66,7 +66,8 @@ class Member extends Basic
* @return type
*/
public
function
logout
()
{
$id
=
$this
->
params
[
'id'
];
$id
=
$this
->
userId
?
$this
->
userId
:
$this
->
params
[
'id'
];
$data
[
'status'
]
=
101
;
$data
[
'data'
]
=
''
;
$data
[
'msg'
]
=
''
;
...
...
application/api/extend/Basic.php
View file @
a6a17bcf
...
...
@@ -32,7 +32,7 @@ class Basic extends Controller
* @var int userId
*/
protected
$userId
;
protected
$user_nick
;
protected
$phone
;
protected
$timeStamp_
;
...
...
@@ -63,15 +63,16 @@ class Basic extends Controller
}
/*
$jwt = new \Firebase\JWT\JWT();
/*
$jwt = new \Firebase\JWT\JWT();
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result['data']["userId"];
$this->phone = $result['data']["phone"];
$this->timeStamp_ = $result["timeStamp_"];
$this->authToken = $this->params['AuthToken'];
$result = $jwt->decode($this->authToken, config('jwt_key'), array( 'HS256' )); //解码token
$this->userId = $result->data->id;
$this->phone = $result->data->phone;
$this->phone = $result->data->user_nick;
$this->timeStamp_ = $result->timeStamp_;
$this->verifyTime();
*/
$this->verifyTime();
*/
}
...
...
application/api/untils/JwtUntils.php
View file @
a6a17bcf
...
...
@@ -18,8 +18,10 @@ class JwtUntils {
* @return boolean
*/
public
function
createToken
(
$data
){
if
(
$data
)
{
$result
=
\Firebase\JWT\JWT
::
encode
(
$data
,
config
(
'jwt_key'
));
if
(
$data
)
{
$jwt_data
[
'data'
]
=
$data
;
$jwt_data
[
'timeStamp_'
]
=
time
();
$result
=
\Firebase\JWT\JWT
::
encode
(
$jwt_data
,
config
(
'jwt_key'
));
Session
::
set
(
'authToken'
,
$result
);
}
else
{
$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