Commit 28a28fc1 authored by shajiaiming's avatar shajiaiming

fix

parent 8b5ca475
...@@ -18,7 +18,8 @@ class LoginStatusAuthInterceptor extends ActionFilter ...@@ -18,7 +18,8 @@ class LoginStatusAuthInterceptor extends ActionFilter
{ {
public function beforeAction($action) public function beforeAction($action)
{ {
$token_string = Yii::$app->request->headers->get('access_token'); $token_string = Yii::$app->request->headers->get('Token');
if(false == $token_string){ if(false == $token_string){
$message = 'platform auth error'; $message = 'platform auth error';
$code = '40004'; $code = '40004';
......
...@@ -10,13 +10,13 @@ namespace common\behaviors; ...@@ -10,13 +10,13 @@ namespace common\behaviors;
use api\base\ResponseMsg; use api\base\ResponseMsg;
use yii\base\ActionFilter; use yii\base\ActionFilter;
use common\models\Admin;
use Yii; use Yii;
class UserAuthInterceptor extends ActionFilter class UserAuthInterceptor extends ActionFilter
{ {
public function beforeAction($action) public function beforeAction($action)
{ {
return true;
if (!parent::beforeAction($action)){ if (!parent::beforeAction($action)){
return false; return false;
} }
...@@ -24,8 +24,12 @@ class UserAuthInterceptor extends ActionFilter ...@@ -24,8 +24,12 @@ class UserAuthInterceptor extends ActionFilter
$request_class = get_class($action->controller); $request_class = get_class($action->controller);
$request_action = $action->id; $request_action = $action->id;
$user_id = 46; $token_string = Yii::$app->request->headers->get('Token');
$platform_id = 17; $model = new Admin();
$user = $model->loginByAccessToken($token_string,'');
$user_id = $user->uid;
$platform_id = $user->platform_id;
#var_dump($user_id,$platform_id);exit;
$user_auth = Yii::$app->params['user_auth']['user_auth']; $user_auth = Yii::$app->params['user_auth']['user_auth'];
$user_auth_map = $user_auth[$platform_id] ?? null; $user_auth_map = $user_auth[$platform_id] ?? null;
if(empty($user_auth_map)){ if(empty($user_auth_map)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment