Explorar o código

修改文件大小写

Zhu Jinhui %!s(int64=7) %!d(string=hai) anos
pai
achega
03067ec403

+ 4 - 1
Qii/Base/Action.php

@@ -4,8 +4,11 @@
  */
 namespace Qii\Base;
 
-class Action 
+class Action extends Controller
 {
+    public $controllerId;
+    public $actionId;
+    public $response;
     public function __construct()
     {
 

+ 25 - 8
Qii/Base/Controller.php

@@ -39,7 +39,7 @@ abstract class Controller
      */
     public $request;
     /**
-     * @var Qii_Response_Abstract $response
+     * @var \Qii\Base\Response $response
      */
     public $response;
     /**
@@ -64,7 +64,7 @@ abstract class Controller
      * 是否启用Model
      * @var bool
      */
-    public $enableModel = false;
+    public $enableDB = false;
 
     public function __construct()
     {
@@ -73,8 +73,8 @@ abstract class Controller
         $this->controllerId = $this->request->controller;
         $this->actionId = $this->request->action;
         //载入model
-        if ($this->enableModel) {
-            $this->enableModel();
+        if ($this->enableDB) {
+            $this->enableDB();
         }
         //载入view
         if ($this->enableView) {
@@ -157,8 +157,10 @@ abstract class Controller
         }
         return $data;
     }
-
-    final public function enableModel()
+    /**
+     * 开启数据库操作
+     */
+    final public function enableDB()
     {
         return $this->db = \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Driver\Model');
     }
@@ -173,6 +175,14 @@ abstract class Controller
         return $this->view;
     }
 
+    /**
+     * 设置 response
+     * @param $request
+     */
+    public function setResponse(\Qii\Base\Response $response)
+    {
+        $this->response = $response;
+    }
     /**
      * 设置request
      * @param $request
@@ -197,7 +207,14 @@ abstract class Controller
      */
     protected function afterRun()
     {
-
+        if(!$this->response || !is_object($this->response))
+        {
+            return;
+        }
+        if($this->response instanceof \Qii\Base\Response)
+        {
+            $this->response->response();
+        }
     }
 
     /**
@@ -259,7 +276,7 @@ abstract class Controller
      */
     public function __destruct()
     {
-        $this->afterRun($this->controller, $this->actionId);
+        $this->afterRun($this->controllerId, $this->actionId);
         if ($this->request && $this->request->isForward()) {
             $this->request->setForward(false);
             \Qii::getInstance()->dispatcher->setRequest($this->request);

+ 9 - 6
Qii/Base/Dispatcher.php

@@ -9,7 +9,10 @@ class Dispatcher
     {
 
     }
-
+    /**
+     * 设置请求
+     * @param \Qii\Request\Http $request 当前请求
+     */
     public function setRequest(\Qii\Request\Http $request)
     {
         $this->request = $request;
@@ -40,12 +43,11 @@ class Dispatcher
         $controllerCls->controller = $controllerCls;
         $controllerCls->controllerId = $controller;
         $controllerCls->actionId = $action;
+        $response = null;
         //查看是否设置了当前action的对应关系,如果设置了就走对应关系里边的,否则走当前类中的
         if ($controllerCls->actions && isset($controllerCls->actions[$action]) && $controllerCls->actions[$action]) {
             $actionArgs = array();
             $actionArgs[] = $controllerCls->actions[$action];
-            //$actionArgs[] = $controllerCls;
-            //$actionArgs[] = $action;
             $actionCls = call_user_func_array(array($psr4, 'loadClass'), $actionArgs);
             $actionCls->setRequest($this->request);
             $actionCls->controller = $controllerCls;
@@ -53,19 +55,20 @@ class Dispatcher
             $actionCls->controllerId = $controllerCls->controllerId;
             //支持多个action对应到同一个文件,如果对应的文件中存在指定的方法就直接调用
             if (method_exists($actionCls, $action . \Qii\Config\Register::get(\Qii\Config\Consts::APP_DEFAULT_ACTION_SUFFIX))) {
-                return call_user_func_array(array($actionCls, $action. \Qii\Config\Register::get(\Qii\Config\Consts::APP_DEFAULT_ACTION_SUFFIX)), $funcArgs);
+                $actionCls->response = $response = call_user_func_array(array($actionCls, $action. \Qii\Config\Register::get(\Qii\Config\Consts::APP_DEFAULT_ACTION_SUFFIX)), $funcArgs);
             }
             if (!method_exists($actionCls, 'run')) {
                 throw new \Qii\Exceptions\MethodNotFound(\Qii::i(1101, $controllerCls->actions[$action] . '->run'), __LINE__);
             }
-            return call_user_func_array(array($actionCls, 'run'), $funcArgs);
+            $response = call_user_func_array(array($actionCls, 'run'), $funcArgs);
         } else {
             array_shift($funcArgs);
             $actionName = $action . \Qii\Config\Register::get(\Qii\Config\Consts::APP_DEFAULT_ACTION_SUFFIX);
             if (!method_exists($controllerCls, $actionName) && !method_exists($controllerCls, '__call')) {
                 throw new \Qii\Exceptions\MethodNotFound(\Qii::i(1101, $controller . '->' . $actionName), __LINE__);
             }
-            return call_user_func_array(array($controllerCls, $actionName), $funcArgs);
+            $controllerCls->response = $response = call_user_func_array(array($controllerCls, $actionName), $funcArgs);
         }
+        return $response;
     }
 }

+ 3 - 0
Qii/Base/Request.php

@@ -607,6 +607,9 @@ abstract class Request
 
         return false;
     }
+    /**
+     * 对于不存在的方法默认调用url中的方法
+     */
     public function __call($method, $args)
     {
         return call_user_func_array(array($this->url, $method), $args);

+ 47 - 30
Qii/Base/Response.php

@@ -1,5 +1,5 @@
 <?php
-namespace Qii\Response;
+namespace Qii\Base;
 
 class Response
 {
@@ -7,27 +7,34 @@ class Response
      * Default body name
      */
     const DEFAULT_BODY = 'html';
+    const FORMAT_JSON = 'json';
+    const FORMAT_HTML = 'html';
 
     /**
      * Body content
      * @var array
      */
-    protected $_body = array();
-
+    protected $body = array();
+    
+    /**
+     * data 
+     * @param array $data
+     */
+    protected $data = array();
     /**
      * Array of headers. Each header is an array with keys 'name' and 'value'
      * @var array
      */
-    protected $_headers = array();
+    protected $headers = array();
 
     /**
      * Determine to send the headers or not
      * @var unknown_type
      */
     protected $_sendHeader = false;
-	public function __construct()
+	public function __construct($data = array())
 	{
-		
+		$this->data = $data;
 	}
 
     /**
@@ -42,10 +49,10 @@ class Response
         if (!strlen($key)) {
             $key = self::DEFAULT_BODY;
         }
-        if (!isset($this->_body[$key])) {
-            $this->_body[$key] = '';
+        if (!isset($this->body[$key])) {
+            $this->body[$key] = '';
         }
-        $this->_body[$key] .= (string) $body;
+        $this->body[$key] .= (string) $body;
         return $this;
     }
 
@@ -58,11 +65,11 @@ class Response
     public function clearBody($key = NULL)
     {
         if (strlen($key)) {
-            if (array_key_exists($key, $this->_body)) {
-                unset($this->_body[$key]);
+            if (array_key_exists($key, $this->body)) {
+                unset($this->body[$key]);
             }
         } else {
-            $this->_body = array();
+            $this->body = array();
         }
         return true;
     }
@@ -74,7 +81,7 @@ class Response
      */
     public function clearHeaders()
     {
-        $this->_headers = array();
+        $this->headers = array();
         return $this;
     }
 
@@ -89,17 +96,17 @@ class Response
         if (!strlen($key)) {
             $key = self::DEFAULT_BODY;
         }
-        return array_key_exists($key, $this->_body) ? $this->_body[$key] : null;
+        return array_key_exists($key, $this->body) ? $this->body[$key] : null;
     }
 
     /**
-     * Return array of headers; see {@link $_headers} for format
+     * Return array of headers; see {@link $headers} for format
      *
      * @return array
      */
     public function getHeader()
     {
-        return $this->_headers;
+        return $this->headers;
     }
 
     /**
@@ -114,10 +121,10 @@ class Response
         if (!strlen($key)) {
             $key = self::DEFAULT_BODY;
         }
-        if (!isset($this->_body[$key])) {
-            $this->_body[$key] = '';
+        if (!isset($this->body[$key])) {
+            $this->body[$key] = '';
         }
-        $this->_body[$key] = $body . $this->_body[$key];
+        $this->body[$key] = $body . $this->body[$key];
         return $this;
     }
 
@@ -128,10 +135,25 @@ class Response
      */
     public function response()
     {
+        if($this->data && isset($this->data['body']))
+        {
+            switch($this->data['format'])
+            {
+                case self::FORMAT_JSON:
+                    $this->setHeader('Content-Type', 'text/json');
+                    $this->sendHeaders();
+                    echo json_encode($this->data['body'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
+                break;
+                default:
+                    echo $this->body;
+                break;
+            }
+            return;
+        }
         if ($this->_sendHeader == true) {
             $this->sendHeaders();
         }
-        foreach ($this->_body as $key => $body) {
+        foreach ($this->body as $key => $body) {
             echo $body;
         }
     }
@@ -152,7 +174,7 @@ class Response
         if (!strlen($key)) {
             $key = self::DEFAULT_BODY;
         }
-        $this->_body[$key] = (string) $body;
+        $this->body[$key] = (string) $body;
         return $this;
     }
 
@@ -173,14 +195,14 @@ class Response
         $value = (string) $value;
 
         if ($replace) {
-            foreach ($this->_headers as $key => $header) {
+            foreach ($this->headers as $key => $header) {
                 if ($name == $header['name']) {
-                    unset($this->_headers[$key]);
+                    unset($this->headers[$key]);
                 }
             }
         }
 
-        $this->_headers[] = array(
+        $this->headers[] = array(
             'name'    => $name,
             'value'   => $value,
             'replace' => $replace
@@ -245,7 +267,7 @@ class Response
      */
     protected function sendHeaders()
     {
-        foreach ($this->_headers as $header) {
+        foreach ($this->headers as $header) {
             header(
                 $header['name'] . ': ' . $header['value'],
                 $header['replace']
@@ -253,9 +275,4 @@ class Response
         }
         return $this;
     }
-
-    public function render()
-    {
-        
-    }
 }

+ 12 - 0
Qii/Driver/Model.php

@@ -94,8 +94,20 @@ class Model
                 '\Qii\Driver\\' . ucWords($this->_driver) . '\Connection'
             )
         );
+		$this->db->_debugSQL = isset($this->_dbInfo['debug']) ? $this->_dbInfo['debug'] : false;
 		return $this;
 	}
+	/**
+	 * 将属性转到DB类中去
+	 */
+	public function __get($attr)
+	{
+		if($this->db)
+		{
+			return $this->db->$attr;
+		}
+		return null;
+	}
 
 	/**
 	 * 获取当前使用的数据库

+ 8 - 13
Qii/Driver/Mysql/Driver.php

@@ -64,13 +64,13 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 */
 	public $useDB;
 	/**
-	 * @var string $__markKey 用于保存数据库执行相关信息
+	 * @var string $markKey 用于保存数据库执行相关信息
 	 */
-	private $__markKey = '__model';
+	public $markKey = '__model';
 	/**
-	 * @var string $_response Response对象
+	 * @var string $response Response对象
 	 */
-	protected $_response;
+	protected $response;
 
 	public function __construct(\Qii\Driver\ConnIntf $connection)
 	{
@@ -78,7 +78,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		$this->connection = $connection;
 		$this->sysConfigure = $this->connection->getDBInfo();
 		$this->useDB = $this->sysConfigure['master']['db'];
-		$this->_response = new \Qii\Driver\Response();
+		$this->response = new \Qii\Driver\Response();
 	}
 
 	/**
@@ -103,8 +103,6 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		 */
 		if ($this->_debugSQL) {
 			$startTime = microtime(true);
-			$this->_exeSQL[] = $sql;
-			\Qii::setPrivate('model', array('_exeSQL' => $this->_exeSQL));
 		}
 		$this->sql = $sql;
 		$this->db['CURRENT'] = $this->connection->getConnectionBySQL($this->sql);
@@ -120,6 +118,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 			$error = $this->getError('error');
 			return \Qii::setError(false, __LINE__, 1509, $sql, $error[2] == '' ? 'NULL' : $error[2]);
 		}
+		$this->_queryTimes++;
 		/**
 		 * 如果调试SQL的话就启用时间的记录
 		 */
@@ -130,10 +129,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 			$this->_querySeconds[$this->_queryTimes]['costTime'] = $costTime;
 			$this->_querySeconds[$this->_queryTimes]['startTime'] = $startTime;
 			$this->_querySeconds[$this->_queryTimes]['endTime'] = $endTime;
-			\Qii::setPrivate('model', array('_querySeconds' => $this->_querySeconds));
 		}
-		$this->_queryTimes++;
-		\Qii::setPrivate('model', array('_queryTimes' => $this->_queryTimes));
 		return $rs;
 	}
 
@@ -239,8 +235,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		if (\mysql_errno($this->db['CURRENT'])) {
 			$this->_errorInfo[$this->_queryTimes]['sql'] = $this->sql;
 			$this->_errorInfo[$this->_queryTimes]['error'][2] = \mysql_error($this->db['CURRENT']);
-			$this->_response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
-			\Qii::setPrivate('model', array('_errorInfo' => $this->_errorInfo));
+			$this->response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
 		}
 	}
 
@@ -264,6 +259,6 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 */
 	public function getResponse()
 	{
-		return $this->_response;
+		return $this->response;
 	}
 }

+ 7 - 22
Qii/Driver/Mysqli/Driver.php

@@ -64,13 +64,13 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 */
 	public $useDB;
 	/**
-	 * @var string $__markKey 用于保存数据库执行相关信息
+	 * @var string $markKey 用于保存数据库执行相关信息
 	 */
-	private $__markKey = '__model';
+	public $markKey = '__model';
 	/**
-	 * @var string $_response Response对象
+	 * @var string $response Response对象
 	 */
-	protected $_response;
+	protected $response;
 
 	public function __construct(\Qii\Driver\ConnIntf $connection)
 	{
@@ -78,7 +78,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		$this->connection = $connection;
 		$this->sysConfigure = $this->connection->getDBInfo();
 		$this->useDB = $this->sysConfigure['master']['db'];
-		$this->_response = new \Qii\Driver\Response();
+		$this->response = new \Qii\Driver\Response();
 	}
 
 	/**
@@ -109,8 +109,6 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		 */
 		if ($this->_debugSQL) {
 			$startTime = microtime(true);
-			$this->_exeSQL[] = $sql;
-			\Qii::setPrivate($this->__markKey, array('_exeSQL' => $this->_exeSQL));
 		}
 		$this->sql = $sql;
 		$this->db['CURRENT'] = $this->connection->getConnectionBySQL($this->sql);
@@ -126,6 +124,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 			$error = $this->getError('error');
 			return \Qii::setError(false, __LINE__, 1509, $sql, $error[2] == '' ? 'NULL' : $error[2]);
 		}
+		$this->_queryTimes++;
 		/**
 		 * 如果调试SQL的话就启用时间的记录
 		 */
@@ -136,10 +135,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 			$this->_querySeconds[$this->_queryTimes]['costTime'] = $costTime;
 			$this->_querySeconds[$this->_queryTimes]['startTime'] = $startTime;
 			$this->_querySeconds[$this->_queryTimes]['endTime'] = $endTime;
-			\Qii::setPrivate($this->__markKey, array('_querySeconds' => $this->_querySeconds));
 		}
-		$this->_queryTimes++;
-		\Qii::setPrivate($this->__markKey, array('_queryTimes' => $this->_queryTimes));
 		return $rs;
 	}
 
@@ -260,8 +256,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		if (\mysqli_errno($this->db['CURRENT'])) {
 			$this->_errorInfo[$this->_queryTimes]['sql'] = $this->sql;
 			$this->_errorInfo[$this->_queryTimes]['error'][2] = \mysqli_error($this->db['CURRENT']);
-			$this->_response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
-			\Qii::setPrivate($this->__markKey, array('_errorInfo' => $this->_errorInfo));
+			$this->response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
 		}
 	}
 
@@ -277,14 +272,4 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		}
 		return false;
 	}
-
-	/**
-	 * 返回response对象
-	 *
-	 * @return Bool
-	 */
-	public function getResponse()
-	{
-		return $this->_response;
-	}
 }

+ 33 - 22
Qii/Driver/Pdo/Driver.php

@@ -28,13 +28,13 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 *
 	 * @var unknown_type
 	 */
-	public $_queryTimes = 0;
+	public $queryTimes = 0;
 	/**
 	 * 查询耗时
 	 *
 	 * @var INT
 	 */
-	public $_querySeconds = array();
+	public $querySeconds = array();
 
 	/**
 	 * 最后一次执行的SQL
@@ -64,13 +64,13 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 */
 	public $useDB;
 	/**
-	 * @var string $__markKey debug信息保存用的key
+	 * @var string $markKey debug信息保存用的key
 	 */
-	private $__markKey = '__model';
+	public $markKey = '__model';
     /**
-     * @var string $_response Response对象
+     * @var string $response Response对象
      */
-    protected $_response;
+    public $response;
 	/**
 	 * 初始化
 	 * @param \Qii_Driver_ConnIntf $connection 数据库连接
@@ -81,7 +81,7 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		$this->connection = $connection;
 		$this->sysConfigure = $this->connection->getDBInfo();
 		$this->useDB = $this->sysConfigure['master']['db'];
-        $this->_response = new \Qii\Driver\Response();
+        $this->response = new \Qii\Driver\Response();
 	}
 
 	/**
@@ -115,8 +115,6 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 		 */
 		if ($this->_debugSQL) {
 			$startTime = microtime(true);
-			$this->_exeSQL[] = $sql;
-			\Qii::setPrivate($this->__markKey, array('_exeSQL' => $this->_exeSQL));
 		}
 		$this->sql = $sql;
 		$this->db['CURRENT'] = $this->connection->getConnectionBySQL($sql);
@@ -125,25 +123,24 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
         $this->db['CURRENT']->query('set names utf8');
 		$rs = $this->db['CURRENT']->query($sql);
 		$this->setError();
-		if (!$rs) {
+		if (!$rs) 
+		{
 			$error = $this->getError('error');
 			return \Qii::setError(false, __LINE__, 1509, $sql, $error[2] == '' ? 'NULL' : $error[2]);
 		}
 		$rs->setFetchMode(\PDO::FETCH_ASSOC);
+		$this->queryTimes++;
 		/**
 		 * 如果调试SQL的话就启用时间的记录
 		 */
 		if ($this->_debugSQL) {
 			$endTime = microtime(true);
 			$costTime = sprintf('%.4f', ($endTime - $startTime));
-			$this->_querySeconds[$this->_queryTimes]['sql'] = $sql;
-			$this->_querySeconds[$this->_queryTimes]['costTime'] = $costTime;
-			$this->_querySeconds[$this->_queryTimes]['startTime'] = $startTime;
-			$this->_querySeconds[$this->_queryTimes]['endTime'] = $endTime;
-			\Qii::setPrivate($this->__markKey, array('_querySeconds' => $this->_querySeconds));
+			$this->querySeconds[$this->queryTimes]['sql'] = $sql;
+			$this->querySeconds[$this->queryTimes]['costTime'] = $costTime;
+			$this->querySeconds[$this->queryTimes]['startTime'] = $startTime;
+			$this->querySeconds[$this->queryTimes]['endTime'] = $endTime;
 		}
-		$this->_queryTimes++;
-		\Qii::setPrivate($this->__markKey, array('_queryTimes' => $this->_queryTimes));
 		return $rs;
 	}
 
@@ -292,10 +289,9 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	public function setError()
 	{
 		if ($this->connection->getConnectionBySQL($this->sql)->errorCode() != '00000') {
-			$this->_errorInfo[$this->_queryTimes]['sql'] = $this->sql;
-			$this->_errorInfo[$this->_queryTimes]['error'] = $this->connection->getConnectionBySQL($this->sql)->errorInfo();
-			$this->_response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
-			\Qii::setPrivate($this->__markKey, array('_errorInfo' => $this->_errorInfo));
+			$this->_errorInfo[$this->queryTimes]['sql'] = $this->sql;
+			$this->_errorInfo[$this->queryTimes]['error'] = $this->connection->getConnectionBySQL($this->sql)->errorInfo();
+			$this->response = \Qii\Driver\Response::Fail('pdo.error', $this->_errorInfo);
 		}
 	}
 
@@ -306,10 +302,25 @@ class Driver extends \Qii\Driver\Base implements \Qii\Driver\Intf
 	 */
 	public function isError()
 	{
+		if(!$this->rs)
+		{
+			return true;
+		}
 		$errorInfo = $this->rs->errorInfo();
-		if ($this->connection->getConnectionBySQL($this->sql)->errorCode() != '00000') {
+		if ($this->connection->getConnectionBySQL($this->sql)->errorCode() != '00000') 
+		{
 			return true;
 		}
 		return false;
 	}
+
+	/**
+	 * 返回response对象
+	 *
+	 * @return Bool
+	 */
+	public function getResponse()
+	{
+		return $this->response;
+	}
 }

+ 1 - 1
Qii/Driver/Response.php

@@ -251,7 +251,7 @@ class Response
 	public static function Instance($code, $operate, $result)
 	{
 		$data = array('code' => $code, 'body' => array('operate' => $operate, 'result' => $result));
-		return (new Qii\Driver\Response())->set($data);
+		return (new \Qii\Driver\Response())->set($data);
 	}
 
 	/**

+ 2 - 2
Qii/Exceptions/Error.php

@@ -84,7 +84,7 @@ class Error
 		if ($condition) {
 			return false;
 		}
-		$appConfigure = \Qii::getConfig();
+		$appConfigure = \Qii::appConfigure();
 		//如果是调试模式就直接抛出异常
 		$isDebug = $appConfigure['debug'];
 		$message = array();
@@ -106,7 +106,7 @@ class Error
 			$filePath = \Qii\Autoloader\Import::requireByClass($controllerCls);
 			if (!is_file($filePath)) {
 				if ($env == 'product') return '';
-				\Qii_Autoloader_Import::requires(Qii_DIR . DS . 'Exceptions' . DS . 'Error.php');
+				\Qii\Autoloader\Import::requires(Qii_DIR . DS . 'Exceptions' . DS . 'Error.php');
 				call_user_func_array(array('\Qii\Exceptions\Error', 'index'), array($controller, $action));
 				die();
 			} else {

+ 1 - 1
Qii/Exceptions/Errors.php

@@ -62,7 +62,7 @@ class Errors extends \Exception
 			$message[] = 'Referer URL:' . (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : \Qii::getInstance()->request->url->getCurrentURL());
 			\Qii::getInstance()->logerWriter->writeLog($message);
 		}
-		$appConfigure = \Qii\Config\Register::getConfig();
+		$appConfigure = \Qii::appConfigure();
 
 		$env = \Qii\Config\Register::get(\Qii\Config\Consts::APP_ENVIRON, 'dev');
 		if ($env == 'product' || ($appConfigure['errorPage'] && (isset($appConfigure['debug']) && $appConfigure['debug'] == 0))) {

+ 0 - 12
private/Controller/Index.php

@@ -1,12 +0,0 @@
-<?php
-namespace Controller;
-
-class index extends \Qii\Base\Controller
-{
-    public $enableModel = true;
-    public function indexAction()
-    {
-        echo __CLASS__;
-        print_r($this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1'));
-    }
-}

+ 25 - 0
private/Controller/indexs.php

@@ -0,0 +1,25 @@
+<?php
+namespace Controller;
+
+class index extends \Qii\Base\Controller
+{
+    public $enableDB = true;
+    public function indexAction()
+    {
+        $data = array();
+        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1');
+        $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id ASC LIMIT 1');
+        $data['querySeconds'] = $this->db->querySeconds;
+        
+        return new \Qii\Base\Response(array('format' => 'json', 'body' => $data));
+    }
+    public function dispatchAction()
+    {
+        $this->dispatch('test', 'index');
+    }
+    
+    public function forwardAction()
+    {
+        $this->setForward('test', 'index');
+    }
+}

+ 10 - 0
private/Controller/test.php

@@ -0,0 +1,10 @@
+<?php
+namespace Controller;
+
+class test extends \Qii\Base\Controller
+{
+    public function indexAction()
+    {
+        echo __CLASS__;
+    }
+}

+ 1 - 0
private/configure/db.ini

@@ -3,6 +3,7 @@
 ;是否读写分离
 readOrWriteSeparation = 0
 driver = pdo
+debug = true
 ;使用的数据库类型
 use_db_driver = mysql
 master[db] = wecv

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
private/tmp/2017-06-28.loger.log


+ 1 - 0
private/tmp/product.db.ini.php

@@ -2,6 +2,7 @@
  return array (
   'readOrWriteSeparation' => '0',
   'driver' => 'pdo',
+  'debug' => '1',
   'use_db_driver' => 'mysql',
   'master' => 
   array (

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio