You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
944 B

<?php
namespace api\controllers;
use api\logic\Login;
use common\models\User;
use yii\filters\auth\HttpBearerAuth;
use yii\helpers\ArrayHelper;
use yii\rest\ActiveController;
use Yii;
class UserController extends CommonController
{
public $modelClass = 'common\models\User';
public function actions()
{
$action = parent::actions();
unset($action['delete']);
unset($action['view']);
$action['options'] = [
'class' => 'yii\rest\OptionsAction',
'collectionOptions' => ['PUT', 'GET', 'OPTIONS']
];
return $action;
}
public function actionIndex()
{
return Yii::$app->user->identity;
}
/**
* @return string
* @throws \yii\base\Exception
* @throws \yii\web\NotFoundHttpException
* @throws \yii\web\ServerErrorHttpException
*/
public function actionToken()
{
return Login::wxLogin();
}
}