内核更新

This commit is contained in:
2016-08-16 16:14:36 +08:00
parent ebde0fc13e
commit 81a25be484
25 changed files with 340 additions and 129 deletions

View File

@@ -31,9 +31,10 @@ trait Jump
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @param array $header 发送的Header信息
* @return void
*/
protected function success($msg = '', $url = null, $data = '', $wait = 3)
protected function success($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
$code = 1;
if (is_numeric($msg)) {
@@ -58,7 +59,7 @@ trait Jump
$result = ViewTemplate::instance(Config::get('template'), Config::get('view_replace_str'))
->fetch(Config::get('dispatch_success_tmpl'), $result);
}
$response = Response::create($result, $type);
$response = Response::create($result, $type)->header($header);
throw new HttpResponseException($response);
}
@@ -69,9 +70,10 @@ trait Jump
* @param string $url 跳转的URL地址
* @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间
* @param array $header 发送的Header信息
* @return void
*/
protected function error($msg = '', $url = null, $data = '', $wait = 3)
protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
{
$code = 0;
if (is_numeric($msg)) {
@@ -96,7 +98,7 @@ trait Jump
$result = ViewTemplate::instance(Config::get('template'), Config::get('view_replace_str'))
->fetch(Config::get('dispatch_error_tmpl'), $result);
}
$response = Response::create($result, $type);
$response = Response::create($result, $type)->header($header);
throw new HttpResponseException($response);
}
@@ -107,9 +109,10 @@ trait Jump
* @param integer $code 返回的code
* @param mixed $msg 提示信息
* @param string $type 返回数据格式
* @param array $header 发送的Header信息
* @return void
*/
protected function result($data, $code = 0, $msg = '', $type = '')
protected function result($data, $code = 0, $msg = '', $type = '', array $header = [])
{
$result = [
'code' => $code,
@@ -118,7 +121,7 @@ trait Jump
'data' => $data,
];
$type = $type ?: $this->getResponseType();
$response = Response::create($result, $type);
$response = Response::create($result, $type)->header($header);
throw new HttpResponseException($response);
}