コード例 #1
0
 public function end()
 {
     parent::end();
     // TODO: Change the autogenerated stub
     Yii::$app->session->close();
 }
コード例 #2
0
 /**
  * @param \yii\base\Action $action
  * @param mixed $result
  * @return mixed|void
  * @throws \yii\db\Exception
  */
 public function afterAction($action, $result)
 {
     /**
      * 设置导航
      */
     if (($this->format == '' || $this->format == 'html') && !$this->request->getIsAjax()) {
         if ($action->id !== 'login') {
             $myPermission = AdminUser::getPermission($this->user->id);
             $this->setResponseData('topMenu', $this->getTopMenu($myPermission));
             $path = $action->controller->route;
             if (!empty($path) && $path != \Yii::$app->defaultRoute && $path != \Yii::$app->errorHandler->errorAction) {
                 /**
                  * @var $perm \liuxy\admin\models\Permission
                  */
                 $perm = Permission::find()->where(['link' => $path])->one();
                 if ($perm) {
                     $this->setResponseData('current', $perm);
                     /**
                      * @var $top \liuxy\admin\models\Permission
                      */
                     $top = Permission::findTop($perm);
                     $this->setResponseData('topItem', $top);
                     $this->setResponseData('subMenu', $this->getSubMenu($top->id, $myPermission));
                 } else {
                     $this->setDefaultMenu();
                 }
             } else {
                 $this->setDefaultMenu();
             }
         }
     }
     return parent::afterAction($action, $result);
 }
コード例 #3
0
 public function end()
 {
     parent::end();
     Yii::$app->session->close();
 }