Skip to content

Commit

Permalink
fix: 修复Auth注解只获取method参数的,未获取class的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kanyxmo committed Apr 13, 2023
1 parent 23d663e commit df597fd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mine/Aspect/AuthAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,19 @@ class AuthAspect extends AbstractAspect
*/
public function process(ProceedingJoinPoint $proceedingJoinPoint)
{
$scene = 'default';

/** @var $auth Auth */
if (isset($proceedingJoinPoint->getAnnotationMetadata()->class[Auth::class])) {
$auth = $proceedingJoinPoint->getAnnotationMetadata()->class[Auth::class];
$scene = $auth->scene ?? 'default';
}

if (isset($proceedingJoinPoint->getAnnotationMetadata()->method[Auth::class])) {
$auth = $proceedingJoinPoint->getAnnotationMetadata()->method[Auth::class];
$scene = $auth->scene ?? 'default';
}

$scene = $auth->scene ?? 'default';

$loginUser = user($scene);

if (! $loginUser->check(null, $scene)) {
Expand Down

0 comments on commit df597fd

Please sign in to comment.