-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services方法去掉action开头的形式,全部改为public函数,以及代码格式的调整
- Loading branch information
1 parent
b999199
commit dac5588
Showing
99 changed files
with
744 additions
and
1,620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ public function init() | |
* @param $data|array | ||
* 数组格式:['username'=>'[email protected]','password'=>'xxxx'] | ||
*/ | ||
public function actionLogin($data) | ||
public function login($data) | ||
{ | ||
$model = new $this->_adminUserLoginModelName(); | ||
$model->username = $data['username']; | ||
|
@@ -67,6 +67,7 @@ public function loginAndGetAccessToken($username, $password) | |
$access_token_created_at = $identity->access_token_created_at; | ||
$timeout = Yii::$service->session->timeout; | ||
if ($access_token_created_at + $timeout > time()) { | ||
|
||
return $accessToken; | ||
} | ||
} | ||
|
@@ -83,8 +84,10 @@ public function loginAndGetAccessToken($username, $password) | |
$identity->access_token_created_at = time(); | ||
$identity->save(); | ||
$this->setHeaderAccessToken($identity->access_token); | ||
|
||
return $identity->access_token; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
@@ -94,8 +97,10 @@ public function setHeaderAccessToken($accessToken) | |
{ | ||
if ($accessToken) { | ||
Yii::$app->response->getHeaders()->set('access-token', $accessToken); | ||
|
||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
|
@@ -125,9 +130,11 @@ public function loginByAccessToken($type = null) | |
$identity->access_token_created_at = time(); | ||
$identity->save(); | ||
} | ||
|
||
return $identity; | ||
} else { | ||
$this->logoutByAccessToken(); | ||
|
||
return false; | ||
} | ||
} | ||
|
Oops, something went wrong.