Example #1
0
File: Auth.php Project: hejxing/jt
 /**
  * Auth constructor.
  */
 public function __construct()
 {
     $controller = Controller::current();
     $this->action = $controller->getAction();
     $this->ruler = $controller->getRuler();
     $this->param = $controller->getParam();
 }
Example #2
0
 /**
  * 业务层有抛出错误
  */
 public function _fail()
 {
     $code = $this->getFromHead('code');
     if ($code) {
         $this->out('code', $code);
     }
     $msg = $this->getFromHead('msg');
     if ($msg) {
         $this->out('code', $msg);
     }
     $this->out('title', '操作失败');
     Controller::current()->setTemplate('error/fail');
 }
Example #3
0
File: Error.php Project: hejxing/jt
 /**
  * 寻找当前的ACTION
  *
  * @param string $method
  *
  * @return \jt\Controller|\jt\ErrorHandler
  */
 private static final function getAction(&$method)
 {
     $controller = Controller::current();
     $action = $controller->getAction();
     if ($action && method_exists($action, $method)) {
         return $action;
     }
     if (!$controller->loadAction('\\app\\' . MODULE . '\\action\\ErrorHandler', $method)) {
         if (!$controller->loadAction('\\jt\\ErrorHandler', $method) && $method !== 'unkown_error') {
             $method = 'unkown_error';
             return self::getAction($method);
         }
     }
     return $controller->getAction();
 }