强化success/error方法,支持数据返回

This commit is contained in:
huangdijia
2015-12-17 11:59:30 +08:00
parent 0bb13ec16a
commit 098eae6aa0

View File

@@ -108,10 +108,10 @@ trait View
* @param integer $wait 跳转等待时间
* @return void
*/
protected function error($message, $jumpUrl = '', $wait = 5)
protected function error($message, $data = '', $jumpUrl = '', $wait = 5)
{
$jumpUrl = $jumpUrl ?: 'javascript:history.back(-1);';
return $this->result('', $message, 0, $jumpUrl, $wait);
return $this->result($data, $message, 0, $jumpUrl, $wait);
}
/**
@@ -122,10 +122,10 @@ trait View
* @param integer $wait 跳转等待时间
* @return void
*/
protected function success($message, $jumpUrl = '', $wait = 3)
protected function success($message, $data = '', $jumpUrl = '', $wait = 3)
{
$jumpUrl = $jumpUrl ?: $_SERVER["HTTP_REFERER"];
return $this->result('', $message, 1, $jumpUrl, $wait);
return $this->result($data, $message, 1, $jumpUrl, $wait);
}
}