Skip to content

Commit

Permalink
版本依赖更新
Browse files Browse the repository at this point in the history
  • Loading branch information
lphkxd committed Jan 8, 2021
1 parent 63dc38b commit fa74e7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"require": {
"php": ">=7.3",
"ext-swoole": ">=4.5",
"96qbhy/hyperf-auth": "^2.3",
"hyperf-plus/helper": "^2.0.0"
"96qbhy/hyperf-auth": "^2.3"
},
"require-dev": {
},
Expand Down
3 changes: 2 additions & 1 deletion src/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Hyperf\Di\Annotation\AnnotationCollector;
use Hyperf\HttpServer\Annotation\Mapping;
use Hyperf\HttpServer\Router\DispatcherFactory;
use Hyperf\Utils\ApplicationContext;
use Psr\SimpleCache\CacheInterface;
use Qbhy\HyperfAuth\AuthManager;

Expand Down Expand Up @@ -202,7 +203,7 @@ public function loadRoles($reload = false)
*/
public function scanPermission()
{
$DispatcherFactory = get_container(DispatcherFactory::class);
$DispatcherFactory = ApplicationContext::getContainer()->get(DispatcherFactory::class);
$list = $DispatcherFactory->getRouter('http');
$this->ignore = [];
$this->loadRoles(true);
Expand Down
8 changes: 6 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

declare(strict_types=1);

/**
* This file is part of Hyperf.plus
*
Expand All @@ -9,12 +10,15 @@
* @contact 4213509@qq.com
* @license https://github.com/hyperf/hyperf-plus/blob/master/LICENSE
*/
if (! function_exists('permission')) {

use Hyperf\Utils\ApplicationContext;

if (!function_exists('permission')) {
/**
* @return \HPlus\Permission\Contracts\PermissionInterface
*/
function permission()
{
return get_container(\HPlus\Permission\Contracts\PermissionInterface::class);
return ApplicationContext::getContainer()->get(\HPlus\Permission\Contracts\PermissionInterface::class);
}
}

0 comments on commit fa74e7b

Please sign in to comment.