12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- /**
- * Created by PhpStorm
- * User:林志杰
- * Email:[email protected]
- * Motto:纵有疾风起,人生不言弃!
- * Time:2020/1/3 23:30
- */
- namespace app\admin\controller;
- use app\BaseController;
- use think\exception\HttpResponseException;
- class AdminBase extends BaseController
- {
- public $adminUser = null;
- public function initialize()
- {
- parent::initialize();
- // 判断是否登录 判断是否登陆 切换到 中间件Auth中
- // if (!$this->isLogin()) {
- // return $this->redirect(url('login/index'), 302);
- // }
- }
- /**
- * 判断是否登录
- * @return bool
- */
- public function isLogin()
- {
- $this->adminUser = session(config('admin.session_admin'));
- if (empty($this->adminUser)) {
- return false;
- }
- return true;
- }
- public function redirect(...$args)
- {
- throw new HttpResponseException(redirect(...$args));
- }
- }
|