-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Miaoxing\App\Middleware; | ||
|
||
use Miaoxing\Plugin\Middleware\Base; | ||
use Miaoxing\Plugin\Service\AppRecord; | ||
use Wei\RetTrait; | ||
|
||
class CheckAppStatus extends Base | ||
{ | ||
use RetTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function __invoke($next) | ||
{ | ||
// 超级管理员下线也可以访问,以便进行功能调整 | ||
if (wei()->curUser->isSuperAdmin()) { | ||
return $next(); | ||
} | ||
|
||
$record = $this->app->getRecord(); | ||
if (isset($record['status']) && $record['status'] != AppRecord::STATUS_ONLINE) { | ||
return $this->err('很抱歉,该应用已经' . $record->getConstantValue('status', $record['status'], 'text')); | ||
} | ||
|
||
return $next(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters