You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

37 lines
771 B

  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2017/6/7
  6. * Time: 10:29
  7. */
  8. namespace common\Controller;
  9. use common\service\admin\LoginService;
  10. use yii;
  11. use yii\web\Controller;
  12. class AdminController extends Controller
  13. {
  14. public $service;
  15. /**
  16. * Des:校验是否登录
  17. * Name: beforeAction
  18. * @param yii\base\Action $action
  19. * @return bool
  20. * @author 倪宗锋
  21. */
  22. public function beforeAction($action)
  23. {
  24. $checkLogin = LoginService::checkLogin();
  25. if ($checkLogin['flag'] == false) {
  26. Yii::$app->response->format = 'json';
  27. Yii::$app->response->data = $checkLogin;
  28. return false;
  29. }
  30. $_COOKIE['admin_uid'] = LoginService::$uid;
  31. return true;
  32. }
  33. }