<?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(); } }