InstallMiddleware.php 572 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-03-26
  7. *
  8. *
  9. */
  10. namespace app\common\middleware;
  11. use app\Request;
  12. use think\exception\HttpResponseException;
  13. use think\facade\Route;
  14. use think\Response;
  15. class InstallMiddleware extends BaseMiddleware
  16. {
  17. public function before(Request $request)
  18. {
  19. if(!file_exists(__DIR__.'/../../../install/install.lock')){
  20. throw new HttpResponseException( Response::create('/install.html', 'redirect')->code(302));
  21. }
  22. }
  23. public function after(Response $response)
  24. {
  25. }
  26. }